check_disk not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
froometgn
Posts: 10
Joined: Fri Aug 25, 2017 1:41 am

check_disk not working

Post by froometgn »

Hello,

I have a nagios server configured in a centOS machine with version 4.0.8 and I'm trying to a put a new ubuntu server VM to monitor, actually the following services are working fine

Image

But check_disk service is not working, the error message is (No output returned from plugin)

Image

on server 1(nagios client)

I installed nagios and nagios-plugins, if I try to check NRPE I got the following

# check_nrpe -h 127.0.0.1
check_nrpe: command not found

It's not working NRPE? how can I check NRPE is well installed? other services are also working fine

define service {

host_name server1
service_description Current Load
check_command check_nrpe!check_load!5!10
use generic-service,graphed-service
notification_interval 0

}

this service returns a reply from nagios server so nrpe should be ok?
on server 2(nagios server)

I set up the *.cfg file with the following options

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk -w 10% -c 5%
use generic-service
notification_interval 0

}

Please can anyone help me to check sda5 free space

Image

Thank you very much!!!
Best regards
bolson

Re: check_disk not working

Post by bolson »

Your screenshots aren't in your post. Also, did you use the full path when you ran check_nrpe from the command line on the host to be monitored? Run this and post the output:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
froometgn
Posts: 10
Joined: Fri Aug 25, 2017 1:41 am

Re: check_disk not working

Post by froometgn »

Hello,

thank yoy very much for your quick reply, when I did this i get no such file or directory

root@server1:~# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
-bash: /usr/local/nagios/libexec/check_nrpe: No such file or directory

I installed with apt-get install nagios and nagios-plugins packages, on the host cfg file I have the following to check the disk space

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk!10%!5%!
use generic-service
notification_interval 0

}

I also have the following services defined

define service {

host_name server1
service_description Current Users
check_command check_nrpe!check_users
use generic-service
notification_interval 0

}


define service {

host_name server1
service_description SSH
check_command check_ssh
use generic-service
notification_interval 0

}

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk!10%!5%!
use generic-service
notification_interval 0

}

I would like to check free space on SDA5 as you can see on the image below

Image

below you can also see the service working with nrpe, so I suposo nrpe is working

Image Copiar


Thank you very much for your help

Best regards
bolson

Re: check_disk not working

Post by bolson »

Hello, please execute the following from the CLI on the NRPE Debian host to be monitored and post the result:

Code: Select all

find / -name nrpe
find / -name nrpe.cfg
froometgn
Posts: 10
Joined: Fri Aug 25, 2017 1:41 am

Re: check_disk not working

Post by froometgn »

bolson wrote:Hello, please execute the following from the CLI on the NRPE Debian host to be monitored and post the result:

Code: Select all

find / -name nrpe
find / -name nrpe.cfg
Hello,

here the result of the following command

root@server1:~# find / -name nrpe
/usr/sbin/nrpe

root@server1:~# find / -name nrpe.cfg
/etc/nagios/nrpe.cfg

I also put the command lines from the \etc\nagios\nrpe.cfg

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10%

and here the server1.cfg with the services to be check

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk!10%!5%!
use generic-service
notification_interval 0

}

Thanks again for your help!!
Have a nice weekend

Best regards
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_disk not working

Post by tgriep »

Is could be a permission problem on the remote server as the nrpe agent is running as either the nrpe user or the nagios user.
If you post the full nrpe.cfg file, we would know for sure.

To change to the nrpe user you would run this

Code: Select all

su nrpe
If the agent is using the nagios account, you wouls run this.

Code: Select all

su nagios
To test the plugin as the user, run this
/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
The -p / will check the root partition.

If this works, change the check_disk command in the nrpe.cfg file from

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10%
to

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda5
Restart the nrpe agent and then when you run the check from the Nagios server, it will test the partition you want.
Be sure to check out our Knowledgebase for helpful articles and solutions!
froometgn
Posts: 10
Joined: Fri Aug 25, 2017 1:41 am

Re: check_disk not working

Post by froometgn »

tgriep wrote:Is could be a permission problem on the remote server as the nrpe agent is running as either the nrpe user or the nagios user.
If you post the full nrpe.cfg file, we would know for sure.

To change to the nrpe user you would run this

Code: Select all

su nrpe
If the agent is using the nagios account, you wouls run this.

Code: Select all

su nagios
To test the plugin as the user, run this
/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
The -p / will check the root partition.

If this works, change the check_disk command in the nrpe.cfg file from

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10%
to

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda5
Restart the nrpe agent and then when you run the check from the Nagios server, it will test the partition you want.
Hello,

here you can find the nrpe.cfg on the remote server

https://www.dropbox.com/s/0jnp3e89vjm6o87/nrpe.cfg?dl=0

I also tried


root@server1:~# /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /
DISK OK - free space: / 24186 MB (89% inode=88%);| /=2954MB;22892;25754;0;28616

so from the remote server I suposed that everything is ok, but on nagios I got the following information on the webui:

Image

This is what I have on nagios server:

server1.cfg

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk!10%5%
use generic-service
notification_interval 0

What should I put there?

check_command check_nrpe!check_disk!10%5% -p /dev/sda5

Thanks for your help again!!!

Best regards
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_disk not working

Post by tgriep »

Your nrpe.cfg file is setup to not use arguments so adding then to the Service Checks on the Nagios server will not matter.
We have found that most binary downloads of the nrpe agent does not have arguments enabled, even if you edit the nrpe.cfg file, the binary file is not compiled with it.
So either hard code the command in the nrpe.cfg file like my previous post or down load the nrpe agent source, compile and configure it to allow arguments.
See this KB article for that.
https://support.nagios.com/kb/article/n ... ource.html
Be sure to check out our Knowledgebase for helpful articles and solutions!
froometgn
Posts: 10
Joined: Fri Aug 25, 2017 1:41 am

Re: check_disk not working

Post by froometgn »

tgriep wrote:Your nrpe.cfg file is setup to not use arguments so adding then to the Service Checks on the Nagios server will not matter.
We have found that most binary downloads of the nrpe agent does not have arguments enabled, even if you edit the nrpe.cfg file, the binary file is not compiled with it.
So either hard code the command in the nrpe.cfg file like my previous post or down load the nrpe agent source, compile and configure it to allow arguments.
See this KB article for that.
https://support.nagios.com/kb/article/n ... ource.html
Hello,

I done everything on the kb that you requested, now I put the following command

root@server1:~# /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p / DISK OK - free space: / 23938 MB (88.20% inode=88%);| /=3202MB;22892;25754;0;28616

Now which is the valid nrpe.cfg file? this?

/usr/local/nagios/etc/nrpe.cfg

On this I have the following commands:

command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -r -w .15,.10,.05 -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]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda5

I added the last one, now what should I put on the server1.cfg? what I have is the following

define service {

host_name server1
service_description Check disk
check_command check_nrpe!check_disk!10%5% -p /dev/sda5
use generic-service
notification_interval 0

}

Thanks again

Best regards!!!
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: check_disk not working

Post by tgriep »

The valid nrpe config file is this file /usr/local/nagios/etc/nrpe.cfg .

If you want to use arguments in your commands, you have to edit the commands so they will use the arguments that the Nagios server will pass to the NRPE Agent.

To do that, edit /usr/local/nagios/etc/nrpe.cfg file on the remote server and change the command from

Code: Select all

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda5
to

Code: Select all

command[check_disk]=/usr/local/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
Save the file and restart the nrpe agent.

Without knowing exactly how you defined the check_nrpe command on the Nagios Server, you would have to change your command from

Code: Select all

check_command check_nrpe!check_disk!10%5% -p /dev/sda5
to

Code: Select all

check_command check_nrpe!check_disk!10% 5% /dev/sda5
Save the file and restart nagios and see if the check returns the correct information for the /dev/sda5 partition.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked