diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 15 |
1 files changed, 11 insertions, 4 deletions
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) | |||
166 | time_t current_time; | 166 | time_t current_time; |
167 | double temp_double; | 167 | double temp_double; |
168 | time_t duration; | 168 | time_t duration; |
169 | char *conv = "12345678"; | ||
169 | 170 | ||
170 | setlocale (LC_ALL, ""); | 171 | setlocale (LC_ALL, ""); |
171 | bindtextdomain (PACKAGE, LOCALEDIR); | 172 | bindtextdomain (PACKAGE, LOCALEDIR); |
@@ -304,7 +305,10 @@ main (int argc, char **argv) | |||
304 | } | 305 | } |
305 | 306 | ||
306 | for (line=0, i=0; line < chld_out.lines; line++, i++) { | 307 | for (line=0, i=0; line < chld_out.lines; line++, i++) { |
307 | const char *conv = "%.0f"; | 308 | if(calculate_rate) |
309 | conv = "%.1f"; | ||
310 | else | ||
311 | conv = "%.0f"; | ||
308 | 312 | ||
309 | ptr = chld_out.line[line]; | 313 | ptr = chld_out.line[line]; |
310 | oidname = strpcpy (oidname, ptr, delimiter); | 314 | oidname = strpcpy (oidname, ptr, delimiter); |
@@ -449,7 +453,7 @@ main (int argc, char **argv) | |||
449 | result = max_state (result, iresult); | 453 | result = max_state (result, iresult); |
450 | 454 | ||
451 | /* Prepend a label for this OID if there is one */ | 455 | /* Prepend a label for this OID if there is one */ |
452 | if (nlabels > (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) | 456 | if (nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) |
453 | asprintf (&outbuff, "%s%s%s %s%s%s", outbuff, | 457 | asprintf (&outbuff, "%s%s%s %s%s%s", outbuff, |
454 | (i == 0) ? " " : output_delim, | 458 | (i == 0) ? " " : output_delim, |
455 | labels[i], mark (iresult), show, mark (iresult)); | 459 | labels[i], mark (iresult), show, mark (iresult)); |
@@ -465,7 +469,11 @@ main (int argc, char **argv) | |||
465 | ptr = NULL; | 469 | ptr = NULL; |
466 | strtod(show, &ptr); | 470 | strtod(show, &ptr); |
467 | if (ptr > show) { | 471 | if (ptr > show) { |
468 | strncat(perfstr, oidname, sizeof(perfstr)-strlen(perfstr)-1); | 472 | if (nlabels >= (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) |
473 | temp_string=labels[i]; | ||
474 | else | ||
475 | temp_string=oidname; | ||
476 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); | ||
469 | strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); | 477 | strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); |
470 | len = sizeof(perfstr)-strlen(perfstr)-1; | 478 | len = sizeof(perfstr)-strlen(perfstr)-1; |
471 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); | 479 | strncat(perfstr, show, len>ptr-show ? ptr-show : len); |
@@ -704,7 +712,6 @@ process_arguments (int argc, char **argv) | |||
704 | output_delim = strscpy (output_delim, optarg); | 712 | output_delim = strscpy (output_delim, optarg); |
705 | break; | 713 | break; |
706 | case 'l': /* label */ | 714 | case 'l': /* label */ |
707 | label = optarg; | ||
708 | nlabels++; | 715 | nlabels++; |
709 | if (nlabels >= labels_size) { | 716 | if (nlabels >= labels_size) { |
710 | labels_size += 8; | 717 | labels_size += 8; |