Title: [opsview] [10492] Fixed display of interfaces bits/s display, using 1000 rather than 1024 divisor
Revision
10492
Author
tvoon
Date
2012-10-17 12:50:31 +0100 (Wed, 17 Oct 2012)

Log Message

Fixed display of interfaces bits/s display, using 1000 rather than 1024 divisor

Modified Paths

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2012-10-17 00:36:17 UTC (rev 10491)
+++ trunk/CHANGES	2012-10-17 11:50:31 UTC (rev 10492)
@@ -11,6 +11,7 @@
     FIXES:
     Fixed apache configuration for redundancy, specifically removing apache_proxy_ssl.conf and replacing with apache_ssl.conf
     Fixed messages for set state
+    Fixed display of check_snmp_interfaces_cascade so that bits/s to Gbps is using division by 1000^3 rather than 1024^3
 
 3.20120925
     FEATURES:

Modified: trunk/opsview-core/bin/query_host
===================================================================
--- trunk/opsview-core/bin/query_host	2012-10-17 00:36:17 UTC (rev 10491)
+++ trunk/opsview-core/bin/query_host	2012-10-17 11:50:31 UTC (rev 10492)
@@ -352,9 +352,7 @@
 
 # Expects $1 to be an integer. Will then convert to
 # a more readable metric
-# Note: This is not the same as check_snmp_interface_cascade's convert_to_units
-# routine. A 100Mbs interface changes to 96Mbs using other routine, so
-# not sure which is more correct
+# Similar to check_snmp_interfaces_cascade - should refactor
 sub convert_to_readable {
     my $value = shift;
     if ( $value == 4294967295 ) {

Modified: trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2012-10-17 00:36:17 UTC (rev 10491)
+++ trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade	2012-10-17 11:50:31 UTC (rev 10492)
@@ -195,16 +195,13 @@
     return $dbh;
 }
 
-# The calculation here is not the same as query_host's convert_to_readable
-# 100Mbs card comes back as 96Mbs using this routine, so perhaps this is not
-# the correct routine to use. Leaving as is for the moment
 sub convert_units {
 
     # Input should be in bytes - we'll convert to something more human readable
     my ($bits)   = @_;
-    my $gigabits = 1024 * 1024 * 1024;
-    my $megabits = 1024 * 1024;
-    my $kilobits = 1024;
+    my $gigabits = 1000 * 1000 * 1000;
+    my $megabits = 1000 * 1000;
+    my $kilobits = 1000;
 
     # Gigabits
     if ( $bits > $gigabits ) {
@@ -433,30 +430,33 @@
 
     $intdata->{found} = 1;
 
-    foreach my $t ( qw(
-      octetsIn
-      octetsOut
-      discardsIn
-      discardsOut
-      errorsIn
-      errorsOut
-      ifSpeed
-      ifAlias
-      ifOperStatus
-      ifAdminStatus
-      display_name
-      unicastIn
-      unicastOut
-      nonunicastIn
-      nonunicastOut
-      broadcastIn
-      broadcastOut
-      multicastIn
-      multicastOut
-      ) ) {
+    foreach my $t (
+        qw(
+        octetsIn
+        octetsOut
+        discardsIn
+        discardsOut
+        errorsIn
+        errorsOut
+        ifSpeed
+        ifAlias
+        ifOperStatus
+        ifAdminStatus
+        display_name
+        unicastIn
+        unicastOut
+        nonunicastIn
+        nonunicastOut
+        broadcastIn
+        broadcastOut
+        multicastIn
+        multicastOut
+        )
+      )
+    {
         $intdata->{$t} = $polled_data->{$t}
           if exists $polled_data->{$t};
-      };
+    }
 }
 
 if ( $verbose >= 3 ) {
@@ -1110,8 +1110,9 @@
             $interfacename, $intid, $intdata->{shortinterfacename},
             $intdata->{ifAlias}, $intdata->{ifName}, $now
         );
-        foreach my $a
-          ( qw(octetsIn octetsOut errorsIn errorsOut discardsIn discardsOut unicastIn unicastOut nonunicastIn nonunicastOut broadcastIn broadcastOut multicastIn multicastOut) )
+        foreach my $a (
+            qw(octetsIn octetsOut errorsIn errorsOut discardsIn discardsOut unicastIn unicastOut nonunicastIn nonunicastOut broadcastIn broadcastOut multicastIn multicastOut)
+          )
         {
             push @data,
               ( defined $intdata->{$a} ? $intdata->{$a}->bstr() : undef );

Modified: trunk/opsview-core/nagios-plugins/check_snmp_linkstatus
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_linkstatus	2012-10-17 00:36:17 UTC (rev 10491)
+++ trunk/opsview-core/nagios-plugins/check_snmp_linkstatus	2012-10-17 11:50:31 UTC (rev 10492)
@@ -480,9 +480,9 @@
 
     # Input should be in bytes - we'll convert to something more human readable
     my ($bits)   = @_;
-    my $gigabits = 1024 * 1024 * 1024;
-    my $megabits = 1024 * 1024;
-    my $kilobits = 1024;
+    my $gigabits = 1000 * 1000 * 1000;
+    my $megabits = 1000 * 1000;
+    my $kilobits = 1000;
 
     # Gigabits
     if ( $bits > $gigabits ) {

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

Reply via email to