Page 1 of 1

check_nrpe & check_disk

Posted: Mon Nov 09, 2015 4:28 am
by Anton @ CPB
Hi

I'm checking partitions on a remote server.

On the remote server I have this partition

Code: Select all

/dev/sdc1 on /var/lib/mysql/CPBWarehouse type ext4 (rw)
my nrpe.cfg file on the remote server..

Code: Select all

command[check_hda2]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sdc1
When I run the script as normal on the remote server..

Code: Select all

root@sql:/usr/lib/nagios/plugins# ./check_disk -w 20% -c 10% -p /dev/sdc1
DISK OK - free space: /var/lib/mysql/CPBWarehouse 38037 MB (26% inode=99%);| /var/lib/mysql/CPBWarehouse=105470MB;120949;136068;0;151187
But on my Nagios Core box if I run the check_nrpe cmd I get this..

Code: Select all

root@nagios:/usr/local/nagios/libexec# ./check_nrpe -H 10.166.10.3 -c check_hda2
DISK CRITICAL - free space: /var/lib/mysql/CPBWarehouse 0 MB (0% inode=0%);| /var/lib/mysql/CPBWarehouse=134216074MB;107372859;120794466;0;134216074
The root partition is reporting the required info.

Is there anything that I'm missing?

Re: check_nrpe & check_disk

Posted: Mon Nov 09, 2015 5:11 pm
by jolson
On your remote server, are you running NRPE through xinetd or as a stand-alone daemon? If it's a stand-alone daemon the process will need to be restarted for the config file to be picked up appropriately.

On your remote server, try running the following:

Code: Select all

cd /usr/lib/nagios/plugins
./check_nrpe -H 127.0.0.1
./check_nrpe -H 127.0.0.1 -c check_hda2
Do you see the expected results?

Re: check_nrpe & check_disk

Posted: Tue Nov 10, 2015 12:02 am
by Anton @ CPB
jolson wrote:On your remote server, are you running NRPE through xinetd or as a stand-alone daemon? If it's a stand-alone daemon the process will need to be restarted for the config file to be picked up appropriately.

On your remote server, try running the following:

Code: Select all

cd /usr/lib/nagios/plugins
./check_nrpe -H 127.0.0.1
./check_nrpe -H 127.0.0.1 -c check_hda2
Do you see the expected results?
No, it is running as stand-alone.

Code: Select all

nagios   26214  0.0  0.0  24776  1132 ?        Ss   06:57   0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
Have restarted the service on the remote server.

Code: Select all

root@sql:/usr/lib/nagios/plugins# service nagios-nrpe-server restart
 * Stopping nagios-nrpe nagios-nrpe                                                                                                                               [ OK ] 
 * Starting nagios-nrpe nagios-nrpe                                                                                                                               [ OK ]

Re: check_nrpe & check_disk

Posted: Tue Nov 10, 2015 10:15 am
by rkennedy
This might be a permission issue, can you try running the following from the remote server?

Code: Select all

su nagios
./check_disk -w 20% -c 10% -p /dev/sdc1

Re: check_nrpe & check_disk

Posted: Tue Nov 10, 2015 11:34 pm
by Anton @ CPB
rkennedy wrote:This might be a permission issue, can you try running the following from the remote server?

Code: Select all

su nagios
./check_disk -w 20% -c 10% -p /dev/sdc1
All services running as root.

Re: check_nrpe & check_disk

Posted: Wed Nov 11, 2015 10:59 am
by hsmith
How did you install NRPE? It shouldn't be running as root. I see you're not running it inside of xinetd. Your file paths may vary, but on a compile from our script, you can see how stuff is running like this:

Code: Select all

grep nrpe_user /usr/local/nagios/etc/nrpe.cfg
grep nrpe_group /usr/local/nagios/etc/nrpe.cfg
ls -l /usr/local/nagios/bin
head -n 10 /etc/xinetd.d/nrpe | tail -n2

Re: check_nrpe & check_disk

Posted: Tue Dec 01, 2015 1:49 am
by Anton @ CPB
hsmith wrote:How did you install NRPE? It shouldn't be running as root. I see you're not running it inside of xinetd. Your file paths may vary, but on a compile from our script, you can see how stuff is running like this:

Code: Select all

grep nrpe_user /usr/local/nagios/etc/nrpe.cfg
grep nrpe_group /usr/local/nagios/etc/nrpe.cfg
ls -l /usr/local/nagios/bin
head -n 10 /etc/xinetd.d/nrpe | tail -n2
From apt-get

Re: check_nrpe & check_disk

Posted: Tue Dec 01, 2015 10:27 am
by hsmith
Can you do a find / -name nrpe.cfg -exec cat {} \; command and post the results?

Re: check_nrpe & check_disk

Posted: Wed Dec 02, 2015 3:47 am
by Anton @ CPB
Attached is the nrpe config file from the remote server.

Re: check_nrpe & check_disk

Posted: Wed Dec 02, 2015 10:50 am
by hsmith

Code: Select all

# NRPE USER
# This determines the effective user that the NRPE daemon should run as.  
# You can either supply a username or a UID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_user=nagios



# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.  
# You can either supply a group name or a GID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_group=nagios

This is from your nrpe.cfg file.

Can you su to the nagios user and attempt to /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sdc1