diff options
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 0ef0c65..d66d834 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -82,6 +82,7 @@ regex_t preg; | |||
82 | regmatch_t pmatch[10]; | 82 | regmatch_t pmatch[10]; |
83 | char timestamp[10] = ""; | 83 | char timestamp[10] = ""; |
84 | char errbuf[MAX_INPUT_BUFFER]; | 84 | char errbuf[MAX_INPUT_BUFFER]; |
85 | char perfstr[MAX_INPUT_BUFFER]; | ||
85 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | 86 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; |
86 | int eflags = 0; | 87 | int eflags = 0; |
87 | int errcode, excode; | 88 | int errcode, excode; |
@@ -136,6 +137,7 @@ main (int argc, char **argv) | |||
136 | char *ptr = NULL; | 137 | char *ptr = NULL; |
137 | char *p2 = NULL; | 138 | char *p2 = NULL; |
138 | char *show = NULL; | 139 | char *show = NULL; |
140 | char type[8]; | ||
139 | 141 | ||
140 | setlocale (LC_ALL, ""); | 142 | setlocale (LC_ALL, ""); |
141 | bindtextdomain (PACKAGE, LOCALEDIR); | 143 | bindtextdomain (PACKAGE, LOCALEDIR); |
@@ -153,7 +155,7 @@ main (int argc, char **argv) | |||
153 | port = strdup (DEFAULT_PORT); | 155 | port = strdup (DEFAULT_PORT); |
154 | outbuff = strdup (""); | 156 | outbuff = strdup (""); |
155 | output = strdup (""); | 157 | output = strdup (""); |
156 | delimiter = strdup (DEFAULT_DELIMITER); | 158 | delimiter = strdup (" = "); |
157 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); | 159 | output_delim = strdup (DEFAULT_OUTPUT_DELIMITER); |
158 | miblist = strdup (DEFAULT_MIBLIST); | 160 | miblist = strdup (DEFAULT_MIBLIST); |
159 | timeout_interval = DEFAULT_TIMEOUT; | 161 | timeout_interval = DEFAULT_TIMEOUT; |
@@ -189,9 +191,14 @@ main (int argc, char **argv) | |||
189 | 191 | ||
190 | ptr = output; | 192 | ptr = output; |
191 | 193 | ||
194 | strcat(perfstr, "| "); | ||
192 | while (ptr) { | 195 | while (ptr) { |
196 | char *foo; | ||
197 | |||
198 | foo = strstr (ptr, delimiter); | ||
199 | strncat(perfstr, ptr, foo-ptr); | ||
200 | ptr = foo; | ||
193 | 201 | ||
194 | ptr = strstr (ptr, delimiter); | ||
195 | if (ptr == NULL) | 202 | if (ptr == NULL) |
196 | break; | 203 | break; |
197 | 204 | ||
@@ -227,8 +234,10 @@ main (int argc, char **argv) | |||
227 | show = strstr (response, "Gauge: ") + 7; | 234 | show = strstr (response, "Gauge: ") + 7; |
228 | else if (strstr (response, "Gauge32: ")) | 235 | else if (strstr (response, "Gauge32: ")) |
229 | show = strstr (response, "Gauge32: ") + 9; | 236 | show = strstr (response, "Gauge32: ") + 9; |
230 | else if (strstr (response, "Counter32: ")) | 237 | else if (strstr (response, "Counter32: ")) { |
231 | show = strstr (response, "Counter32: ") + 11; | 238 | show = strstr (response, "Counter32: ") + 11; |
239 | strcpy(type, "c"); | ||
240 | } | ||
232 | else if (strstr (response, "INTEGER: ")) | 241 | else if (strstr (response, "INTEGER: ")) |
233 | show = strstr (response, "INTEGER: ") + 9; | 242 | show = strstr (response, "INTEGER: ") + 9; |
234 | else if (strstr (response, "STRING: ")) | 243 | else if (strstr (response, "STRING: ")) |
@@ -317,7 +326,11 @@ main (int argc, char **argv) | |||
317 | 326 | ||
318 | i++; | 327 | i++; |
319 | 328 | ||
320 | } /* end while (ptr) */ | 329 | char *str[MAX_INPUT_BUFFER]; |
330 | asprintf(str, "=%s%s;;;; ", show, type ? type : ""); | ||
331 | strcat(perfstr, *str); | ||
332 | |||
333 | } /* end while (ptr) */ | ||
321 | 334 | ||
322 | if (found == 0) | 335 | if (found == 0) |
323 | die (STATE_UNKNOWN, | 336 | die (STATE_UNKNOWN, |
@@ -339,7 +352,7 @@ main (int argc, char **argv) | |||
339 | /* if (nunits == 1 || i == 1) */ | 352 | /* if (nunits == 1 || i == 1) */ |
340 | /* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ | 353 | /* printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); */ |
341 | /* else */ | 354 | /* else */ |
342 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | 355 | printf ("%s %s -%s %s \n", label, state_text (result), outbuff, perfstr); |
343 | 356 | ||
344 | return result; | 357 | return result; |
345 | } | 358 | } |