[Nagiosplug-checkins] nagiosplug/plugins check_snmp.c,1.55,1.56

Subhendu Ghosh sghosh at users.sourceforge.net
Wed May 25 08:42:41 CEST 2005


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4599

Modified Files:
	check_snmp.c 
Log Message:
support for getnext - 1106430

Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- check_snmp.c	25 May 2005 03:23:19 -0000	1.55
+++ check_snmp.c	25 May 2005 15:40:32 -0000	1.56
@@ -109,6 +109,7 @@
 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 @@
 		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 @@
 		{"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 @@
 	}
 
 	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 @@
 		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 @@
 
 	/* 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\





More information about the Commits mailing list