Skip to content

Commit

Permalink
Fix PNP4Nagios template
Browse files Browse the repository at this point in the history
Tested with pnp-0.6.25
  • Loading branch information
Mathieu committed Sep 15, 2015
1 parent 01c4efa commit 50e2460
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions contrib/check_nwc_health.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<?php

#
# This is a template for the visualisation addon PNP (http://www.pnp4nagios.org)
#
# Plugin: check_nwc_health - https://labs.consol.de/nagios/check_nwc_health/
# Release 1.0 2013-07-18
# Release 1.1 2015-09-15
#

$def[1] = "";
Expand All @@ -17,8 +16,9 @@
foreach ($DS as $i=>$VAL) {

# eth0_usage_in / out
# GigabitEthernet 0/0_usage_in / out
if(preg_match('/^(.*?)_usage_in/', $NAME[$i])) {
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
$interface = preg_replace('/_.*$/', '', $LABEL[$i]);
$ds_name[$num] = $interface.' usage';
$opt[$num] = "--vertical-label \"Usage\" -l 0 -u 100 --title \"Interface Usage for $hostname - ".$interface."\" ";
$def[$num] = "DEF:percin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
Expand All @@ -31,14 +31,15 @@
$def[$num] .= "GPRINT:percout:LAST:\"%10.1lf %% last\" ";
$def[$num] .= "GPRINT:percout:AVERAGE:\"%7.1lf %% avg\" ";
$def[$num] .= "GPRINT:percout:MAX:\"%7.1lf %% max\"\\n ";
$def[$num] .= "HRULE:$WARN[$num]$_WARNRULE ";
$def[$num] .= "HRULE:$CRIT[$num]$_CRITRULE ";
$def[$num] .= rrd::hrule($WARN[$i], $_WARNRULE);
$def[$num] .= rrd::hrule($CRIT[$i], $_CRITRULE);
$num++;
}

# eth0_traffic_in / out
# GigabitEthernet 0/0_traffic_in / out
if(preg_match('/^(.*?)_traffic_in/', $NAME[$i])) {
$interface = preg_replace('/_.*$/', '', $NAME[$i]);
$interface = preg_replace('/_.*$/', '', $LABEL[$i]);
$ds_name[$num] = $interface.' traffic';
$opt[$num] = "--vertical-label \"Traffic\" -b 1024 --title \"Interface Traffic for $hostname - $interface\" ";
$def[$num] = "DEF:bitsin=$RRDFILE[$i]:$DS[$i]:AVERAGE ";
Expand All @@ -52,7 +53,8 @@
$def[$num] .= "GPRINT:bitsout:LAST:\"%10.1lf %Sb/s last\" ";
$def[$num] .= "GPRINT:bitsout:AVERAGE:\"%7.1lf %Sb/s avg\" ";
$def[$num] .= "GPRINT:bitsout:MAX:\"%7.1lf %Sb/s max\\n\" ";
$num++;
}
}

}
?>

0 comments on commit 50e2460

Please sign in to comment.