Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
joenazz
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
+++ check_disk_snmp.pl 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};
--- check_disk_snmp.pl_2011-06-01_091729-536735145 2011-05-30 17:00:49.195836862 +0200
+++ check_disk_snmp.pl 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};