From a779a22337a56f756382a41553b63182c899e5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1ll=20Gu=C3=B0j=C3=B3n=20Sigur=C3=B0sson?= Date: Mon, 18 Oct 2010 10:36:56 +0000 Subject: [PATCH] check_cisco_qos modified perfdata output --- check_cisco_qos/trunk/check_cisco_qos.pl | 4 ++++ check_cisco_qos/trunk/check_cisco_qos.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/check_cisco_qos/trunk/check_cisco_qos.pl b/check_cisco_qos/trunk/check_cisco_qos.pl index 91abbef..fe58d4e 100755 --- a/check_cisco_qos/trunk/check_cisco_qos.pl +++ b/check_cisco_qos/trunk/check_cisco_qos.pl @@ -467,6 +467,7 @@ if ( $opt_i eq "ALL" ) { $perf = sprintf "Sent=%sBits/s;Dropped=%sBits/s",$postRate,$dropRate; $state = 0; } + $perf = sprintf "Sent=%s Dropped=%s;%s;%s",$postRate,$dropRate,$warn,$crit; } else { #--------------------------------------------------------------------------- # Check for all interfaces and one class @@ -504,6 +505,7 @@ if ( $opt_i eq "ALL" ) { exit 3; } $perf = sprintf "Sent=%sBits/s;Dropped=%sBits/s",$postRate,$dropRate; + $perf = sprintf "Sent=%s Dropped=%s;%s;%s",$postRate,$dropRate,$warn,$crit; if ( $dropRate >= $crit ) { $short = "QOS: Total drop rate for class $opt_m ($dropRate bits/s) is above critical threshold ($crit bits/s): CRITICAL"; $state = 2; @@ -548,6 +550,7 @@ if ( $opt_i eq "ALL" ) { $dropRate = 0; } $perf = sprintf "Sent=%sBits/s;Dropped=%sBits/s",$postRate,$dropRate; + $perf = sprintf "Sent=%s Dropped=%s;%s;%s",$postRate,$dropRate,$warn,$crit; if ( $dropRate >= $crit ) { $short = "QOS: Total drop rate on $int ($dropRate bits/s) is above critical threshold ($crit bits/s): CRITICAL"; $state = 2; @@ -586,6 +589,7 @@ if ( $opt_i eq "ALL" ) { $dropRate = 0; } $perf = sprintf "Sent=%sBits/s;Dropped=%sBits/s",$postRate,$dropRate; + $perf = sprintf "Sent=%s Dropped=%s;%s;%s",$postRate,$dropRate,$warn,$crit; if ( $dropRate >= $crit ) { $short = "QOS: Drop rate for $opt_m on $opt_i ($dropRate bits/s) is above critical threshold ($crit bits/s): CRITICAL"; $state = 2; diff --git a/check_cisco_qos/trunk/check_cisco_qos.sh b/check_cisco_qos/trunk/check_cisco_qos.sh index 786dda8..a25d235 100755 --- a/check_cisco_qos/trunk/check_cisco_qos.sh +++ b/check_cisco_qos/trunk/check_cisco_qos.sh @@ -15,5 +15,9 @@ for i in $CLASSES ; do PERFDATA="$PERFDATA $PERF" done -echo "$SUMMARY | $PERFDATA" +test $EXIT_CODE == 0 && SUMMARY="OK - $SUMMARY" +test $EXIT_CODE == 1 && SUMMARY="WARNING - $SUMMARY" +test $EXIT_CODE == 2 && SUMMARY="CRITICAL - $SUMMARY" +echo "$SUMMARY | $PERFDATA" +exit $EXIT_CODE