Monitoring Plugins standards
Find a file
Anton Lofgren 77fc3548ae check_procs: ignore plugin parent process
This fixes an issue that appears when running check_procs over NRPE,
where the default shell is configured to (for example) dash, as is the
case on Debian.

dash (and tcsh, and mksh, and probably others), when invoked with -c forks an additional process
to execute the argument string. Contrast this with bash, which does not
do this, provided that the argument string simply can be exec()'d as-is.

To demonstrate:
$ bash -c pstree
init─┬ ..
    ...
	├─sshd─-─sshd───pstree

versus
$ dash -c pstree
init─┬ ..
    ...
	├─sshd─-─sshd───dash───pstree

The consequence of this fork is that the following invocation:
    /opt/plugins/check_procs -a init

will result in this output:

    PROCS OK: 2 processes with args 'init' | processes=2;;;0;

because the check_procs, in addition to finding the actual init process,
finds its parent shell as well.

This example is a bit contrived, but I think it illustrates the
point.

This wouldn't really be a problem, and normally isn't, if it weren't
for the fact that NRPE uses a call to popen() which does exactly the
above (executes '/bin/sh -c ...'), causing inconsistent behaviour
between distributions and much confusion for end users.

The argument may be made that the dash process spawned by NRPE is just a
process like any other, and should therefore be included in the process
count just like any other. However, this is not very intuitive, because
of the previously mentioned inconsistencies.

The argument might also well be made that we're _never_ interested in the
immediate ancestor of the plugin, and while it is unknown how many
installations have already made the necessary modifications to their
setups to make up for the fact that the plugin behaves the way it does,
it is not deemed worthwhile to entertain such workarounds.

Thus, this patch ignores the parent process.

See also these bug reports:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626913
http://sourceforge.net/p/nagiosplug/bugs/512/
https://github.com/nagios-plugins/nagios-plugins/issues/999
https://bugs.op5.com/view.php?id=4398
2013-11-19 23:57:27 +01:00
build-aux Update bundled libtool files 2013-09-05 00:03:00 +02:00
config_test Ficing C++ style comments 2007-03-08 06:12:36 +00:00
doc developer-guidelines.sgml: Fix URL 2013-10-28 16:48:48 +01:00
gl Update bundled libtool files 2013-09-05 00:03:00 +02:00
lib Minor cosmetic changes 2013-09-12 21:50:18 +02:00
m4 Fixed issue for compiling mysql plugin on Solaris 2011-12-16 10:18:41 -06:00
perlmods Merge branch 'hw/update-pm' 2013-08-30 18:15:00 +02:00
pkg Added pst3 to Solaris package. 2012-01-20 06:49:49 -06:00
plugins check_procs: ignore plugin parent process 2013-11-19 23:57:27 +01:00
plugins-root check_dhcp: fix mac address and interface number detection on solaris 2013-09-17 19:56:55 +02:00
plugins-scripts check_disk_smb: fixed number of tests to skip 2013-09-17 10:23:08 +02:00
po changed obsolete automake macro 2013-08-20 15:40:52 +02:00
tap Clean up last commit - remove the __STDC_VERSION__ check in tap.h 2009-01-15 01:03:00 -05:00
tools tools: Update CVS references 2013-10-02 09:54:15 +02:00
.gitignore Add tools/generate-change-log 2013-09-28 00:58:02 +02:00
ABOUT-NLS Updating gettext files from coreutils-6.9. mkinstalldirs needs to be in 2007-05-12 00:49:26 +00:00
acinclude.m4 Removing CVS/SVN tags and replacing with git-based versioning 2008-11-23 05:38:47 +00:00
ACKNOWLEDGEMENTS Fix typos. 2007-01-27 16:56:33 +00:00
AUTHORS AUTHORS: Tiny cosmetic change 2013-09-30 11:04:04 +02:00
autogen.sh Removing CVS/SVN tags and replacing with git-based versioning 2008-11-23 05:38:47 +00:00
CODING Added perl coding guidelines, from Programming Perl book (Andreas Ericsson) 2004-11-19 15:58:00 +00:00
config.rpath make dist failing without config.rpath in top level. File copied 2007-01-30 09:56:47 +00:00
configure.in Prepare for the 1.5 release 2013-10-02 17:21:01 +02:00
COPYING Update the COPYING file to the GPLv3 2010-07-27 23:06:23 +02:00
FAQ FAQ: Update CVS references 2013-10-02 10:55:44 +02:00
LEGAL Initial revision 2002-02-28 06:42:51 +00:00
Makefile.am Add tools/generate-change-log 2013-09-28 00:58:02 +02:00
mkinstalldirs Adding more required files from gettext 2006-05-19 21:30:59 +00:00
nagios-plugins.spec.in Updated to support compiling and building RPM on AIX. 2012-04-06 10:18:47 -05:00
NEWS NEWS: Mention "contrib" removal 2013-10-03 03:20:51 +02:00
NP-VERSION-GEN Prepare for the 1.5 release 2013-10-02 17:21:01 +02:00
NPTest.pm tests: only write cache file if it changed 2013-09-18 11:03:00 +02:00
opttest.pl Initial revision 2002-02-28 06:42:51 +00:00
README README: Update URLs 2013-10-02 01:40:50 +02:00
README.md Add symlink: README.md -> README 2013-09-20 17:00:40 +02:00
REQUIREMENTS Apply my patch from: 2013-01-24 08:56:19 +01:00
ROADMAP some minor fixes 2004-12-03 17:48:53 +00:00
SUPPORT SUPPORT: Update CVS/SourceForge references 2013-10-02 01:37:21 +02:00
test.pl.in no need to set verbose mode, thats what "make test-debug" is for 2013-08-21 17:23:22 +02:00
THANKS.in Update THANKS file 2013-09-30 11:04:38 +02:00

Nagios Plugins

  • For instructions on installing these plugins for use with Nagios, see below. In addition, generic instructions for the GNU toolchain can be found in the INSTALL file.

  • For major changes between releases, read the NEWS file.

  • For information on detailed changes that have been made or plugins that have been added, read the ChangeLog file.

  • Some plugins require that you have additional programs and/or libraries installed on your system before they can be used. Plugins that are dependent on other programs/libraries that are missing are usually not compiled. Read the REQUIREMENTS file for more information.

  • Individual plugins are self-documenting. All plugins that comply with the basic guidelines for development will provide detailed help when invoked with the -h or --help options.

You can check for the latest plugins at:

Send an email to nagiosplug-help@lists.sourceforge.net for assistance. Please include the OS type and version that you are using. Also, run the plugin with the -vvv option and provide the resulting version information. Of course, there may be additional diagnostic information required as well. Use good judgment.

Send an email to nagiosplug-devel@lists.sourceforge.net for developer discussions.

For patch submissions and bug reports, please use the appropriate resources at https://github.com/nagios-plugins/nagios-plugins.

Installation Instructions

  1. If you are using the Git tree, you will need m4, gettext, automake, and autoconf. To start out, run:

    ./tools/setup
    

    For more detail, see the developer guidelines at https://www.nagios-plugins.org/doc/guidelines.html.

  2. Run the configure script to initialize variables and create a Makefile, etc.

    ./configure --prefix=BASEDIRECTORY --with-cgiurl=SOMEURL
    

    Replace BASEDIRECTORY with the path of the directory under which Nagios is installed (default is /usr/local/nagios), and replace SOMEURL with the path used to access the Nagios CGIs with a web browser (default is /nagios/cgi-bin).

  3. Compile the plugins with the following command:

    make
    
  4. Install the compiled plugins and plugin scripts with the following command:

    make install
    

    The installation procedure will attempt to place the plugins in a libexec/ subdirectory in the base directory you specified with the --prefix argument to the configure script.

  5. There are some plugins that require setuid. If you run make install as a non-root user, they will not be installed. To install, switch to root and run:

    make install-root
    

That's it! If you have any problems or questions, feel free to send an email to nagiosplug-help@lists.sourceforge.net.

License Stuff

This software is released under the GNU General Public License, Version 3, with the additional exemption that compiling, linking and/or using OpenSSL is allowed.

See the COPYING file for the complete GPLv3 text.