Nagios check nrpe nowhere defined

Nagios nrpe check_disk showing nagios server hard disk space to all hosts added?

Hello everyone,

I configured Nagios server in AWS ec2 instance and added 10 hosts. One thing which is bugging me alot is check_disk pluggin. Am able to see the nagios server hard disk space for the all the hosts in my nagios server dashboard. I need support on this please, if anyone have any idea please assist me. Am mentioning my configuration file details below so that you can get some idea on my configuration.

root @ host-client: / usr / local / nagios / libexec # df -h /
Filesystem Size Used Avail Use% Mounted on
/ dev / root 7.7G 4.4G 3.4G 57% /

root @ nagios-server: / dev # df -h /
Filesystem Size Used Avail Use% Mounted on
/ dev / root 20G 5.8G 14G 30% /

In host nrpe.cfg:

port: 5666

command [check_disk] = / usr / local / nagios / libexec / check_disk -w 20% -c 10% -p / dev / xvda1

command [check_root] = / usr / local / nagios / libexec / check_disk -w $ ARG1 $ -c $ ARG2 $ -p $ ARG3 $

command [check_root] = / usr / local / nagios / libexec / check_disk -w 20 -c 10 -p / dev / xvda

command [check_root] = / usr / local / nagios / libexec / check_disk -w 20 -c 10 -p /

Tried each one of above individually .. but no luck.

In Nagios server dashboard for disk partition below info is showing,

Root partition OK 04-16-2021 12:24:45 0d 2h 2m 5s 1/4 DISK OK - free space: / 13847 MiB (70.03% inode = 94%):

Configuration of host in Nagios server path: /usr/local/nagios/etc/servers/linux-server.cfg

define service {

use local-service; Name of service template>
host_name ec2-x.x.x.x.ap-south-1.compute.amazonaws.com
service_description root partition
check_command check_root! 20%! 10%! /
}

define service {

use local-service; Name of service template>
host_name ec2-x.x.x.x.ap-south-1.compute.amazonaws.com
service_description root partition
check_command check_nrpe! check_root! 20%! 10%! /
}
Tried above configuration individually ...

NRPE version:

root @ host-client: / usr / local / nagios / libexec # ./check_nrpe -V
NRPE plugin for Nagios
Version: 4.0.3

check_nrpe command conf in commands.cfg file:

define command {
command_name check_nrpe
command_line / usr / local / nagios / libexec / check_nrpe -H $ HOSTADDRESS $ -t 30 -c $ ARG1 $
}

command [check_disk] = / usr / local / nagios / libexec / check_disk -w 20% -c 10% -p / dev / xvda1

define command {

command_name check_disk
command_line $ USER1 $ / check_disk -w $ ARG1 $ -c $ ARG2 $ -p $ ARG3 $
}

command [check_root] = / usr / local / nagios / libexec / check_disk -w 20 -c 10 -p / dev / xvda

define command {
command_name check_root
command_line $ USER1 $ / check_disk -w $ ARG1 $ -c $ ARG2 $ -p $ ARG3 $
}

When am mentioning command in this way:

command [check_root] = / usr / local / nagios / libexec / check_disk -w 20 -c 10 -p / dev / xvda

At getting the free space of / dev path of Nagios server.

For all other remaining hosts I've done the same configuration. but still am able to see the nagios server hard disk space only instead of host hard disk space in the nagios server dashboard.

Able to ping all hosts from server to host and vice versa.

Please let me know where I've done wrong in the configuration.


Which of the following retains the information it's storing when the system power is turned off?
88% of IT pros got this right.

6 replies

L5257
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Apr 16, 2021 at 12:32 UTC

I use Nagios, but your config doesn't look like mine. I also don't really use NRPE much (I utilize SNMP checks for disk space and most other monitoring).

However, I do seem to recall that your commands are wholly set up in the nrpe.cfg server config file and not in the Nagios configuration.

So the idea is that you just configure Nagios to check a particular variable that you have set up on the NRPE side with no arguments. The NRPE configuration will be where you set up the nitty gritty of what is actually checked.

I think that if I am reading your config correctly, you would need to configure your Nagios check to be

check_nrpe! check_root

Hope that helps.

Edited Apr 16, 2021 at 12:42 UTC

Hi, thanks for the reply. I've tried the same which you've said to try with no arguments in the nrpe configuration file. But still am able to see the nagios server hard disk free space only instead of my host free space .. I have a requirement to monitor 30 servers hard disk space frequently like alternate day coz huge log files are piling up in servers so instead of logging into all servers frequently checking some alternative .. When am giving this way in the nrpe.cfg file / dev / xvda1 it's showing / dev file size of nagios server..If you know any other solution for this it would save me .. thanq ..

L5257
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Apr 16, 2021 at 13:37 UTC

Here is what I am thinking your config should look like.

On the Nagios server:

define service {use local-service; Name of service template> host_name ec2-xxxxap-south-1.compute.amazonaws.com service_description Root Partition check_command check_nrpe! Check_root} define command {command_name check_nrpe command_line / usr / local / nagios / libexec / check_nrpe -H $ HOSTADDRESS $ - t 30 -c $ ARG1 $}

On the remote host:

command [check_root] = / usr / local / nagios / libexec / check_disk -w 20% -c 10% -p / dev / xvda1

On the Nagios host, check to ensure it is working by running check_nrpe manually:

check_nrpe -H ec2-x.x.x.x.ap-south-1.compute.amazonaws.com -c check_root
Scott Smythe 9
This person is a verified professional.
Verify your account to enable IT peers to see that you are a professional.
Apr 16, 2021 at 15:41 UTC

OK whilst your looking at nagios / nrpe to check the status of the drives on the remote hosts, on the remote hosts have you looked at reconfiguring the logs in terms of rotation / size as some logs done daily, some weekly and done monthly

I have just cleared over 25gb of logs on my system when my / on my check_mk box reported low space on / (* no affiliation * nagios underpins this but lots easier to setup / configure) from just kern.log and syslog alone. May be something with looking at once you have worked out the issue with check_nrpe. Assuming that is y each remote server has the check_nrpe plugin installed and configured to allow access from you nagios box.

If memory serves correctly, may also need to allow Snmp traps for some plungs to work via check_nrpe calls.

Hi Scott, I tried reconfiguring the logs but getting some errors in the configuration so reverted to default settings. I've no idea about check_mk didn't try it earlier, but i cleared some logs in the servers manually so got some free space around 50Gb which are daily backups. I think what you said is correct something is wrong with the check_nrpe plugin but I've followed the official documentation only don't know why it's not able to serve it's purpose .. Looking for best solution still ..

Hi Serrano, I tried this configuration but still it's not working ...