Page 1 of 1

check_disk to check all drives

Posted: Thu May 19, 2016 1:54 am
by mrak692
Hi All,

I have check disk with the following command. The other day my /var/log reached 95% however Nagios did not alert me. I wonder if my command only check / and does not check attached drive such as /var/log

Code: Select all

command[check_disks]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -C -W 20% -K 10% -p /
My file server file system as per below.

Code: Select all

# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      9.9G  6.1G  3.3G  65% /
udev            1.9G   12K  1.9G   1% /dev
tmpfs           376M  344K  375M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.9G   12K  1.9G   1% /run/shm
/dev/xvdb       4.0G   73M  3.7G   2% /mnt
/dev/xvdf       9.9G  3.6G  5.9G  38% /var/log
What I need is a disk check to give me warning when the usage or inode reached 80% and critical when reached 90% for all my drives.

Re: check_disk to check all drives

Posted: Thu May 19, 2016 9:18 am
by mcapra
You could try this command definition (note the /* path at the end):

command[check_disks]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -C -W 20% -K 10% -p /*

Here's my test file system:

Code: Select all

[root@localhost boot]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        18G  4.1G   14G  23% /
devtmpfs        899M     0  899M   0% /dev
tmpfs           913M  440K  913M   1% /dev/shm
tmpfs           913M  9.0M  904M   1% /run
tmpfs           913M     0  913M   0% /sys/fs/cgroup
/dev/sda1       297M  295M  2.6M 100% /boot
tmpfs           183M  4.0K  183M   1% /run/user/42
tmpfs           183M  8.0K  183M   1% /run/user/1000
tmpfs           183M     0  183M   0% /run/user/0
Notice /dev/sda1 is at 100% capacity. Some sample outputs:

Code: Select all

[root@localhost libexec]# ./check_disk -w 20% -c 10% -p /
DISK OK - free space: / 13969 MB (77% inode=99%);| /=4151MB;14496;16308;0;18121

Code: Select all

[root@localhost libexec]# ./check_disk -w 20% -c 10% -p /*
DISK CRITICAL - free space: / 13969 MB (77% inode=99%); /boot 2 MB (0% inode=96%);| /=4151MB;14496;16308;0;18121 /boot=294MB;236;266;0;296