Page 1 of 1

Setting up folder checks

Posted: Wed Jan 06, 2021 1:58 pm
by hjdevine
I have a 30 day trial of NagiosXI that we're evaluating. One of the items we'd like to set up is the ability to monitor and notify our admins in certain folders start to fill up. For example:

/var > 80% (warning) and > 90% (critical)
/var/log/audit > 80% (warning) and > 90% (critical)

I can't seem to find any documentation on how to do this and set this up. I did see something stating that we need to have passwordless ssh working with the nagios user between the servers, but when I ssh into a target machine from my nagios server using "nagios" as the user, the target machine rejects attempt with "This account is currently not available" and closes the connection.

Also, when we do get this set up, is there a way that we can set it up for all servers, or a hand-selected range of servers, all at once?

Thanks,
Harry

Re: Setting up folder checks

Posted: Wed Jan 06, 2021 6:26 pm
by ssax
I see this is your first post and I'd like to thank you for choosing Nagios! We're happy have you in the community. Besides the support forum, please check out our knowledgebase for useful tech tips and HowTos. And to extend product functionality, you'll find thousands of plugins and addons on the Nagios Exchange. Welcome aboard!

Do you have an agent installed on it such as NCPA/NRPE/NSClient++ (if so, which) or are you specifically trying to check via SSH or SNMP or something else?

"This account is currently not available" likely means you have /etc/passwd set to /sbin/nologin for the nagios user:

You can technically edit /etc/passwd and change /sbin/nologin to /bin/bash for the nagios user to be able to SSH in as the nagios user. (you don't technically need a nagios user on the remote system, it can be any account)

You can see here for how to check via SSH:

https://assets.nagios.com/downloads/nag ... ng_SSH.pdf

More than likely unless you specifically want to use SSH to monitor them you would install an agent and then see what options are available for the agent, you would likely need to find a plugin that will do this for you (NCPA doesn't have file/folder checks built-in but it can run plugins, NSClient++ while usually for Windows can also be setup on Linux which should have file/folder check functionality.

It really depends on how specifically you want to monitor them and are currently monitoring them (protocols/agents/etc).

Once we have a service we can define, you can create a hostgroup and add all those servers into it, and then edit the service and attach it to the hostgroup and then every host in the hostgroup will inherit the services automatically.

Re: Setting up folder checks

Posted: Fri Jan 08, 2021 8:38 am
by hjdevine
To my knowledge, I don't have any agents installed anywhere. I did the base install, then used Autodiscovery on our subnet to find the machines we had. That found pretty much all of them and they are being monitored for HTTP, HTTPS, Ping, SSH, and a few other services where appropriate.

I checked and the ssh monitoring is using the xiwizard_ssh_service template. Not sure what that does, but it does make a successful ssh connection when I run "Check Command" on against a host. I see there's a Deploy Agent option under Configure, but I don't know what that does. I'm VERY new to Nagios so I'm still feeling my way around.

I don't know what NCPA, NRPE, or NSClient++ are. Are they required to obtain the disk/folder/partition monitoring I would like to achieve? I'd like to list a series of folders to check their sizes and email our admin team if the used space goes above 80%. Also, I looked at the PDF you linked and that mentions the nagios user. You mentioned that we don't necessarily need to use the nagios user, and we do have a common user on all of our machines, so how can we use that user instead of the default nagios user?

Thanks!
Harry

Re: Setting up folder checks

Posted: Fri Jan 08, 2021 5:02 pm
by ssax
The auto-discovery is essentially just monitoring publicly available ports on the system using a TCP check, it won't see process/service status, drive space, CPU usage, etc.

In order to get access to those metrics you first need to determine what options you currently have to monitor the device (a server in this case). If it's a Linux/Unix system you can generally enable SNMP on the remote system and then run the Linux SNMP wizard against it to get access to those metrics:

https://assets.nagios.com/downloads/nag ... g-SNMP.pdf

If it has SSH you can use the one I linked to by following the guide but you would essentially need to find all the plugins you want to use in order to monitor the things you want. For ease of use if you allowed to use SNMP in your org that's usually the fastest route to get access. Installing an agent gives you the most flexibility though (as well as having built-in checks that can check most of the metrics you need) while giving you the ability to run 3rd party plugins (or script/plugins you write yourself), in that case I'd choose NCPA (our official cross platform agent https://www.nagios.org/ncpa/) which can be deployed (installed by the XI server remotely) using Configure > Deploy Agent and then use the NCPA wizard to monitor it.

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Given the output, it looks like it's a Linux/Unix system, what OS/version is it?
So how can we use that user instead of the default nagios user?
Technically, since the wizard doesn't support the different username (but the backend plugin does) you would need to manually create the services (which you can copy once they are created to do other things)

When doing this from the guide:

Code: Select all

ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@remoteip
Do this instead:

Code: Select all

ssh-copy-id -i ~/.ssh/id_rsa.pub whatever_user_you_want@remoteip
When testing passwordless login from the guide use this:

Code: Select all

ssh whatever_user_you_want@remoteip
Then when testing the plugin you would need to add the -l whatever_user_you_want (that's a lowercase L) option:

Code: Select all

/usr/local/nagios/libexec/check_by_ssh -H remoteip -l whatever_user_you_want -C uptime
Additionally, if you haven't already had a quickstart yet, you should set one up as we can do a remote session and help you get started:

https://www.nagios.com/services/quickstart/