Linux

check_disk – % used space

Description:

Check the used space of a mounted partition using df, and prints it in percent scale.

Current Version

Last Release Date

June 16, 2009

Compatible With


Project Files
Project Notes
Everybody is certanly asking 'why to write another check_disk plugin since the official "Nagios Plugins" comes with one?' 1) the official plugin prints the used space in the perfdata section in absolute values (MB), which isn't good for graphing, and 2) it's binary, and I need maximum portability (without recompiling it on every machine); So this little Bourne Shell check_disk script was written. It simple runs the 'df' program, greps the line of the specified device/mountpoint and prints the Used% column, do some basic checking to see if the result is suitable, sets the corresponding level (OK, WARNING or CRITICAL) and prints the results in nagios format.
Reviews (2) Add a Review
Worked...
by nishith, September 30, 2017

Here is my NRPE Output: ####NRPE Command#### # /usr/local/nagios/libexec/check_disk -w 80 -c 90 -d /dev/cciss/c0d0p1 OK - /dev/cciss/c0d0p1 space used=79% | '/dev/cciss/c0d0p1 usage'=79%;80;90; ###NRPE Config in /usr/local/nagios/etc/nrpe.cfg file### command[check_root]=/usr/local/nagios/libexec/check_disk -w 80 -c 90 -d /dev/cciss/c0d0p1 ###NAGIOS SERVER CONFIG### define service{ use generic-service host_name test.example.local service_description ROOT Partition check_command check_nrpe!check_root check_interval 15 retry_interval 1 }



Nice plugin
by tmoensted, March 31, 2013

I like the fact that you report how much is used instead of how much is free. A couple of suggestions; Instead of getting details for all devices (df -P | grep -w $device) try just checking the needed device (df -P $device |tail -1) I like to also see the numbers the percentage is based on in nagios - you could consider checking like this; read size used free usedPercent rinting the results: echo "$msg - $device space used=$usedPercent% ($used of $size used) | '$device usage'=$usedPercent%;$warning;$critical;" Just my thoughs :) Best regards Theis M. Mønsted



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.8 (5)
Favorites
1
Views
191,425