summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorTon Voon <ton.voon@opsera.com>2010-06-30 09:01:14 +0100
committerTon Voon <ton.voon@opsera.com>2010-06-30 09:01:14 +0100
commit6805fecd620e4f2c2fa53f2a331e7c6a005ea9c4 (patch)
tree88fedcb11317339449841726feeda8a721f9033a /plugins/check_snmp.c
parent2ad344a47ba80e1c95e554e78b7a1efe0ab0e86b (diff)
downloadmonitoring-plugins-6805fecd620e4f2c2fa53f2a331e7c6a005ea9c4.tar.gz
Fixed rate-multiplier option
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index d3871040..b16428fe 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -415,7 +415,7 @@ main (int argc, char **argv)
415 duration = current_time-previous_state->time; 415 duration = current_time-previous_state->time;
416 if(duration<=0) 416 if(duration<=0)
417 die(STATE_UNKNOWN,_("Time duration between plugin calls is invalid")); 417 die(STATE_UNKNOWN,_("Time duration between plugin calls is invalid"));
418 temp_double = (response_value[i]-previous_value[i])/duration; 418 temp_double = response_value[i]-previous_value[i];
419 /* Simple overflow catcher (same as in rrdtool, rrd_update.c) */ 419 /* Simple overflow catcher (same as in rrdtool, rrd_update.c) */
420 if(is_counter) { 420 if(is_counter) {
421 if(temp_double<(double)0.0) 421 if(temp_double<(double)0.0)
@@ -423,6 +423,8 @@ main (int argc, char **argv)
423 if(temp_double<(double)0.0) 423 if(temp_double<(double)0.0)
424 temp_double+=(double)18446744069414584320.0; /* 2^64-2^32 */; 424 temp_double+=(double)18446744069414584320.0; /* 2^64-2^32 */;
425 } 425 }
426 /* Convert to per second, then use multiplier */
427 temp_double = temp_double/(duration*rate_multiplier);
426 iresult = get_status(temp_double, thlds[i]); 428 iresult = get_status(temp_double, thlds[i]);
427 asprintf (&show, conv, temp_double); 429 asprintf (&show, conv, temp_double);
428 } 430 }
@@ -1042,6 +1044,8 @@ print_help (void)
1042 printf (" %s\n", _("Critical threshold range(s)")); 1044 printf (" %s\n", _("Critical threshold range(s)"));
1043 printf (" %s\n", "--rate"); 1045 printf (" %s\n", "--rate");
1044 printf (" %s\n", _("Enable rate calculation. See 'Rate Calculation' below")); 1046 printf (" %s\n", _("Enable rate calculation. See 'Rate Calculation' below"));
1047 printf (" %s\n", "--rate-multiplier");
1048 printf (" %s\n", _("Converts rate per second. For example, set to 60 to convert to per minute"));
1045 1049
1046 /* Tests Against Strings */ 1050 /* Tests Against Strings */
1047 printf (" %s\n", "-s, --string=STRING"); 1051 printf (" %s\n", "-s, --string=STRING");
@@ -1088,9 +1092,9 @@ print_help (void)
1088 printf("%s\n", _("Rate Calculation:")); 1092 printf("%s\n", _("Rate Calculation:"));
1089 printf(" %s\n", _("In many places, SNMP returns counters that are only meaningful when")); 1093 printf(" %s\n", _("In many places, SNMP returns counters that are only meaningful when"));
1090 printf(" %s\n", _("calculating the counter difference since the last check. check_snmp")); 1094 printf(" %s\n", _("calculating the counter difference since the last check. check_snmp"));
1091 printf(" %s\n", _("saves the last state information in a file so that the rate can be")); 1095 printf(" %s\n", _("saves the last state information in a file so that the rate per second"));
1092 printf(" %s\n", _("calculated. Use the --rate option to save state information. On the")); 1096 printf(" %s\n", _("can be calculated. Use the --rate option to save state information."));
1093 printf(" %s\n", _("first run, there will be no prior state - this will return with OK.")); 1097 printf(" %s\n", _("On the first run, there will be no prior state - this will return with OK."));
1094 printf(" %s\n", _("The state is uniquely determined by the arguments to the plugin, so")); 1098 printf(" %s\n", _("The state is uniquely determined by the arguments to the plugin, so"));
1095 printf(" %s\n", _("changing the arguments will create a new state file.")); 1099 printf(" %s\n", _("changing the arguments will create a new state file."));
1096 1100