Page 1 of 3

how to setup file system usage

Posted: Tue Jun 19, 2018 12:04 pm
by donnyforbes
Can someone assist me in setting a check for /var on one of my existing linux servers. What I need is when this directory gets to 80% I need to be notified. Here is what we have now for this server.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 2:55 pm
by npolovenko
Hello, @donnyforbes .

Are you using the NRPE agent for your checks? If yes, please download the check_folder_size script from here:
https://exchange.nagios.org/directory/P ... e)/details

And put it on the remote nrpe server to the /usr/local/nagios/libexec/ folder. Give it the permissions:

Code: Select all

chown 777 check_folder_size.sh
The command in the nrpe.cfg file on the remote server should look like this:

Code: Select all

command[check_disk_new]=/usr/local/nagios/libexec/check_folder_size $ARG1$ 
The command from the Nagios XI server should look like this:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H hostname-xxx -c check_folder_size -a "-f /path-to-folder-xxxx -s g -w 60 -c 80"

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 3:07 pm
by donnyforbes
Yes I believe I am using the check nrpe to do checks. see below.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 3:22 pm
by npolovenko
@donnyforbes, Yes, you are. Let me know if you get the plugin to work.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 3:34 pm
by donnyforbes
I have copy the script and change permission on it as well as modified the following file

vi /usr/local/nagios/etc/nrpe.cfg & added the following
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
command[check_disk_new]=/usr/local/nagios/libexec/check_folder_size $ARG1$

I am a bit confused on what I do now on the
/usr/local/nagios/libexec/check_nrpe -H hostname-xxx -c check_folder_size -a "-f /path-to-folder-xxxx -s g -w 60 -c 80"

is the hostname the server-name where nagios is installed or the server I am monitoring? the path for me would be /var directory.
Does this command go on $ARG1$ line?? Be be a little more specific I am a bit confused.

Here is what I did so far.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 3:40 pm
by npolovenko
@donnyforbes, Just run this command in the nagios xi server console for now, to make sure it's working:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H hostname -c check_folder_size -a "-f /var -s g -w 60 -c 80"
*replace the hostname with the IP address of the remote server

Let me know of the output.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 3:48 pm
by donnyforbes
npolovenko wrote:@donnyforbes, Just run this command in the nagios xi server console for now, to make sure it's working:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H hostname -c check_folder_size -a "-f /var -s g -w 60 -c 80"
*replace the hostname with the IP address of the remote nagios server

Let me know of the output.

for host address do I use the server address that I am monitoring or the nagios server? Here is the output this is using the host address as the linux server that I am monitoring.

[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.12 -t 30 -c /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -c check_folder_size -a "-f /var -s g -w 60 -c 80"
CHECK_NRPE: Error - Could not complete SSL handshake.

This is using host address as the nagios server

[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -t 30 -c /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -c check_folder_size -a "-f /var -s g -w 60 -c 80"
CHECK_NRPE: Error - Could not complete SSL handshake.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 4:01 pm
by npolovenko
@donnyforbes, This command is correct.

Code: Select all

[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.12 -t 30 -c /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -c check_folder_size -a "-f /var -s g -w 60 -c 80" 
CHECK_NRPE: Error - Could not complete SSL handshake.
Are you running this command from the NagiosXI server's console?

Make sure that the remote server has Nagios XI servers ip address in its settings:
https://support.nagios.com/kb/article/n ... e-615.html

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 4:06 pm
by donnyforbes
npolovenko wrote:@donnyforbes, This command is correct.

Code: Select all

[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.12 -t 30 -c /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -c check_folder_size -a "-f /var -s g -w 60 -c 80" 
CHECK_NRPE: Error - Could not complete SSL handshake.
Are you running this command from the NagiosXI server's console?

Make sure that the remote server has Nagios XI servers ip address in its settings:
https://support.nagios.com/kb/article/n ... e-615.html
yes I am running this from the NagiosXI server console. Am I suppose to run it from there? Please explain so I can get this working.

Re: how to setup file system usage

Posted: Tue Jun 19, 2018 4:20 pm
by npolovenko
@donnyforbes, Just noticed that your command is repeating 2 times:

Code: Select all

[nagios@nag ~]$ /usr/local/nagios/libexec/check_nrpe -H 192.168.1.12 -t 30 -c /usr/local/nagios/libexec/check_nrpe -H 192.168.1.186 -c check_folder_size -a "-f /var -s g -w 60 -c 80" 
The command needs to look like this:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 192.168.1.12 -c check_folder_size -a "-f /var -s g -w 60 -c 80"
Where 192.168.1.12 is the IP address of the remote server that has the /var folder.
And yes, the command needs to be executed from the Nagios XI server's console.

If you get the SSL handshake error again, please refer to this tutorial to troubleshoot the problem:
https://support.nagios.com/kb/article/n ... e-615.html