Page 1 of 1

check_disk to do all volume space check on the servers

Posted: Mon May 23, 2016 6:52 pm
by jchow10
Hi,
I am still a newbie when it comes to Nagios. I setup Nagios for Lab environment. My goal is to to monitor all linux volume automatically. This mean I have to setup additional command for each volume on both servicess.cfg and nrpe.cfg which it requires a lot of work and not efficient to do it manually. First, I was wondering why check_disk does not allow multiple volume in one single check_disk, EX. check_disk... -p /usr, /, /db.. Second, is there a better way to tackle the issue.

nagios services.cfg
check_command check_nrpe!check_root_disk

nrpe.cfg
command[check_root_disk]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10 -p /

Thank you in advance,

JC

Re: check_disk to do all volume space check on the servers

Posted: Tue May 24, 2016 9:51 am
by rkennedy
You can pass arguments so that you don't need to modify the '-p /' part everytime, instead it could parse as '-p $ARG1$'.

Additionally, it's just the way the plugin works. It still does allow you to check multiple paths at once. See the below examples -

Code: Select all

[root@localhost libexec]# ./check_disk -w 20 -c 10
DISK OK - free space: / 15095 MB (84% inode=99%); /dev 1886 MB (100% inode=99%); /dev/shm 1895 MB (100% inode=99%); /run 1682 MB (88% inode=98%); /sys/fs/cgroup 1895 MB (100% inode=99%); /boot 331 MB (66% inode=99%); /run/user/1000 379 MB (100% inode=99%); /run/user/0 379 MB (100% inode=99%);| /=2782MB;17858;17868;0;17878 /dev=0MB;1866;1876;0;1886 /dev/shm=0MB;1875;1885;0;1895 /run=213MB;1875;1885;0;1895 /sys/fs/cgroup=0MB;1875;1885;0;1895 /boot=164MB;476;486;0;496 /run/user/1000=0MB;359;369;0;379 /run/user/0=0MB;359;369;0;379

[root@localhost libexec]# ./check_disk -w 20 -c 10 -p /
DISK OK - free space: / 15095 MB (84% inode=99%);| /=2782MB;17858;17868;0;1787


[root@localhost libexec]# ./check_disk -w 20 -c 10 -p / /dev
DISK OK - free space: / 15095 MB (84% inode=99%); /dev 1886 MB (100% inode=99%);| /=2782MB;17858;17868;0;17878 /dev=0MB;1866;1876;0;1886

[root@localhost libexec]# ./check_disk -w 20 -c 10 -p / /boot
DISK OK - free space: / 15095 MB (84% inode=99%); /boot 331 MB (66% inode=99%);| /=2782MB;17858;17868;0;17878 /boot=164MB;476;486;0;496
[root@localhost libexec]#

Re: check_disk to do all volume space check on the servers

Posted: Wed May 25, 2016 5:06 pm
by jchow10
It worked with check_disk -w 20 -c 10 on local server!! I put it as "Checking all drive" into my service.cfg in Nagios server. However, I receive the error on Nagios server and no other space size passed over to Nagios server. I am including the file permission below. If this file permission problem then why it did not complaint when I run check_disk locally on server? Is there a way to modify it to check file size with root permission?

Nagio Core Server Error output:

Checking all disk
CRITICAL 05-25-2016 14:28:00 0d 23h 13m 11s 4/4 DISK CRITICAL - /hana/log/LF1/mnt00001 is not accessible: Permission denied

===================================================================
I am logging on as root

hana00:/hana/log/LF1 # ll
total 4
drwxr-x--- 5 lf1adm sapsys 4096 Apr 6 19:44 mnt00001

hana00:/hana/log/LF1/mnt00001 # ll
total 12
drwxrwxr-x 2 lf1adm sapsys 4096 Apr 6 19:43 hdb00001
drwxr-xr-x 2 lf1adm sapsys 4096 Apr 6 19:44 hdb00002
drwxr-xr-x 2 lf1adm sapsys 4096 Apr 6 19:45 hdb00003

=======================================================================================================
Target server:

hana00:/etc/nagios # df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 50G 6.4G 44G 13% /
udev 505G 228K 505G 1% /dev
tmpfs 505G 0 505G 0% /dev/shm
172.16.109.5:/LeapFrog_lf_87h1_HANATierHN1 50G 6.4G 44G 13% /
storage1-4-37-1.benjamin.sap.com:/hana_shared 48G 8.9G 39G 19% /hana/shared
storage1-4-37-1.benjamin.sap.com:/HANATier_SAP_HANA_DB_usr_sap_1 48G 112M 48G 1% /usr/sap
storage1-4-40-1.benjamin.sap.com:/HANATier_SAP_HANA_DB_hana_log_1 973G 2.2G 971G 1% /hana/log/LF1/mnt00001
storage1-4-39-1.benjamin.sap.com:/HANATier_SAP_HANA_DB_hana_data_1 2.9T 4.1G 2.9T 1% /hana/data/LF1/mnt00001
172.16.120.4:/mnt1/mnt1 243G 221G 9.4G 96% /mnt1


hana00:/etc/nagios # /usr/lib/nagios/plugins/check_disk -w 20% -c 10%
DISK CRITICAL - free space: / 44729 MB (87% inode=88%); /dev 516845 MB (99% inode=-); /dev/shm 516845 MB (100% inode=99%); /hana/shared 39576 MB (81% inode=97%); /usr/sap 48528 MB (99% inode=99%); /hana/log/LF1/mnt00001 993917 MB (99% inode=99%); /hana/data/LF1/mnt00001 2984322 MB (99% inode=99%); /mnt1 9622 MB (4% inode=99%);| /=6470MB;40960;46080;0;51200 /dev=0MB;413476;465160;0;516845 /dev/shm=0MB;413476;465160;0;516845 /hana/shared=9063MB;38912;43776;0;48640 /usr/sap=111MB;38912;43776;0;48640 /hana/log/LF1/mnt00001=2230MB;796917;896532;0;996147 /hana/data/LF1/mnt00001=4118MB;2390752;2689596;0;2988441 /mnt1=226102MB;198668;223502;0;248336


Thank you in advance,

JC

Re: check_disk to do all volume space check on the servers

Posted: Thu May 26, 2016 3:45 pm
by hsmith
Are you running it on the local server as the 'nagios' user? If not, try that.

Re: check_disk to do all volume space check on the servers

Posted: Thu May 26, 2016 3:46 pm
by ssax
Did you su to nagios first on the remote machine?

Code: Select all

su - nagios
/usr/lib/nagios/plugins/check_disk -w 20% -c 10%

Re: check_disk to do all volume space check on the servers

Posted: Thu Jun 02, 2016 4:59 pm
by jchow10
Hi All,
I did the following and the problem was resolved afterward. It was permission and sudo issue.

command[xxx]=/usr/bin/sudo /usr/lib/nagios/plugins/check_disk -w 20 -c 10


Thanks,

Johnny Chow

Re: check_disk to do all volume space check on the servers

Posted: Thu Jun 02, 2016 5:01 pm
by mcapra
Glad to hear you were able to resolve this! Is it ok if we lock this thread and mark the issue as resolved?

Re: check_disk to do all volume space check on the servers

Posted: Thu Jun 02, 2016 5:45 pm
by jchow10
Please lock the thread. Thx.

JC