Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1


Remember Me

SNMP Check Disk

6 votes
README.txtGeneral Description and Usage
check_disk_snmp.plPlugin Source
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Yet another, but carefully crafted, plugin to check disk and memory usage on hosts via SNMP
This plugin is written in perl, and uses Net::SNMP to access the hrStorage OID on remote hosts to get filesystem and memory usage. I started out with other disk status plugins, and all the ones I tried appeared either too rigid (hard coded thresholds, etc.), or not tightly coded enough to work with Nagios embedded perl. This plugin is very configurable, and works with the Nagios embedded perl quite well.

This plugin also allows warning and critical thresholds as either a percentage or actual available space. This is important for larger filesystems that can be 96% full, with 20GB free. With an actual space threshold, you can define a warning at 1GB free, critical at 512MB, instead of calculating the nearest percentage.

Another nice feature for those having to monitor windows hosts, is the ability to leverage the built-in SNMP service with windows. This plugin allows you to specify a windows drive letter, and it will do the right thing automatically for you. No mucking about with what SNMP device index matches up with the drive letter, which makes monitoring configuration much easier.

Finally, there are several description abbreviations built-in that allow you to specify "virt" for "Virtual Memory", "real" for "Real Memory" and the like. No having to futz around with trying to escape quotes inside of nagios config files.
Reviews (5)
byffuchs, July 14, 2016
Works excellent! Thanks a lot!
bynishith, February 2, 2016
Worked Perfectly.. Single plugin for Linux "/" swap, "/home" and "/tmp" partition monitoring.
byfeisar, March 14, 2014
Needed an simple way to monitor Windows Server 2008 R2 servers from Nagios.

I Did have to make one change to the plugin for CentOS however. Top of the file should read:

use lib "/usr/lib64/nagios/plugins";

or the following error occurs:

Can't locate in @INC
byjoenazz, May 31, 2011
Added performance data output. Maybe you will alter the script?

--- check_disk_snmp.pl_2011-06-01_091729-536735145 2011-05-30 17:00:49.195836862 +0200
+++ 2011-06-01 10:33:59.627838690 +0200
@@ -40,7 +40,10 @@
my $devUsed = q{}; ## - used oid
my $perc = 0; ## - device percent used
my $free = 0; ## - device free space
+my $used = 0; ## - device used space
my $size = 0; ## - device size
+my $size_warn = 0; ## - device warning size
+my $size_crit = 0; ## - device critical size
my %unit_t = ( ## - units table
'KB' => 1 {$devSize}) * 100);
$size = sprintf("%0.2f", $resp->{$devSize} / $unit_sz);
+$size_warn = sprintf("%0.2f", ($resp->{$devSize} / 100) * substr($warn,0,-1) / $unit_sz);
+$size_crit = sprintf("%0.2f", ($resp->{$devSize} / 100) * substr($crit,0,-1) / $unit_sz);
+$used = sprintf("%0.2f", $resp->{$devUsed} / $unit_sz);
$free = sprintf("%0.2f",
($resp->{$devSize} - $resp->{$devUsed}) / $unit_sz
@@ -334,8 +340,9 @@
if ($free >= 100) {$free = commify(int($free))}
if ($size >= 100) {$size = commify(int($size))}

-print "SNMP $state - ",
- "$resp->{$devDesc} at ${perc}% with $free of $size $unit_desc free\n";
+print "DISK $state - ",
+ "$resp->{$devDesc} at ${perc}% with $free of $size $unit_desc free",
+ " | disk_usage=$used$unit_desc;$size_warn;$size_crit;0;$size\n";

exit $ERRORS{$state};
bychewtoy, April 12, 2011
This one works very well! Nicely written too.