diff options
| author | Ton Voon <ton.voon@opsera.com> | 2010-06-22 12:45:09 +0100 |
|---|---|---|
| committer | Ton Voon <ton.voon@opsera.com> | 2010-06-22 12:45:09 +0100 |
| commit | 4a0b843173640562bed1c7f65771eea47163c32a (patch) | |
| tree | 86787787e26c9d492af573336764ff099abf3cb9 | |
| parent | 5b229ce8b09f36e6c684aea31379126785107b50 (diff) | |
| download | monitoring-plugins-4a0b843173640562bed1c7f65771eea47163c32a.tar.gz | |
check_snmp -l label is now used for performance label
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | plugins/check_snmp.c | 15 |
2 files changed, 12 insertions, 4 deletions
| @@ -27,6 +27,7 @@ This file documents the major additions and syntax changes between releases. | |||
| 27 | Updated developer documentation to say that performance labels should not have an equals sign or | 27 | Updated developer documentation to say that performance labels should not have an equals sign or |
| 28 | single quote in the label | 28 | single quote in the label |
| 29 | check_http 1.4.14 introduced SSL SNI support - you now have to enable it explicitly with "--sni" | 29 | check_http 1.4.14 introduced SSL SNI support - you now have to enable it explicitly with "--sni" |
| 30 | check_snmp -l label option is also used for the performance label, which may change history from previous uses | ||
| 30 | 31 | ||
| 31 | 1.4.14 16th September 2009 | 32 | 1.4.14 16th September 2009 |
| 32 | check_http has options to specify the HTTP method (#2155152) | 33 | 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) | |||
| 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; |
