Same command, different results w/Debian & CentOS

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.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

Same command, different results w/Debian & CentOS

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post 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 /.
Former Nagios employee
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

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

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

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

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

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

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

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

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jbruyet
Posts: 235
Joined: Wed Dec 28, 2011 12:14 pm

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

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

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

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked