Title: [opsview] [10908] Interface speeds of zero are now displayed in the plugin output for
Revision
10908
Author
tvoon
Date
2012-11-23 16:21:19 +0000 (Fri, 23 Nov 2012)

Log Message

Interface speeds of zero are now displayed in the plugin output for
those particular interfaces when a percentage threshold is used

Modified Paths

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2012-11-23 12:11:10 UTC (rev 10907)
+++ trunk/CHANGES	2012-11-23 16:21:19 UTC (rev 10908)
@@ -10,9 +10,11 @@
     Amend keyword references from 'keyword_N' to 'kN_<KEYWORD>' within the configuration files
     Added 'negate' and 'urlize' to list of available servicecheck plugins
     NOTICES:
+    REST error messages have colons removed
     Updated primary keys for nagios_hostchecks and snmptrapexceptions to BIGINT
       - those tables will be truncated on upgrade
     FIXES:
+    Fixed check_snmp_interfaces_cascade so that interfaces with zero speed have an appropriate error message
     Fixed HH displaying breadcrumbs for host groups that user did not have permission for
     Fixed apache configuration for redundancy, specifically removing apache_proxy_ssl.conf and replacing with apache_ssl.conf
     Fixed messages for set state

Modified: trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2012-11-23 12:11:10 UTC (rev 10907)
+++ trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2012-11-23 16:21:19 UTC (rev 10908)
@@ -66,12 +66,6 @@
   ".1.3.6.1.2.1.1.1.0"; # Used to check whether SNMP is actually responding
 
 my $timeout = 10;       # SNMP timeout
-my $throughput_in;
-my $throughput_in_pct;
-my $throughput_out;
-my $throughput_out_pct;
-my $throughput_in_friendly;
-my $throughput_out_friendly;
 
 my $first_run = 0;
 
@@ -740,13 +734,21 @@
 
     my $max_state     = 0;
     my $extra_message = "";
+    my $speed_is_zero = 0;
     if ( my $critical = $intdata->{throughput_critical} ) {
         if ( $critical =~ s/%$//xsm ) {
-            $max_state = $np->check_threshold(
-                check    => [ $throughput_in_pct, $throughput_out_pct ],
-                warning  => undef,
-                critical => $critical
-            );
+
+            # Check throughput_in_pct and out_pct
+            if ( defined $throughput_in_pct && defined $throughput_out_pct ) {
+                $max_state = $np->check_threshold(
+                    check    => [ $throughput_in_pct, $throughput_out_pct ],
+                    warning  => undef,
+                    critical => $critical
+                );
+            }
+            else {
+                $speed_is_zero = 1;
+            }
         }
         else {
             $max_state = $np->check_threshold(
@@ -757,18 +759,20 @@
         }
     }
     if ( my $warning = $intdata->{throughput_warning} ) {
-        if (   $warning =~ s/%$//xsm
-            && defined $throughput_in_pct
-            && defined $throughput_out_pct )
-        {
-            $max_state = $np->max_state(
-                $max_state,
-                $np->check_threshold(
-                    check    => [ $throughput_in_pct, $throughput_out_pct ],
-                    warning  => $warning,
-                    critical => undef,
-                )
-            );
+        if ( $warning =~ s/%$//xsm ) {
+            if ( defined $throughput_in_pct && defined $throughput_out_pct ) {
+                $max_state = $np->max_state(
+                    $max_state,
+                    $np->check_threshold(
+                        check    => [ $throughput_in_pct, $throughput_out_pct ],
+                        warning  => $warning,
+                        critical => undef,
+                    )
+                );
+            }
+            else {
+                $speed_is_zero = 1;
+            }
         }
         else {
             $max_state = $np->max_state(
@@ -781,11 +785,18 @@
             );
         }
     }
-    if ( $max_state == 2 ) {
-        $extra_message = " has exceeded critical threshold!";
+    if ($speed_is_zero) {
+        $extra_message =
+          " but has an interface speed of 0, so cannot check a percentage threshold";
+        $max_state = 1;
     }
-    elsif ( $max_state == 1 ) {
-        $extra_message = " has exceeded warning threshold!";
+    else {
+        if ( $max_state == 2 ) {
+            $extra_message = " has exceeded critical threshold!";
+        }
+        elsif ( $max_state == 1 ) {
+            $extra_message = " has exceeded warning threshold!";
+        }
     }
 
     my $perfdata =

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to