Page 1 of 2

Same command, different results w/Debian & CentOS

Posted: Thu Oct 09, 2014 1:30 pm
by jbruyet
Hey all, I was just going through my Nagios Service Status pages and found an oddity regarding my disk monitoring -- I'm getting different results with the same command on my Debian and CentOS servers.

Here's my service description:

Code: Select all

define service {
        use                     generic-service
        host_name               CSDeb,CenTest
        service_description     Hard disk status P2
        check_command           check_nrpe!check_sda2
        }
Here's my standard command definition from the nrpe.cfg file on my servers:

Code: Select all

command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
Here's the result on CentOS:

Code: Select all

DISK OK - free space: / 64993 MB (92% inode=99%): 
And on Debian:

Code: Select all

DISK OK - free space: /dev 10 MB (100% inode=99%): 
Any ideas on my my Debian servers show /dev but my CentOS servers show / for their results? Is that why I'm getting the different numbers? I wasn't able to find anything on Google. Sigh, I guess I need to look back over a lot of other stuff to see what else I've missed.

Thanks,

Joe B

Re: Same command, different results w/Debian & CentOS

Posted: Thu Oct 09, 2014 1:46 pm
by tmcdonald
First I would make absolutely certain that they both use the same check_sda2 command, and that the one showing the root directory is not, in fact, set to show just /.

Re: Same command, different results w/Debian & CentOS

Posted: Thu Oct 09, 2014 5:31 pm
by jbruyet
Hi tmcdonald, I just triple-checked and both commands are identical. The top one is Debian and the bottom one is CentOS:

Code: Select all

command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
Thanks,

Joe B

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 10, 2014 11:49 am
by abrist
Does sda2 exist in the debian system?

Code: Select all

ls -la /dev/sda2
fdisk -l
Could you try wrapping the partition in quotes and run it locally on the debian system:

Code: Select all

/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p "/dev/sda2"

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 10, 2014 12:33 pm
by jbruyet
Hi abrist, and yes sda2 exists in the Debian system:

Code: Select all

root@CSDeb:/home/jobee# ls -la /dev/sda2
brw-rw---T 1 root disk 8, 2 Sep 12 12:49 /dev/sda2
root@CSDeb:/home/jobee#

root@CSDeb:/home/jobee# fdisk -l

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b90e1

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    40136703    20067328   83  Linux
/dev/sda2        40138750    41940991      901121    5  Extended
/dev/sda5        40138752    41940991      901120   82  Linux swap / Solaris
root@CSDeb:/home/jobee# 
Wrapping the partition in quotes and running it from the command line gives the same result:

Code: Select all

root@CSDeb:/home/jobee# /usr/local/nagios/libexec/check_disk -w 20% -c 10% -p "/dev/sda2"
DISK OK - free space: /dev 10 MB (100% inode=99%);| /dev=0MB;8;9;0;10
root@CSDeb:/home/jobee#
And here's a df -h just in case you were wondering about it:

Code: Select all

root@CSDeb:/home/jobee# df -h
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                   19G  2.2G   16G  13% /
udev                                                     10M     0   10M   0% /dev
tmpfs                                                   101M  336K  101M   1% /run
/dev/disk/by-uuid/5625de5f-ec86-4865-b448-ceb845c5eab6   19G  2.2G   16G  13% /
tmpfs                                                   5.0M     0  5.0M   0% /run/lock
tmpfs                                                   378M     0  378M   0% /run/shm
root@CSDeb:/home/jobee#
Thanks,

Joe B

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 10, 2014 5:05 pm
by abrist
Does the nagios user have rights to that device?

Code: Select all

su nagios -c "/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2"
If you add quotes to the nrpe command, does it now work through nrpe?

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 17, 2014 5:02 pm
by jbruyet
Thanks abrist, and sorry about the slow reply -- I'm working on implementing VMware at work. Adding the quotes didn't help:

Code: Select all

root@CSDeb:/home/jobee# su nagios -c "/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2"
DISK OK - free space: /dev 10 MB (100% inode=99%);| /dev=0MB;8;9;0;10
root@CSDeb:/home/jobee#
Any other ideas?

Thanks,

Joe B

Re: Same command, different results w/Debian & CentOS

Posted: Mon Oct 20, 2014 4:24 pm
by sreinhardt
I have an ubuntu docker container that I could test with shortly. Before I do, one thing I have not seen mentioned, is the current version of check_disk on both your systems. Could you ssh in and run the following on both systems?

Code: Select all

./check_disk -V

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 24, 2014 11:35 am
by jbruyet
Thanks sreinhardt, I found something different:

Debian

Code: Select all

root@CSDeb:/home/jobee# /usr/local/nagios/libexec/check_disk -V
check_disk v1.4.15 (nagios-plugins 1.4.15)
root@CSDeb:/home/jobee# 
CentOS

Code: Select all

[root@CenTest jobee]# /usr/local/nagios/libexec/check_disk -V
check_disk v1.5 (nagios-plugins 1.5)
[root@CenTest jobee]#
Should I just install the newest nagios-plugins on my Debian servers?

Thanks,

Joe B

Re: Same command, different results w/Debian & CentOS

Posted: Fri Oct 24, 2014 2:11 pm
by sreinhardt
I would highly suggest installing at least 1.5 if not 2.0.3 on your systems. Since the 2.0 release, we have been fixing years worth of bugs, and 1.5 also has about 3 years of work more than the current 1.4 branch you are using.