Tuesday, July 8, 2014

Nagios: A linux disk space check that matches the default Window disk space check.

Pretty:

Not so pretty:


The first one is a Windows Server VM with the default disk check from NSClient++, the second is a CentOS VM with the default check_disk from the yum nagios-plugins package.  Which one tells me more info?

Looking for a linux check disk plugin that can give me more info I came across this plugin by radumar1001 on the Nagios Exchange.  Lets change up our nrpe check on the CentOS vm to use it and see what it looks like.

First download the plugin and drop it on your linux client in your plugins folder, in my case it is /usr/lib64/nagios/plugins but yours might be different.  Next you need to change the plugin permissions so your root or nagios user can run it:


Next browse to the location of nrpe.cfg (/etc/nagios in my case) and open it up in your favorite editor.  In my case I am already using the default check_disk plugin like so:

 command[check_disk]=/usr/lib64/nagios/plugins/check_disk --units GB -M -w 20% -c 10% -p /dev/mapper/vg_centos-lv_root  

What we will do is modify this so we check check_disk_space instead.  It has three requirements, a warning threshold and a critical threshold, both of which are defined by USED space and a third to define which partition to check.  Comment out the old check, or modify it so it looks something like this:

 command[check_disk]=/usr/lib64/nagios/plugins/check_disk_space -w 80 -c 90 -p /  

Save it and since we changed nrpe.cfg we need to restart nrpe on the client by using service nrpe restart.  Since we did not need to change any configs on the nagios server, there is no need to restart Nagios on it.  Once Nagios runs that check again we will have a nicely formatted disk check:


Very pretty!

Resources