[nagiosplug] Add -Le option to snmpcmd to avoid error message ...

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Sun Aug 18 19:10:15 CEST 2013


    Module: nagiosplug
    Branch: master
    Commit: 37cf5e3cd578851fe0bee6b1332f2e8688af64ab
    Author: Mark Keisler <grimm26 at gmail.com>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Thu Mar 14 10:59:58 2013 -0500
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=37cf5e3

Add -Le option to snmpcmd to avoid error message of 'No Log Handling Enabled...'

---

 plugins/check_snmp.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index 7c5d0ec..b79c020 100644
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
@@ -277,32 +277,33 @@ main (int argc, char **argv)
 	/* 9 arguments to pass before authpriv options + 1 for host and numoids. Add one for terminating NULL */
 	command_line = calloc (9 + numauthpriv + 1 + numoids + 1, sizeof (char *));
 	command_line[0] = snmpcmd;
-	command_line[1] = strdup ("-t");
-	xasprintf (&command_line[2], "%d", timeout_interval);
-	command_line[3] = strdup ("-r");
-	xasprintf (&command_line[4], "%d", retries);
-	command_line[5] = strdup ("-m");
-	command_line[6] = strdup (miblist);
-	command_line[7] = "-v";
-	command_line[8] = strdup (proto);
+	command_line[1] = strdup ("-Le");
+	command_line[2] = strdup ("-t");
+	xasprintf (&command_line[3], "%d", timeout_interval);
+	command_line[4] = strdup ("-r");
+	xasprintf (&command_line[5], "%d", retries);
+	command_line[6] = strdup ("-m");
+	command_line[7] = strdup (miblist);
+	command_line[8] = "-v";
+	command_line[9] = strdup (proto);
 
 	for (i = 0; i < numauthpriv; i++) {
-		command_line[9 + i] = authpriv[i];
+		command_line[10 + i] = authpriv[i];
 	}
 
-	xasprintf (&command_line[9 + numauthpriv], "%s:%s", server_address, port);
+	xasprintf (&command_line[10 + numauthpriv], "%s:%s", server_address, port);
 
 	/* This is just for display purposes, so it can remain a string */
-	xasprintf(&cl_hidden_auth, "%s -t %d -r %d -m %s -v %s %s %s:%s",
+	xasprintf(&cl_hidden_auth, "%s -Le -t %d -r %d -m %s -v %s %s %s:%s",
 		snmpcmd, timeout_interval, retries, strlen(miblist) ? miblist : "''", proto, "[authpriv]",
 		server_address, port);
 
 	for (i = 0; i < numoids; i++) {
-		command_line[9 + numauthpriv + 1 + i] = oids[i];
+		command_line[10 + numauthpriv + 1 + i] = oids[i];
 		xasprintf(&cl_hidden_auth, "%s %s", cl_hidden_auth, oids[i]);	
 	}
 
-	command_line[9 + numauthpriv + 1 + numoids] = NULL;
+	command_line[10 + numauthpriv + 1 + numoids] = NULL;
 
 	if (verbose)
 		printf ("%s\n", cl_hidden_auth);





More information about the Commits mailing list