summaryrefslogtreecommitdiffstats
path: root/plugins/check_snmp.c
diff options
context:
space:
mode:
authorSubhendu Ghosh <sghosh@users.sourceforge.net>2005-05-25 15:40:32 (GMT)
committerSubhendu Ghosh <sghosh@users.sourceforge.net>2005-05-25 15:40:32 (GMT)
commit11ad8930d139d387773e77fe6560ddb1dcaa6c7c (patch)
tree4cc20aa267497a8a5ce7db23ce378bc4547debd5 /plugins/check_snmp.c
parentafb0e811bfffdd999f06e0c4b33aba6455b53300 (diff)
downloadmonitoring-plugins-11ad8930d139d387773e77fe6560ddb1dcaa6c7c.tar.gz
support for getnext - 1106430
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1182 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_snmp.c')
-rw-r--r--plugins/check_snmp.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 5d65113..728d692 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -109,6 +109,7 @@ size_t labels_size = 8;
109size_t nunits = 0; 109size_t nunits = 0;
110size_t unitv_size = 8; 110size_t unitv_size = 8;
111int verbose = FALSE; 111int verbose = FALSE;
112int usesnmpgetnext = FALSE;
112unsigned long lower_warn_lim[MAX_OIDS]; 113unsigned long lower_warn_lim[MAX_OIDS];
113unsigned long upper_warn_lim[MAX_OIDS]; 114unsigned long upper_warn_lim[MAX_OIDS];
114unsigned long lower_crit_lim[MAX_OIDS]; 115unsigned long lower_crit_lim[MAX_OIDS];
@@ -165,11 +166,20 @@ main (int argc, char **argv)
165 usage4 (_("Could not parse arguments")); 166 usage4 (_("Could not parse arguments"));
166 167
167 /* create the command line to execute */ 168 /* create the command line to execute */
168 asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s", 169 if(usesnmpgetnext == TRUE) {
170 asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
171 PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
172 authpriv, server_address, port, oid);
173 }else{
174
175 asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
169 PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto, 176 PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
170 authpriv, server_address, port, oid); 177 authpriv, server_address, port, oid);
178 }
179
171 if (verbose) 180 if (verbose)
172 printf ("%s\n", command_line); 181 printf ("%s\n", command_line);
182
173 183
174 /* run the command */ 184 /* run the command */
175 child_process = spopen (command_line); 185 child_process = spopen (command_line);
@@ -391,6 +401,7 @@ process_arguments (int argc, char **argv)
391 {"authproto", required_argument, 0, 'a'}, 401 {"authproto", required_argument, 0, 'a'},
392 {"authpasswd", required_argument, 0, 'A'}, 402 {"authpasswd", required_argument, 0, 'A'},
393 {"privpasswd", required_argument, 0, 'X'}, 403 {"privpasswd", required_argument, 0, 'X'},
404 {"next", no_argument, 0, 'n'},
394 {0, 0, 0, 0} 405 {0, 0, 0, 0}
395 }; 406 };
396 407
@@ -408,7 +419,7 @@ process_arguments (int argc, char **argv)
408 } 419 }
409 420
410 while (1) { 421 while (1) {
411 c = getopt_long (argc, argv, "hvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:", 422 c = getopt_long (argc, argv, "nhvVt:c:w:H:C:o:e:E:d:D:s:t:R:r:l:u:p:m:P:L:U:a:A:X:",
412 longopts, &option); 423 longopts, &option);
413 424
414 if (c == -1 || c == EOF) 425 if (c == -1 || c == EOF)
@@ -440,6 +451,9 @@ process_arguments (int argc, char **argv)
440 case 'm': /* List of MIBS */ 451 case 'm': /* List of MIBS */
441 miblist = optarg; 452 miblist = optarg;
442 break; 453 break;
454 case 'n': /* usesnmpgetnext */
455 usesnmpgetnext = TRUE;
456 break;
443 case 'P': /* SNMP protocol version */ 457 case 'P': /* SNMP protocol version */
444 proto = optarg; 458 proto = optarg;
445 break; 459 break;
@@ -875,6 +889,8 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
875 889
876 /* SNMP and Authentication Protocol */ 890 /* SNMP and Authentication Protocol */
877 printf (_("\ 891 printf (_("\
892 -n, --next\n\
893 Use SNMP GETNEXT instead of SNMP GET\n\
878 -P, --protocol=[1|2c|3]\n\ 894 -P, --protocol=[1|2c|3]\n\
879 SNMP protocol version\n\ 895 SNMP protocol version\n\
880 -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\ 896 -L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\