Title: [opsview] [11765] check_sql_advanced improvements
- Revision
- 11765
- Author
- dferguson
- Date
- 2013-03-13 16:38:47 +0000 (Wed, 13 Mar 2013)
Log Message
check_sql_advanced improvements
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
Thanks to Emilio Scalise for the patch
OVS-4707
Modified Paths
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2013-03-13 16:28:23 UTC (rev 11764)
+++ trunk/CHANGES 2013-03-13 16:38:47 UTC (rev 11765)
@@ -7,6 +7,7 @@
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
NOTICES:
FIXES:
Modified: trunk/opsview-core/nagios-plugins/check_sql_advanced
===================================================================
--- trunk/opsview-core/nagios-plugins/check_sql_advanced 2013-03-13 16:28:23 UTC (rev 11764)
+++ trunk/opsview-core/nagios-plugins/check_sql_advanced 2013-03-13 16:38:47 UTC (rev 11765)
@@ -443,15 +443,15 @@
my $beforetime = time;
$sth->execute();
-# Work out the query duration
-$duration = int( 10000 * ( time - $beforetime ) ) / 1000;
-logger( "Query duration was $duration" );
-
# Retrieve the results
my @result = $sth->fetchrow_array();
$retmsg = "Query returned: $result[0]";
logger( "Query result was: $result[0]" );
+# Work out the query duration, including fetching the rows
+$duration = int( time - $beforetime );
+logger( "Query duration was $duration" );
+
# Apply any given regex
my @regexes = split( ';', $result_regex );
@@ -473,10 +473,9 @@
$perfdata = "result=" . $result[0] . ";$warn_num;$crit_num;;";
}
-else {
- $perfdata = "execute_time=${duration}s";
-}
+$perfdata .= " execute_time=${duration}s";
+
# Check warning/critical values
my $checkres;
if ( !$critical eq "" ) {
_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins