summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_snmp.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index eae52ca8..220be234 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -144,8 +144,8 @@ main (int argc, char **argv)
144 usage ("Incorrect arguments supplied\n"); 144 usage ("Incorrect arguments supplied\n");
145 145
146 /* create the command line to execute */ 146 /* create the command line to execute */
147 command_line = ssprintf 147 asprintf
148 (command_line, 148 (&command_line,
149 "%s -p %s -m ALL -v 1 %s -c %s %s", 149 "%s -p %s -m ALL -v 1 %s -c %s %s",
150 PATH_TO_SNMPGET, port, server_address, community, oid); 150 PATH_TO_SNMPGET, port, server_address, community, oid);
151 151
@@ -221,8 +221,8 @@ main (int argc, char **argv)
221 p2 = strpbrk (p2, "0123456789"); 221 p2 = strpbrk (p2, "0123456789");
222 response_value[i] = strtoul (p2, NULL, 10); 222 response_value[i] = strtoul (p2, NULL, 10);
223 iresult = check_num (i); 223 iresult = check_num (i);
224 /*For consistency- full SNMP response every time */ 224 asprintf (&show, "%lu", response_value[i]);
225 show = ssprintf (show, "%d", response); 225 /*asprintf (&show, "%s", response); */
226 } 226 }
227 227
228 else if (eval_method[i] & CRIT_STRING) { 228 else if (eval_method[i] & CRIT_STRING) {
@@ -264,21 +264,18 @@ main (int argc, char **argv)
264 result = max_state (result, iresult); 264 result = max_state (result, iresult);
265 265
266 if (nlabels > 1 && i < nlabels && labels[i] != NULL) 266 if (nlabels > 1 && i < nlabels && labels[i] != NULL)
267 outbuff = ssprintf 267 asprintf
268 (outbuff, 268 (&outbuff,
269 "%s%s%s %s%s%s", 269 "%s%s%s %s%s%s",
270 outbuff, 270 outbuff,
271 (i == 0) ? " " : output_delim, 271 (i == 0) ? " " : output_delim,
272 labels[i], mark (iresult), show, mark (iresult)); 272 labels[i], mark (iresult), show, mark (iresult));
273 else 273 else
274 outbuff = ssprintf 274 asprintf (&outbuff, "%s%s%s%s%s", outbuff,
275 (outbuff,
276 "%s%s%s%s%s",
277 outbuff,
278 (i == 0) ? " " : output_delim, mark (iresult), show, mark (iresult)); 275 (i == 0) ? " " : output_delim, mark (iresult), show, mark (iresult));
279 276
280 if (nunits > 0 && i < nunits) 277 if (nunits > 0 && i < nunits)
281 outbuff = ssprintf (outbuff, "%s %s", outbuff, unitv[i]); 278 asprintf (&outbuff, "%s %s", outbuff, unitv[i]);
282 279
283 i++; 280 i++;
284 281