Bläddra i källkod

Merge branch 'master' of ssh://nagiosplug.git.sourceforge.net/gitroot/nagiosplug/nagiosplug

Matthias Eble 14 år sedan
förälder
incheckning
4c30935850

+ 3 - 8
Makefile.am

@@ -16,7 +16,7 @@ localedir = $(datadir)/locale
 DEFS = -DLOCALEDIR=\"$(localedir)\"
 
 dist-hook:
-	make THANKS nagios-plugins.spec pkg/fedora/nagios-plugins.spec
+	$(MAKE) THANKS
 	echo ${VERSION} >$(distdir)/release
 
 install-root:
@@ -28,13 +28,6 @@ test test-debug:
 	cd plugins && $(MAKE) $@
 	cd plugins-scripts && $(MAKE) $@
 
-nagios-plugins.spec: nagios-plugins.spec.in
-	sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;s/^%%{requires}$$//" $? > $@
-
-pkg/fedora/nagios-plugins.spec: nagios-plugins.spec.in
-	$(top_srcdir)/mkinstalldirs pkg/fedora
-	sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;/^# Requires$$/r $(top_srcdir)/pkg/fedora/requires" $? > $@
-
 # Solaris pkgmk
 BUILDDIR = build-solaris
 PACKDIR = build-pkg
@@ -45,7 +38,9 @@ solpkg:
 	if [ ! -d $(PACKDIR) ] ; then mkdir $(PACKDIR); fi
 	$(MAKE) all
 	$(MAKE) DESTDIR=$$PWD/$(BUILDDIR) install
+	$(INSTALL) plugins-root/pst3 $(BUILDDIR)$(libexecdir)
 	$(INSTALL) pkg/solaris/pkginfo $(BUILDDIR)
+	$(INSTALL) pkg/solaris/preinstall $(BUILDDIR)
 	cd $(BUILDDIR) && $(PERL) ../$(PKGSCRIPT) ../$(PACKDIR)
 
 THANKS: THANKS.in

+ 3 - 0
NEWS

@@ -8,6 +8,9 @@ This file documents the major additions and syntax changes between releases.
 	check_http now checks for and prints the certificate cn (hostname) in SSL certificate checks (Stéphane Urbanovski)
 	Add perfdata to check_ssh (#3244097 - Marco Beck)
 	New option to check_smtp to ignore failures when sending QUIT (#3358348 - Duncan Ferguson)
+	New check_by_ssh -F option which allows for specifying an alternative ssh_config(5) file (#2895334 - Sven Nierlein)
+	check_sensors now detects faulty sensors unless --ignore-fault is specified (Jan Wagner)
+	Updated Nagios::Plugin perl module
 
 	FIXES
 	Fix check_disk free space calculation if blocksizes differ within a disk group (Bekar - #2973603)

+ 4 - 1
configure.in

@@ -2,7 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.59)
 AC_INIT(nagios-plugins,1.4.15)
 AC_CONFIG_SRCDIR(NPTest.pm)
-AC_CONFIG_FILES(gl/Makefile)
+AC_CONFIG_FILES([gl/Makefile 
+	nagios-plugins.spec])
 AC_CONFIG_AUX_DIR(build-aux)
 AM_INIT_AUTOMAKE([1.8.3])
 AM_CONFIG_HEADER(config.h)
@@ -162,6 +163,8 @@ dnl
 dnl check for math-related functions needing -lm
 AC_CHECK_HEADERS(math.h)
 AC_CHECK_LIB(m,floor,MATHLIBS="-lm")
+AC_CHECK_HEADERS(mp.h)
+AC_CHECK_LIB(bsd,pow,MATHLIBS="$MATHLIBS -lbsd")
 AC_SUBST(MATHLIBS)
 
 dnl Check if we buils local libtap

+ 6 - 0
m4/np_mysqlclient.m4

@@ -42,6 +42,12 @@ AC_DEFUN([np_mysqlclient],
       fi
       np_mysql_libs="`$np_mysql_config --libs`"
       np_mysql_cflags="`$np_mysql_config --cflags`"
+      # On Solaris, cflags may contain -xstrconst, which is not acceptable to the
+      # gcc compiler. In this case, use the include flags as the cflags
+      echo $np_mysql_cflags | grep -- -xstrconst > /dev/null 2> /dev/null
+      if test $? -eq 0 -a "$CC" = "gcc" ; then
+        np_mysql_cflags="`$np_mysql_config --include`"
+      fi
 
       dnl Test a mysql_init. Some systems have mysql_config, but no headers
       _savedcppflags="$CPPFLAGS"

+ 132 - 14
nagios-plugins.spec.in

@@ -1,6 +1,23 @@
+# Macros
+%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0")
+%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0")
+%define isredhatfamily %(test -f /etc/redhat-release && echo "1" || echo "0")
+
+%if %{isaix}
+	%define _prefix /opt/nagios
+#	%define _defaultdocdir %{_datadir}/doc
+%else
+	%define _libexecdir %{_exec_prefix}/lib/nagios/plugins
+%endif
+%define _sysconfdir /etc/nagios
+
+%define npusr nagios
+%define nphome /opt/nagios
+%define npgrp nagios
+
 Name: nagios-plugins
-Version: %%{VERSION}
-Release: %%{RELEASE}
+Version: @PACKAGE_VERSION@
+Release: @RELEASE@
 Summary: Host/service/network monitoring program plugins for Nagios
 
 Group: Applications/System
@@ -9,7 +26,13 @@ URL: http://nagiosplug.sourceforge.net/
 Source0: http://dl.sf.net/sourceforge/nagiosplug/%{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+%define npdir %{_builddir}/%{name}-%{version}
+
+%if %{isaix}
+Prefix: %{_prefix}
+%else
 Prefix: %{_prefix}/lib/nagios/plugins
+%endif
 Packager: Karl DeBisschop <kdebisschop@users.sourceforge.net>
 Vendor: Nagios Plugin Development Group
 Provides: nagios-plugins
@@ -19,6 +42,60 @@ Obsoletes: nagios-plugins-custom nagios-plugins-extras
 
 
 # Requires
+%if %{isaix}
+Requires:	fping 
+Requires:	gawk
+Requires:	net-snmp 
+Requires:	net-snmp-perl 
+Requires:	net-snmp-utils
+Requires:	openldap
+Requires:	openssl
+Requires:	perl
+Requires:	python
+Requires:	openssl
+BuildRequires:	fping 
+BuildRequires:	gawk
+BuildRequires:	net-snmp 
+BuildRequires:	net-snmp-perl 
+BuildRequires:	net-snmp-utils
+BuildRequires:	openldap-devel
+%endif
+%if %{isredhatfamily}
+Requires:	bind-utils
+Requires:	coreutils
+Requires:	fping 
+Requires:	gawk
+Requires:	grep
+Requires:	iputils
+Requires:	mysql
+Requires:	net-snmp-utils
+Requires:	ntp
+Requires:	openldap
+Requires:	openssl
+Requires:	openssh-clients
+Requires:	perl
+Requires:	postgresql-libs
+Requires:	procps
+Requires:	python
+Requires:	samba-client
+Requires:	shadow-utils
+Requires:	traceroute
+Requires:	/usr/bin/mailq
+BuildRequires:	bind-utils
+BuildRequires:	coreutils
+BuildRequires:	iputils
+BuildRequires:	mysql-devel
+BuildRequires:	net-snmp-utils
+BuildRequires:	net-tools
+BuildRequires:	ntp
+BuildRequires:	openldap-devel
+BuildRequires:	openssh-clients
+BuildRequires:	openssl-devel
+BuildRequires:	postgresql-devel
+BuildRequires:	procps
+BuildRequires:	samba-client
+BuildRequires:	/usr/bin/mailq
+%endif
 
 
 %description
@@ -37,38 +114,79 @@ contains those plugins.
 
 
 %build
-./configure \
+%{?isaix: MAKE=gmake} ./configure \
 --prefix=%{_prefix} \
 --exec-prefix=%{_exec_prefix} \
---libexecdir=%{_exec_prefix}/lib/nagios/plugins \
---sysconfdir=%{_sysconfdir}/nagios \
+--libexecdir=%{_libexecdir} \
+--sysconfdir=%{_sysconfdir} \
 --datadir=%{_datadir} \
 --with-cgiurl=/nagios/cgi-bin
+ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-before
+ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-before
+ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-before
 make %{?_smp_mflags}
-
+ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-after
+ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-after
+ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-after
+
+%pre
+# Create `nagios' group on the system if necessary
+%if %{isaix}
+lsgroup %{npgrp} > /dev/null 2> /dev/null
+if [ $? -eq 2 ] ; then
+	mkgroup %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
+fi
+%endif
+%if %{islinux}
+getent group %{npgrp} > /dev/null 2> /dev/null
+if [ $? -ne 0 ] ; then
+	groupadd %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process.
+fi
+%endif
+
+# Create `nagios' user on the system if necessary
+%if %{isaix}
+lsuser %{npusr} > /dev/null 2> /dev/null
+if [ $? -eq 2 ] ; then
+	useradd -d %{nphome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
+		%nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
+fi
+%endif
+%if %{islinux}
+getent passwd %{npusr} > /dev/null 2> /dev/null
+if [ $? -ne 0 ] ; then
+	useradd -r -d %{nshome} -c "%{npusr}" -g %{npgrp} %{npusr} || \
+		%nnmmsg Unexpected error adding user "%{npusr}". Aborting install process.
+fi
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install
-install -d ${RPM_BUILD_ROOT}/etc/nagios
-install -m 664 command.cfg ${RPM_BUILD_ROOT}/etc/nagios
+build-aux/install-sh -c  -d ${RPM_BUILD_ROOT}%{_sysconfdir}
+build-aux/install-sh -c  -m 664 command.cfg ${RPM_BUILD_ROOT}%{_sysconfdir}
 %find_lang %{name}
-
+echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
+comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
+echo "%defattr(755,root,root)" >> %{name}.lang
+comm -13 %{npdir}/ls-plugins-root-before %{npdir}/ls-plugins-root-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
+echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang
+comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang
+echo "%{_libexecdir}/utils.pm" >> %{name}.lang
+echo "%{_libexecdir}/utils.sh" >> %{name}.lang
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 
 %files -f %{name}.lang
-%defattr(-,root,root)
-%config(missingok,noreplace) /etc/nagios/command.cfg
+%config(missingok,noreplace) %{_sysconfdir}/command.cfg
 %doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
 %doc ChangeLog command.cfg
-%defattr(775,root,root)
-%dir %{_exec_prefix}/lib/nagios/plugins
+%if ! %{isaix}
 %{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
 %{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
-%{_exec_prefix}/lib/nagios/plugins
+%endif
 
 %changelog
 * Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head

BIN
perlmods/Nagios-Plugin-0.34.tar.gz


BIN
perlmods/Nagios-Plugin-0.36.tar.gz


+ 1 - 1
pkg/solaris/pkginfo.in

@@ -1,4 +1,4 @@
-PKG="NAGplugin"
+PKG="NGOSplugin"
 NAME="nagios-plugins"
 DESC="Nagios network monitoring plugins"
 ARCH="@PKG_ARCH@"

+ 35 - 0
pkg/solaris/preinstall

@@ -0,0 +1,35 @@
+#!/usr/bin/sh
+
+user="nagios"
+uid=-1
+group="nagios"
+gid=-1
+
+/usr/bin/getent group $group > /dev/null 2> /dev/null
+result=$?
+if [ $result -eq 2 ] ; then
+	echo "Group $group does not exist. Creating..."
+	if [ $gid -ne -1 ] ; then
+		/usr/sbin/groupadd -g $gid $group
+	else
+		/usr/sbin/groupadd $group
+	fi
+elif [ $result -ne 0 ] ; then
+	echo "An error occurred determining the existence of the groug $group. Terminating."
+	exit 1;
+fi
+
+/usr/bin/getent passwd $user > /dev/null 2> /dev/null
+result=$?
+if [ $result -eq 2 ] ; then
+	echo "User $user does not exist. Creating..."
+	if [ $uid -ne -1 ] ; then
+		/usr/sbin/useradd -u $uid -g $group $user
+	else
+		/usr/sbin/useradd -g $group $user
+	fi
+elif [ $result -ne 0 ] ; then
+	echo "An error occurred determining the existence of the user $user. Terminating."
+	exit 1;
+fi
+

+ 12 - 3
pkg/solaris/solpkg

@@ -8,6 +8,7 @@ $pkgmk = "/usr/bin/pkgmk";
 $pkgtrans = "/usr/bin/pkgtrans";
 $prototype = "prototype";
 $pkginfo = "pkginfo";
+$preinstall = "preinstall";
 $egrep = "/usr/bin/egrep";
 
 # Sanity check
@@ -24,17 +25,24 @@ open (PREPROTO,"$find . -print |$egrep -v \"^\.(/usr(/local)?|/opt)?\$\" | $pkgp
 open (PROTO,">$prototype") ||
 	die "Unable to write file prototype ($!)\n";
 print PROTO "i pkginfo=./$pkginfo\n";
+print PROTO "i preinstall=./$preinstall\n";
 while (<PREPROTO>) {
 	# Read in the prototype information
 	chomp;
 	$thisline = $_;
 	if ($thisline =~ " prototype "
-	  or $thisline =~ " pkginfo ") {
+	  or $thisline =~ " pkginfo "
+	  or $thisline =~ " preinstall ") {
 	    # Don't do anything as they aren't important
+	} elsif ($thisline =~ "pst3") {
+		# Needs to be installed SUID root
+	  ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
+	  print PROTO "$dir $none $file 4755 root bin\n";
+		
 	} elsif ($thisline =~ "^[fd] ") {
 	  # Change the ownership of files and directories
 	  ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline;
-	  print PROTO "$dir $none $file $mode bin bin\n";
+	  print PROTO "$dir $none $file $mode $user bin\n";
 	} else {
 	  # Symlinks and other stuff should be printed also
 	  print PROTO "$thisline\n";
@@ -58,6 +66,7 @@ while (<PKGINFO>) {
 	$thisline = $_;
 	($var,$value) = split /=/,$thisline;
 	if ("$var" eq "NAME" 
+	  or "$var" eq "PKG"
 	  or "$var" eq "VERSION"
 	  or "$var" eq "ARCH") {
 		$tmp = lc($var);
@@ -77,5 +86,5 @@ $packagename = "$name-$version-$os-$arch-local";
 
 print "Building package\n";
 system ("$pkgmk -o -r `pwd` -d $pkgdevice");
-system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename)");
+system ("(cd $pkgdevice && $pkgtrans -s `pwd` ../$packagename $pkg)");
 print "Done. ($packagename)\n";

+ 17 - 14
plugins-scripts/check_sensors.sh

@@ -10,7 +10,7 @@ REVISION="@NP_VERSION@"
 
 
 print_usage() {
-	echo "Usage: $PROGNAME"
+	echo "Usage: $PROGNAME" [--ignore-fault]
 }
 
 print_help() {
@@ -21,25 +21,25 @@ print_help() {
 	echo "This plugin checks hardware status using the lm_sensors package."
 	echo ""
 	support
-	exit 0
+	exit $STATE_OK
 }
 
 case "$1" in
 	--help)
 		print_help
-		exit 0
+		exit $STATE_OK
 		;;
 	-h)
 		print_help
-		exit 0
+		exit $STATE_OK
 		;;
 	--version)
-   	print_revision $PROGNAME $REVISION
-		exit 0
+		print_revision $PROGNAME $REVISION
+		exit $STATE_OK
 		;;
 	-V)
 		print_revision $PROGNAME $REVISION
-		exit 0
+		exit $STATE_OK
 		;;
 	*)
 		sensordata=`sensors 2>&1`
@@ -49,17 +49,20 @@ case "$1" in
 		fi
 		if test ${status} -eq 127; then
 			echo "SENSORS UNKNOWN - command not found (did you install lmsensors?)"
-			exit -1
-		elif test ${status} -ne 0 ; then
+			exit $STATE_UNKNOWN
+		elif test ${status} -ne 0; then
 			echo "WARNING - sensors returned state $status"
-			exit 1
+			exit $STATE_WARNING
 		fi
 		if echo ${sensordata} | egrep ALARM > /dev/null; then
 			echo SENSOR CRITICAL - Sensor alarm detected!
-			exit 2
-		else
-			echo sensor ok
-			exit 0
+			exit $STATE_CRITICAL
+		elif echo ${sensordata} | egrep FAULT > /dev/null \
+		    && test "$1" != "-i" -a "$1" != "--ignore-fault"; then
+			echo SENSOR UNKNOWN - Sensor reported fault
+			exit $STATE_UNKNOWN
 		fi
+		echo sensor ok
+		exit $STATE_OK
 		;;
 esac

+ 9 - 2
plugins/check_by_ssh.c

@@ -187,6 +187,7 @@ process_arguments (int argc, char **argv)
 		{"use-ipv6", no_argument, 0, '6'},
 		{"ssh-option", required_argument, 0, 'o'},
 		{"quiet", no_argument, 0, 'q'},
+		{"configfile", optional_argument, 0, 'F'},
 		{0, 0, 0, 0}
 	};
 
@@ -198,7 +199,7 @@ process_arguments (int argc, char **argv)
 			strcpy (argv[c], "-t");
 
 	while (1) {
-		c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:", longopts,
+		c = getopt_long (argc, argv, "Vvh1246fqt:H:O:p:i:u:l:C:S::E::n:s:o:F:", longopts,
 		                 &option);
 
 		if (c == -1 || c == EOF)
@@ -306,6 +307,10 @@ process_arguments (int argc, char **argv)
 		case 'q':									/* Tell the ssh command to be quiet */
 			comm_append("-q");
 			break;
+		case 'F': 									/* ssh configfile */
+			comm_append("-F");
+			comm_append(optarg);
+			break;
 		default:									/* help */
 			usage5();
 		}
@@ -418,6 +423,8 @@ print_help (void)
   printf ("    %s\n", _("short name of host in nagios configuration [optional]"));
   printf (" %s\n","-o, --ssh-option=OPTION");
   printf ("    %s\n", _("Call ssh with '-o OPTION' (may be used multiple times) [optional]"));
+  printf (" %s\n","-F, --configfile");
+  printf ("    %s\n", _("Tell ssh to use this configfile [optional]"));
   printf (" %s\n","-q, --quiet");
   printf ("    %s\n", _("Tell ssh to suppress warning and diagnostic messages [optional]"));
 	printf (UT_WARN_CRIT);
@@ -454,6 +461,6 @@ print_usage (void)
 	printf (" %s -H <host> -C <command> [-fqv] [-1|-2] [-4|-6]\n"
 	        "       [-S [lines]] [-E [lines]] [-t timeout] [-i identity]\n"
 	        "       [-l user] [-n name] [-s servicelist] [-O outputfile]\n"
-	        "       [-p port] [-o ssh-option]\n",
+	        "       [-p port] [-o ssh-option] [-F configfile]\n",
 	        progname);
 }

+ 4 - 0
plugins/check_http.c

@@ -1400,6 +1400,10 @@ print_help (void)
   printf (" %s\n", _("serve content (optionally within a specified time) or whether the X509 "));
   printf (" %s\n", _("certificate is still valid for the specified number of days."));
   printf ("\n");
+  printf (" %s\n", _("Please note that this plugin does not check if the presented server"));
+  printf (" %s\n", _("certificate matches the hostname of the server, or if the certificate"));
+  printf (" %s\n", _("has a valid chain of trust to one of the locally installed CAs."));
+  printf ("\n");
   printf ("%s\n", _("Examples:"));
   printf (" %s\n\n", "CHECK CONTENT: check_http -w 5 -c 10 --ssl -H www.verisign.com");
   printf (" %s\n", _("When the 'www.verisign.com' server returns its content within 5 seconds,"));

+ 1 - 1
plugins/check_radius.c

@@ -211,7 +211,7 @@ main (int argc, char **argv)
 	if (result == OK_RC)
 		die (STATE_OK, _("Auth OK"));
 	(void)snprintf(msg, sizeof(msg), _("Unexpected result code %d"), result);
-	die (STATE_UNKNOWN, msg);
+	die (STATE_UNKNOWN, "%s", msg);
 }
 
 

+ 10 - 10
plugins/check_snmp.c

@@ -740,7 +740,7 @@ process_arguments (int argc, char **argv)
 			labels[nlabels - 1] = optarg;
 			ptr = thisarg (optarg);
 			labels[nlabels - 1] = ptr;
-			if (strstr (ptr, "'") == ptr)
+			if (ptr[0] == '\'')
 				labels[nlabels - 1] = ptr + 1;
 			while (ptr && (ptr = nextarg (ptr))) {
 				if (nlabels >= labels_size) {
@@ -749,9 +749,9 @@ process_arguments (int argc, char **argv)
 					if (labels == NULL)
 						die (STATE_UNKNOWN, _("Could not reallocate labels\n"));
 				}
-				labels++;
+				nlabels++;
 				ptr = thisarg (ptr);
-				if (strstr (ptr, "'") == ptr)
+				if (ptr[0] == '\'')
 					labels[nlabels - 1] = ptr + 1;
 				else
 					labels[nlabels - 1] = ptr;
@@ -769,7 +769,7 @@ process_arguments (int argc, char **argv)
 			unitv[nunits - 1] = optarg;
 			ptr = thisarg (optarg);
 			unitv[nunits - 1] = ptr;
-			if (strstr (ptr, "'") == ptr)
+			if (ptr[0] == '\'')
 				unitv[nunits - 1] = ptr + 1;
 			while (ptr && (ptr = nextarg (ptr))) {
 				if (nunits >= unitv_size) {
@@ -780,7 +780,7 @@ process_arguments (int argc, char **argv)
 				}
 				nunits++;
 				ptr = thisarg (ptr);
-				if (strstr (ptr, "'") == ptr)
+				if (ptr[0] == '\'')
 					unitv[nunits - 1] = ptr + 1;
 				else
 					unitv[nunits - 1] = ptr;
@@ -935,7 +935,7 @@ char *
 thisarg (char *str)
 {
 	str += strspn (str, " \t\r\n");	/* trim any leading whitespace */
-	if (strstr (str, "'") == str) {	/* handle SIMPLE quoted strings */
+	if (str[0] == '\'') {	/* handle SIMPLE quoted strings */
 		if (strlen (str) == 1 || !strstr (str + 1, "'"))
 			die (STATE_UNKNOWN, _("Unbalanced quotes\n"));
 	}
@@ -951,7 +951,7 @@ thisarg (char *str)
 char *
 nextarg (char *str)
 {
-	if (strstr (str, "'") == str) {
+	if (str[0] == '\'') {
 		str[0] = 0;
 		if (strlen (str) > 1) {
 			str = strstr (str + 1, "'");
@@ -961,7 +961,7 @@ nextarg (char *str)
 			return NULL;
 		}
 	}
-	if (strstr (str, ",") == str) {
+	if (str[0] == ',') {
 		str[0] = 0;
 		if (strlen (str) > 1) {
 			return (++str);
@@ -1072,8 +1072,8 @@ print_help (void)
 
 	printf ("\n");
 	printf ("%s\n", _("Notes:"));
-	printf (" %s\n", _("- Multiple OIDs may be indicated by a comma or space-delimited list (lists with"));
-	printf ("   %s %i %s\n", _("internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
+	printf (" %s\n", _("- Multiple OIDs (and labels) may be indicated by a comma or space-delimited  "));
+	printf ("   %s %i %s\n", _("list (lists with internal spaces must be quoted). Maximum:"), MAX_OIDS, _("OIDs."));
 
 	printf(" -%s", UT_THRESHOLDS_NOTES);
 

+ 6 - 0
plugins/common.h

@@ -59,6 +59,12 @@
 #include <math.h>
 #endif
 
+#ifdef _AIX
+#ifdef HAVE_MP_H
+#include <mp.h>
+#endif
+#endif
+
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif

+ 12 - 1
plugins/t/check_by_ssh.t

@@ -17,9 +17,14 @@ my $ssh_key = getTestParameter( "NP_SSH_IDENTITY",
     "A key allowing access to NP_SSH_HOST",
     "~/.ssh/id_dsa");
 
+my $ssh_conf = getTestParameter( "NP_SSH_CONFIGFILE",
+    "A config file with ssh settings",
+    "~/.ssh/config");
+
+
 plan skip_all => "SSH_HOST and SSH_IDENTITY must be defined" unless ($ssh_service && $ssh_key);
 
-plan tests => 40;
+plan tests => 42;
 
 # Some random check strings/response
 my @responce = ('OK: Everything is fine!',
@@ -85,6 +90,12 @@ $result = NPTest->testCmd(
 cmp_ok($result->return_code, '==', 8, "Exit with return code 8 (out of bounds)");
 is($result->output, $responce[4], "Return proper status text even with unknown status codes");
 
+$result = NPTest->testCmd(
+	"./check_by_ssh -i $ssh_key -H $ssh_service -F $ssh_conf -C 'exit 0'"
+	);
+cmp_ok($result->return_code, '==', 0, "Exit with return code 0 (OK)");
+is($result->output, 'OK - check_by_ssh: Remote command \'exit 0\' returned status 0', "Status text if command returned none (OK)");
+
 # Multiple active checks
 $result = NPTest->testCmd(
 	"./check_by_ssh -i $ssh_key -H $ssh_service -C '$check[1]; sh -c exit\\ 1'  -C '$check[0]; sh -c exit\\ 0' -C '$check[3]; sh -c exit\\ 3' -C '$check[2]; sh -c exit\\ 2'"

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 192 - 200
po/nagios-plugins.pot


Vissa filer visades inte eftersom för många filer har ändrats