aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Subhendu Ghosh <sghosh@users.sourceforge.net> 2005-05-25 15:40:32 +0000
committerGravatar Subhendu Ghosh <sghosh@users.sourceforge.net> 2005-05-25 15:40:32 +0000
commit11ad8930d139d387773e77fe6560ddb1dcaa6c7c (patch)
tree4cc20aa267497a8a5ce7db23ce378bc4547debd5 /plugins
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')
-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 5d65113f..728d692a 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -109,6 +109,7 @@ size_t labels_size = 8;
size_t nunits = 0;
size_t unitv_size = 8;
int verbose = FALSE;
+int usesnmpgetnext = FALSE;
unsigned long lower_warn_lim[MAX_OIDS];
unsigned long upper_warn_lim[MAX_OIDS];
unsigned long lower_crit_lim[MAX_OIDS];
@@ -165,11 +166,20 @@ main (int argc, char **argv)
usage4 (_("Could not parse arguments"));
/* create the command line to execute */
- asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
+ if(usesnmpgetnext == TRUE) {
+ asprintf(&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
+ PATH_TO_SNMPGETNEXT, timeout_interval, retries, miblist, proto,
+ authpriv, server_address, port, oid);
+ }else{
+
+ asprintf (&command_line, "%s -t %d -r %d -m %s -v %s %s %s:%s %s",
PATH_TO_SNMPGET, timeout_interval, retries, miblist, proto,
authpriv, server_address, port, oid);
+ }
+
if (verbose)
printf ("%s\n", command_line);
+
/* run the command */
child_process = spopen (command_line);
@@ -391,6 +401,7 @@ process_arguments (int argc, char **argv)
{"authproto", required_argument, 0, 'a'},
{"authpasswd", required_argument, 0, 'A'},
{"privpasswd", required_argument, 0, 'X'},
+ {"next", no_argument, 0, 'n'},
{0, 0, 0, 0}
};
@@ -408,7 +419,7 @@ process_arguments (int argc, char **argv)
}
while (1) {
- 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:",
+ 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:",
longopts, &option);
if (c == -1 || c == EOF)
@@ -440,6 +451,9 @@ process_arguments (int argc, char **argv)
case 'm': /* List of MIBS */
miblist = optarg;
break;
+ case 'n': /* usesnmpgetnext */
+ usesnmpgetnext = TRUE;
+ break;
case 'P': /* SNMP protocol version */
proto = optarg;
break;
@@ -875,6 +889,8 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
/* SNMP and Authentication Protocol */
printf (_("\
+ -n, --next\n\
+ Use SNMP GETNEXT instead of SNMP GET\n\
-P, --protocol=[1|2c|3]\n\
SNMP protocol version\n\
-L, --seclevel=[noAuthNoPriv|authNoPriv|authPriv]\n\