diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index ac2c58c..7ba9684 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -11,6 +11,9 @@ | |||
11 | * | 11 | * |
12 | * This file contains the check_snmp plugin | 12 | * This file contains the check_snmp plugin |
13 | * | 13 | * |
14 | * Check status of remote machines and obtain sustem information via SNMP | ||
15 | * | ||
16 | * | ||
14 | * License Information: | 17 | * License Information: |
15 | * | 18 | * |
16 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
@@ -93,8 +96,8 @@ char regex_expect[MAX_INPUT_BUFFER] = ""; | |||
93 | regex_t preg; | 96 | regex_t preg; |
94 | regmatch_t pmatch[10]; | 97 | regmatch_t pmatch[10]; |
95 | char timestamp[10] = ""; | 98 | char timestamp[10] = ""; |
96 | char errbuf[MAX_INPUT_BUFFER] = ""; | 99 | char errbuf[MAX_INPUT_BUFFER]; |
97 | char perfstr[MAX_INPUT_BUFFER] = ""; | 100 | char perfstr[MAX_INPUT_BUFFER]; |
98 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | 101 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; |
99 | int eflags = 0; | 102 | int eflags = 0; |
100 | int errcode, excode; | 103 | int errcode, excode; |
@@ -151,7 +154,8 @@ main (int argc, char **argv) | |||
151 | char *ptr = NULL; | 154 | char *ptr = NULL; |
152 | char *p2 = NULL; | 155 | char *p2 = NULL; |
153 | char *show = NULL; | 156 | char *show = NULL; |
154 | char type[8] = ""; | 157 | char type[8]; |
158 | char *str[MAX_INPUT_BUFFER]; | ||
155 | 159 | ||
156 | setlocale (LC_ALL, ""); | 160 | setlocale (LC_ALL, ""); |
157 | bindtextdomain (PACKAGE, LOCALEDIR); | 161 | bindtextdomain (PACKAGE, LOCALEDIR); |
@@ -253,10 +257,6 @@ main (int argc, char **argv) | |||
253 | } | 257 | } |
254 | 258 | ||
255 | /* We strip out the datatype indicator for PHBs */ | 259 | /* We strip out the datatype indicator for PHBs */ |
256 | |||
257 | /* Clean up type array - Sol10 does not necessarily zero it out */ | ||
258 | bzero(type, sizeof(type)); | ||
259 | |||
260 | if (strstr (response, "Gauge: ")) | 260 | if (strstr (response, "Gauge: ")) |
261 | show = strstr (response, "Gauge: ") + 7; | 261 | show = strstr (response, "Gauge: ") + 7; |
262 | else if (strstr (response, "Gauge32: ")) | 262 | else if (strstr (response, "Gauge32: ")) |
@@ -348,11 +348,8 @@ main (int argc, char **argv) | |||
348 | 348 | ||
349 | i++; | 349 | i++; |
350 | 350 | ||
351 | strcat(perfstr, "="); | 351 | asprintf(str, "=%s%s;;;; ", show, type ? type : ""); |
352 | strcat(perfstr, show); | 352 | strcat(perfstr, *str); |
353 | if (type) | ||
354 | strcat(perfstr, type); | ||
355 | strcat(perfstr, " "); | ||
356 | 353 | ||
357 | } /* end while (ptr) */ | 354 | } /* end while (ptr) */ |
358 | 355 | ||
@@ -1002,11 +999,9 @@ void | |||
1002 | print_usage (void) | 999 | print_usage (void) |
1003 | { | 1000 | { |
1004 | printf (_("Usage:")); | 1001 | printf (_("Usage:")); |
1005 | printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\ | 1002 | printf ("%s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range]\n",progname); |
1006 | [-C community] [-s string] [-r regex] [-R regexi]\n\ | 1003 | printf ("[-C community] [-s string] [-r regex] [-R regexi] [-t timeout] [-e retries]\n"); |
1007 | [-t timeout] [-e retries]\n\ | 1004 | printf ("[-l label] [-u units] [-p port-number] [-d delimiter] [-D output-delimiter]\n"); |
1008 | [-l label] [-u units] [-p port-number] [-d delimiter]\n\ | 1005 | printf ("[-m miblist] [-P snmp version] [-L seclevel] [-U secname] [-a authproto]\n"); |
1009 | [-D output-delimiter] [-m miblist] [-P snmp version]\n\ | 1006 | printf ("[-A authpasswd] [-X privpasswd]\n"); |
1010 | [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\ | ||
1011 | [-X privpasswd]\n", progname); | ||
1012 | } | 1007 | } |