Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2013-04-25 14:05:15 UTC (rev 12186)
+++ trunk/CHANGES 2013-04-25 14:22:59 UTC (rev 12187)
@@ -7,11 +7,13 @@
SNMP throughput thresholds now have an expanded syntax to handle input and output throughput separately as well as ranges
Remove some more specific words from SNMP interface ifDescr to reduce instances of duplicate interface ids being used (level 4 added)
Acknowledging a problem via the host or service state information cgi page now uses the standard Opsview form
- check_sql_advanced query duration also takes account of fetching the rows. Also amend execution duration calculation to be s not ms and always include it in perfdata
+ check_sql_advanced query duration also takes account of fetching the rows. Also amend execution duration calculation to be seconds,
+ not milliseconds and always include it in perfdata
Any new Opspacks will be installed upon future upgrades
New Opspack: MySQL Server, replacing existing MySQL
New Opspack: Apache HTTP Server, replacing existing Apache HTTP
Management URLs open in a new window for http and https methods
+ check_snmp_interfaces_cascade now reports timings on main execution parts
Downgrade check_snmp_interfaces_cascade errors with invalid percentage utilisation (critical) and long plugin execution time (warning) to be unknowns instead
Notification profiles and shared notification profiles now have a field to prevent the sending of alerts after a defined number
NOTICES:
@@ -29,7 +31,7 @@
Fixed Debian nagios-nrpe-server package not being a conflict
Fixed check_snmp_ifstatus plugin to cope with gaps in nodes when polling SNMP interfaces
Fixed SNMP polling of device interfaces with no ifDescr set
- Fixed pathes to various images in dashboaard for a rehomed web app
+ Fixed paths to images in events view and dashboard splash page for a rehomed web app
3.20130304
ENHANCEMENTS:
Modified: trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade
===================================================================
--- trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade 2013-04-25 14:05:15 UTC (rev 12186)
+++ trunk/opsview-core/nagios-plugins/check_snmp_interfaces_cascade 2013-04-25 14:22:59 UTC (rev 12187)
@@ -51,7 +51,7 @@
use Math::BigInt;
use JSON::XS qw(decode_json);
-my $start_time = time();
+my $start_time = gettimeofday();
my $poller_criticals = [];
my $poller_warnings = [];
my $poller_unknowns = [];
@@ -70,7 +70,7 @@
my $trace_hostnames = {
# If you want to add a hostname, as defined in Nagios, for tracing all results, enter here
- #hostname => 1,
+ #'hostname' => 1,
};
# Where to put the .db file
@@ -249,6 +249,7 @@
#######################################
# Start connecting
#######################################
+my $snmp_connection_start = gettimeofday();
my ( $s, $e );
if ( $hostinfo->{snmp_version} eq "3" ) {
if ( $hostinfo->{snmpv3_privpassword} ) {
@@ -317,6 +318,9 @@
}
}
+my $snmp_connection_time =
+ sprintf( "%.2f", gettimeofday() - $snmp_connection_start );
+
if ($max_msg_size) {
if ( !defined $s->max_msg_size($max_msg_size) ) {
print "SNMP Error: ", $s->error, $/;
@@ -504,6 +508,8 @@
# current data
###################################
+my $sql_read_start = gettimeofday();
+
# We use the nagios hostname because in future, we will want to search for all interface names
# and ifalias and link back to a specific nagios host. So the hostname will be encoded as the db cache name - see OPS-250
my $dbh = db_connect($nagios_hostname);
@@ -578,6 +584,8 @@
}
$sth->finish();
+my $sql_read_time = sprintf( "%.2f", gettimeofday() - $sql_read_start );
+
if ( $verbose >= 3 ) {
print "Merged with saved data:\n";
print Data::Dump::dump($data);
@@ -1137,6 +1145,7 @@
print "\n";
}
+my $submit_result_start = gettimeofday();
foreach my $result (@$results) {
my $cmd = Opsview::Externalcommand->new(
command => "PROCESS_SERVICE_CHECK_RESULT",
@@ -1147,12 +1156,15 @@
);
$cmd->send_to_master;
}
+my $submit_result_time =
+ sprintf( "%.2f", gettimeofday() - $submit_result_start );
###################################
# Update database with latest
# values
###################################
+my $sql_write_start = gettimeofday();
$dbh->do( "DELETE FROM interfaces" );
my $sth_saved_data = $dbh->prepare( "
INSERT INTO interfaces
@@ -1185,6 +1197,7 @@
}
$sth->finish;
$dbh->disconnect;
+my $sql_write_time = sprintf( "%.2f", gettimeofday() - $sql_write_start );
###################################
# Final return message
@@ -1192,18 +1205,54 @@
my $num_interfaces = keys %{ $data->{interfaces} };
$np->add_perfdata(
- label => "time",
+ label => "connectiontime",
+ value => $snmp_connection_time,
+ uom => "s",
+);
+$np->add_perfdata(
+ label => "polltime",
value => $polling_time,
uom => "s",
);
-my $end_time = time();
-my $plugin_execution_time = $end_time - $start_time;
-if ( $plugin_execution_time > $polling_time + 10 ) {
+$np->add_perfdata(
+ label => "sqlrtime",
+ value => $sql_read_time,
+ uom => "s",
+);
+$np->add_perfdata(
+ label => "submittime",
+ value => $submit_result_time,
+ uom => "s",
+);
+$np->add_perfdata(
+ label => "sqlwtime",
+ value => $sql_write_time,
+ uom => "s",
+);
- # This is downgraded to an UNKNOWN because it is not an error, but needs investigating
- push @$poller_unknowns,
- "Plugin has taken too long to execute (${plugin_execution_time}s) - check SNMP version is specified correctly";
+# This is downgraded to an UNKNOWN because it is not an error, but needs investigating
+sub check_timings {
+ my ( $value, $max, $message ) = @_;
+ if ( $value > $max ) {
+ $message =~ s/MAX/$max/g;
+ push @$poller_unknowns, $message . " (${value}s)";
+ }
}
+check_timings(
+ $snmp_connection_time,
+ 10,
+ "Plugin has taken > MAX seconds to connect to SNMP - check SNMP version is specified correctly"
+);
+check_timings( $sql_read_time, 10,
+ "Reading previous values from cache has taken > MAX seconds"
+);
+check_timings( $sql_write_time, 10,
+ "Writing current values to cache has taken > MAX seconds"
+);
+check_timings( $submit_result_time, 10,
+ "Submitting results has taken > MAX seconds"
+);
+
my $message;
if (@$poller_criticals) {
$message .= join( "; ", @$poller_criticals ) . "; ";
@@ -1253,7 +1302,7 @@
open DUMPFILE, ">>", $dumpfile;
print DUMPFILE join(
":",
- $start_time,
+ int($start_time),
(
map { defined $_ ? $_->bstr() . "" : "null" }
@trace_interface_values
@@ -1263,4 +1312,10 @@
close DUMPFILE;
}
+my $plugin_execution_time = sprintf( "%.2f", gettimeofday() - $start_time );
+$np->add_perfdata(
+ label => "totaltime",
+ value => $plugin_execution_time,
+ uom => "s",
+);
$np->nagios_exit( $rc, $message );