Revision: 2163
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2163&view=rev
Author: dermoth
Date: 2009-03-16 07:12:15 +0000 (Mon, 16 Mar 2009)
Log Message:
-----------
check_snmp fixes:
- Fix broken compilation caused by typo in command ending
- Remove extra whitespaces at EOL
- Fix invalid host test on Ubuntu Hardy (and possibly others)
From: Thomas Guyot-Sionnest <[email protected]>
Modified Paths:
--------------
nagiosplug/trunk/plugins/check_snmp.c
nagiosplug/trunk/plugins/t/check_snmp.t
Modified: nagiosplug/trunk/plugins/check_snmp.c
===================================================================
--- nagiosplug/trunk/plugins/check_snmp.c 2009-03-14 02:38:13 UTC (rev 2162)
+++ nagiosplug/trunk/plugins/check_snmp.c 2009-03-16 07:12:15 UTC (rev 2163)
@@ -106,7 +106,7 @@
char *privproto = NULL;
char *authpasswd = NULL;
char *privpasswd = NULL;
-char **oids = NULL;
+char **oids = NULL;
char *label;
char *units;
char *port;
@@ -186,7 +186,7 @@
snmpcmd = strdup (PATH_TO_SNMPGETNEXT);
}else{
snmpcmd = strdup (PATH_TO_SNMPGET);
- }
+ }
/* 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 *));
@@ -224,10 +224,10 @@
/* Run the command */
return_code = cmd_run_array (command_line, &chld_out, &chld_err, 0);
- /* Due to net-snmp sometimes showing stderr messages with poorly formed MIBs,
+ /* Due to net-snmp sometimes showing stderr messages with poorly formed MIBs,
only return state unknown if return code is non zero or there is no stdout.
Do this way so that if there is stderr, will get added to output, which helps problem diagnosis
- /*
+ */
if (return_code != 0)
external_error=1;
if (chld_out.lines == 0)
@@ -252,7 +252,7 @@
for (i = 0; i < chld_out.lines; i++) {
ptr = chld_out.line[i];
- oidname = strpcpy (oidname, ptr, delimiter);
+ oidname = strpcpy (oidname, ptr, delimiter);
response = strstr (ptr, delimiter);
/* We strip out the datatype indicator for PHBs */
Modified: nagiosplug/trunk/plugins/t/check_snmp.t
===================================================================
--- nagiosplug/trunk/plugins/t/check_snmp.t 2009-03-14 02:38:13 UTC (rev 2162)
+++ nagiosplug/trunk/plugins/t/check_snmp.t 2009-03-16 07:12:15 UTC (rev 2163)
@@ -94,7 +94,7 @@
skip "no non invalid host defined", 2 if ( ! $hostname_invalid );
$res = NPTest->testCmd( "./check_snmp -H $hostname_invalid -C $snmp_community -o system.sysUpTime.0 -w 1: -c 1:");
cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" );
- like($res->output, '/External command error: .*nosuchhost/', "String matches invalid host");
+ like($res->output, '/External command error: .*(nosuchhost|Name or service not known)/', "String matches invalid host");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.