diff --git a/NEWS b/NEWS index 5ed4cf0d..79601f30 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,7 @@ This file documents the major additions and syntax changes between releases. Updated developer documentation to say that performance labels should not have an equals sign or single quote in the label check_http 1.4.14 introduced SSL SNI support - you now have to enable it explicitly with "--sni" + check_snmp -l label option is also used for the performance label, which may change history from previous uses 1.4.14 16th September 2009 check_http has options to specify the HTTP method (#2155152) diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 82d77c4c..5a025037 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -166,6 +166,7 @@ main (int argc, char **argv) time_t current_time; double temp_double; time_t duration; + char *conv = "12345678"; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); @@ -304,7 +305,10 @@ main (int argc, char **argv) } for (line=0, i=0; line < chld_out.lines; line++, i++) { - const char *conv = "%.0f"; + if(calculate_rate) + conv = "%.1f"; + else + conv = "%.0f"; ptr = chld_out.line[line]; oidname = strpcpy (oidname, ptr, delimiter); @@ -449,7 +453,7 @@ main (int argc, char **argv) result = max_state (result, iresult); /* Prepend a label for this OID if there is one */ - if (nlabels > (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) + if (nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) asprintf (&outbuff, "%s%s%s %s%s%s", outbuff, (i == 0) ? " " : output_delim, labels[i], mark (iresult), show, mark (iresult)); @@ -465,7 +469,11 @@ main (int argc, char **argv) ptr = NULL; strtod(show, &ptr); if (ptr > show) { - strncat(perfstr, oidname, sizeof(perfstr)-strlen(perfstr)-1); + if (nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) + temp_string=labels[i]; + else + temp_string=oidname; + strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); len = sizeof(perfstr)-strlen(perfstr)-1; strncat(perfstr, show, len>ptr-show ? ptr-show : len); @@ -704,7 +712,6 @@ process_arguments (int argc, char **argv) output_delim = strscpy (output_delim, optarg); break; case 'l': /* label */ - label = optarg; nlabels++; if (nlabels >= labels_size) { labels_size += 8;