Title: [opsview] [11929] Possible fix for check_snmp_interfaces_cascade with over 100% utilisation
- Revision
- 11929
- Author
- tvoon
- Date
- 2013-03-23 02:34:55 +0000 (Sat, 23 Mar 2013)
Log Message
Possible fix for check_snmp_interfaces_cascade with over 100% utilisation
Modified Paths
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2013-03-23 01:30:18 UTC (rev 11928)
+++ trunk/CHANGES 2013-03-23 02:34:55 UTC (rev 11929)
@@ -18,6 +18,7 @@
Fixed iOS host notifications not showing correct detail
Fixed validation so that spaces are not allowed at beginning of service check names
Fixed check_snmp_ifstatus as wrong snmp-version specified
+ Possible fix for check_snmp_interfaces with over 100% interface utilisation
Fixed account menu being displayed under menu options in IE8
3.20130304
Modified: trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade 2013-03-23 01:30:18 UTC (rev 11928)
+++ trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade 2013-03-23 02:34:55 UTC (rev 11929)
@@ -551,8 +551,15 @@
)
{
+ # Potentially, value could be "" in the db, meaning that no data was received
+ # for this interface in the last poll. This has been seen occasionally
if ( defined $row->{$val} ) {
- $intdata->{$val} = Math::BigInt->new( $row->{$val} );
+ if ( $row->{$val} eq "" ) {
+ $intdata->{$val} = undef;
+ }
+ else {
+ $intdata->{$val} = Math::BigInt->new( $row->{$val} );
+ }
}
else {
$intdata->{$val} = undef;
@@ -584,7 +591,7 @@
unless ( defined $newvalue && defined $oldvalue ) {
# This can happen if the values were not correctly gathered from device
- die( "Undefined values\n" );
+ return undef;
}
# Must ->copy otherwise original value changed
@@ -649,11 +656,12 @@
# Some interfaces may have no data. Have a special message for these.
# Also, continue processing for errors and discards, but may disable in future
+ # We make this an UNKNOWN state so that it gets recorded, but not alerted
unless ( defined $intdata->{octetsIn} && defined $intdata->{octetsOut} ) {
push @$results,
{
servicename => $servicename,
- state => 0,
+ state => 3,
output => "Interface "
. $intdata->{display_name}
. " is UP. No throughput data available in SNMP",
@@ -723,7 +731,7 @@
push @$results,
{
servicename => $servicename,
- state => "2",
+ state => "3",
output => "Cannot calculate @undefineds",
};
return 0;
@@ -810,7 +818,10 @@
my $extra_message = "";
if ($speed_is_zero) {
$extra_message =
- " but has an interface speed of 0, so cannot check a percentage threshold";
+ " but has an interface speed of 0, so cannot check a percentage threshold (critical: "
+ . ( $intdata->{throughput_critical} || "NA" )
+ . ", warning: "
+ . ( $intdata->{throughput_warning} || "NA" ) . ")";
$max_state = 1;
}
else {
@@ -1149,7 +1160,7 @@
)
{
push @data,
- ( defined $intdata->{$a} ? $intdata->{$a}->bstr() : undef );
+ ( defined $intdata->{$a} ? $intdata->{$a}->bstr() : "" );
}
$sth_saved_data->execute(@data);
}
@@ -1216,9 +1227,15 @@
}
open DUMPFILE, ">>", $dumpfile;
- print DUMPFILE join( ":",
- $start_time, ( map { $_->bstr() . "" } @trace_interface_values ) ),
- '\n';
+ print DUMPFILE join(
+ ":",
+ $start_time,
+ (
+ map { defined $_ ? $_->bstr() . "" : "null" }
+ @trace_interface_values
+ )
+ ),
+ "\n";
close DUMPFILE;
}
_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins