summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/check_snmp.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 741ad3e..f8bba99 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -184,13 +184,13 @@ main (int argc, char **argv)
184 /* create the command line to execute */ 184 /* create the command line to execute */
185 if(usesnmpgetnext == TRUE) { 185 if(usesnmpgetnext == TRUE) {
186 asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", 186 asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
187 PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto, 187 PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
188 authpriv, server_address, port, oid); 188 authpriv, server_address, port, oid);
189 }else{ 189 }else{
190 190
191 asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", 191 asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
192 PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, 192 PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
193 authpriv, server_address, port, oid); 193 authpriv, server_address, port, oid);
194 } 194 }
195 195
196 if (verbose) 196 if (verbose)
@@ -343,11 +343,11 @@ main (int argc, char **argv)
343 /* Prepend a label for this OID if there is one */ 343 /* Prepend a label for this OID if there is one */
344 if (nlabels > (size_t)1 && (size_t)i < nlabels && labels[i] != NULL) 344 if (nlabels > (size_t)1 && (size_t)i < nlabels && labels[i] != NULL)
345 asprintf (&outbuff, "%s%s%s %s%s%s", outbuff, 345 asprintf (&outbuff, "%s%s%s %s%s%s", outbuff,
346 (i == 0) ? " " : output_delim, 346 (i == 0) ? " " : output_delim,
347 labels[i], mark (iresult), show, mark (iresult)); 347 labels[i], mark (iresult), show, mark (iresult));
348 else 348 else
349 asprintf (&outbuff, "%s%s%s%s%s", outbuff, (i == 0) ? " " : output_delim, 349 asprintf (&outbuff, "%s%s%s%s%s", outbuff, (i == 0) ? " " : output_delim,
350 mark (iresult), show, mark (iresult)); 350 mark (iresult), show, mark (iresult));
351 351
352 /* Append a unit string for this OID if there is one */ 352 /* Append a unit string for this OID if there is one */
353 if (nunits > (size_t)0 && (size_t)i < nunits && unitv[i] != NULL) 353 if (nunits > (size_t)0 && (size_t)i < nunits && unitv[i] != NULL)
@@ -365,9 +365,9 @@ main (int argc, char **argv)
365 365
366 if (found == 0) 366 if (found == 0)
367 die (STATE_UNKNOWN, 367 die (STATE_UNKNOWN,
368 _("%s problem - No data received from host\nCMD: %s\n"), 368 _("%s problem - No data received from host\nCMD: %s\n"),
369 label, 369 label,
370 command_line); 370 command_line);
371 371
372 /* WARNING if output found on stderr */ 372 /* WARNING if output found on stderr */
373 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr)) 373 if (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_stderr))
@@ -466,31 +466,31 @@ process_arguments (int argc, char **argv)
466 case 'H': /* Host or server */ 466 case 'H': /* Host or server */
467 server_address = optarg; 467 server_address = optarg;
468 break; 468 break;
469 case 'p': /* TCP port number */ 469 case 'p': /* TCP port number */
470 port = optarg; 470 port = optarg;
471 break; 471 break;
472 case 'm': /* List of MIBS */ 472 case 'm': /* List of MIBS */
473 miblist = optarg; 473 miblist = optarg;
474 break; 474 break;
475 case 'n': /* usesnmpgetnext */ 475 case 'n': /* usesnmpgetnext */
476 usesnmpgetnext = TRUE; 476 usesnmpgetnext = TRUE;
477 break; 477 break;
478 case 'P': /* SNMP protocol version */ 478 case 'P': /* SNMP protocol version */
479 proto = optarg; 479 proto = optarg;
480 break; 480 break;
481 case 'L': /* security level */ 481 case 'L': /* security level */
482 seclevel = optarg; 482 seclevel = optarg;
483 break; 483 break;
484 case 'U': /* security username */ 484 case 'U': /* security username */
485 secname = optarg; 485 secname = optarg;
486 break; 486 break;
487 case 'a': /* auth protocol */ 487 case 'a': /* auth protocol */
488 authproto = optarg; 488 authproto = optarg;
489 break; 489 break;
490 case 'A': /* auth passwd */ 490 case 'A': /* auth passwd */
491 authpasswd = optarg; 491 authpasswd = optarg;
492 break; 492 break;
493 case 'X': /* priv passwd */ 493 case 'X': /* priv passwd */
494 privpasswd = optarg; 494 privpasswd = optarg;
495 break; 495 break;
496 case 't': /* timeout period */ 496 case 't': /* timeout period */
@@ -701,14 +701,14 @@ validate_arguments ()
701 701
702 702
703 703
704 if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */ 704 if (proto == NULL || (strcmp(proto,DEFAULT_PROTOCOL) == 0) ) { /* default protocol version */
705 asprintf(&proto, DEFAULT_PROTOCOL); 705 asprintf(&proto, DEFAULT_PROTOCOL);
706 asprintf(&authpriv, "%s%s", "-c ", community); 706 asprintf(&authpriv, "%s%s", "-c ", community);
707 } 707 }
708 else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */ 708 else if ( strcmp (proto, "2c") == 0 ) { /* snmpv2c args */
709 asprintf(&authpriv, "%s%s", "-c ", community); 709 asprintf(&authpriv, "%s%s", "-c ", community);
710 } 710 }
711 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */ 711 else if ( strcmp (proto, "3") == 0 ) { /* snmpv3 args */
712 asprintf(&proto, "%s", "3"); 712 asprintf(&proto, "%s", "3");
713 713
714 if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) { 714 if ( (strcmp(seclevel, "noAuthNoPriv") == 0) || seclevel == NULL ) {