diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 38ce940..4a51a29 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -155,7 +155,7 @@ int errcode, excode; | |||
155 | 155 | ||
156 | char *server_address = NULL; | 156 | char *server_address = NULL; |
157 | char *community = NULL; | 157 | char *community = NULL; |
158 | char *oid = NULL; | 158 | char *oid = ""; |
159 | char *label = NULL; | 159 | char *label = NULL; |
160 | char *units = NULL; | 160 | char *units = NULL; |
161 | char *port = NULL; | 161 | char *port = NULL; |
@@ -189,7 +189,7 @@ main (int argc, char **argv) | |||
189 | char input_buffer[MAX_INPUT_BUFFER]; | 189 | char input_buffer[MAX_INPUT_BUFFER]; |
190 | char *command_line = NULL; | 190 | char *command_line = NULL; |
191 | char *response = NULL; | 191 | char *response = NULL; |
192 | char *outbuff = NULL; | 192 | char *outbuff = ""; |
193 | char *output = NULL; | 193 | char *output = NULL; |
194 | char *ptr = NULL; | 194 | char *ptr = NULL; |
195 | char *p2 = NULL; | 195 | char *p2 = NULL; |
@@ -197,7 +197,6 @@ main (int argc, char **argv) | |||
197 | 197 | ||
198 | labels = malloc (labels_size); | 198 | labels = malloc (labels_size); |
199 | unitv = malloc (unitv_size); | 199 | unitv = malloc (unitv_size); |
200 | outbuff = strscpy (outbuff, ""); | ||
201 | for (i = 0; i < MAX_OIDS; i++) | 200 | for (i = 0; i < MAX_OIDS; i++) |
202 | eval_method[i] = CHECK_UNDEF; | 201 | eval_method[i] = CHECK_UNDEF; |
203 | i = 0; | 202 | i = 0; |
@@ -206,8 +205,8 @@ main (int argc, char **argv) | |||
206 | usage ("Incorrect arguments supplied\n"); | 205 | usage ("Incorrect arguments supplied\n"); |
207 | 206 | ||
208 | /* create the command line to execute */ | 207 | /* create the command line to execute */ |
209 | asprintf (&command_line, "%s -p %s -m ALL -v 1 %s -c %s %s", | 208 | asprintf (&command_line, "%s -m ALL -v 1 -c %s %s:%s %s", |
210 | PATH_TO_SNMPGET, port, server_address, community, oid); | 209 | PATH_TO_SNMPGET, community, server_address, port, oid); |
211 | if (verbose) | 210 | if (verbose) |
212 | printf ("%s\n", command_line); | 211 | printf ("%s\n", command_line); |
213 | 212 | ||
@@ -368,9 +367,9 @@ main (int argc, char **argv) | |||
368 | result = max_state (result, STATE_WARNING); | 367 | result = max_state (result, STATE_WARNING); |
369 | 368 | ||
370 | if (nunits > 0) | 369 | if (nunits > 0) |
371 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | ||
372 | else | ||
373 | printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); | 370 | printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units); |
371 | else | ||
372 | printf ("%s %s -%s\n", label, state_text (result), outbuff); | ||
374 | 373 | ||
375 | return result; | 374 | return result; |
376 | } | 375 | } |