<feed xmlns='http://www.w3.org/2005/Atom'>
<title>monitoring-plugins/plugins/t/check_procs.t, branch 3.0.0-rc3</title>
<subtitle>Monitoring Plugins
</subtitle>
<id>https://www.monitoring-plugins.org/repositories/monitoring-plugins/atom?h=3.0.0-rc3</id>
<link rel='self' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/atom?h=3.0.0-rc3'/>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/'/>
<updated>2014-07-10T19:10:48Z</updated>
<entry>
<title>check_procs: Add delay after forking in test</title>
<updated>2014-07-10T19:10:48Z</updated>
<author>
<name>Mikael Falkvidd</name>
<email>mfalkvidd@op5.com</email>
</author>
<published>2014-07-10T12:25:23Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=f54d10fe9ba202415c2001b1ec7c6eb4697c3d10'/>
<id>urn:sha1:f54d10fe9ba202415c2001b1ec7c6eb4697c3d10</id>
<content type='text'>
Forking raises a race condition, where the parent might run the
test before the child has had time to fork. If that happens,
an error similar to this is produced:
 Failed test 'Output correct'
 at ./t/check_procs.t line 32.
                 'PROCS OK: 0 processes with args 'sleep 7' | processes=0;;;0;'
   doesn't match '/^PROCS OK: 1 process?/'

Sleeping a bit should avoid the problem. It might be enough to
sleep less than a second, but perl's built-in sleep function only
supports integer seconds.

In our build environment, the build failed 3 of 4 times before
this patch. After the patch it failed 0 of 7 times.

Signed-off-by: Mikael Falkvidd &lt;mfalkvidd@op5.com&gt;
</content>
</entry>
<entry>
<title>make testing check_proc not rely on bash</title>
<updated>2013-11-20T20:42:25Z</updated>
<author>
<name>Sven Nierlein</name>
<email>Sven.Nierlein@consol.de</email>
</author>
<published>2013-11-20T20:42:25Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=4ab4c8dd3243c0cedcfcde7d082d24efe7ffc438'/>
<id>urn:sha1:4ab4c8dd3243c0cedcfcde7d082d24efe7ffc438</id>
<content type='text'>
also grandparents make this test fail but is not a problem in real live.
NPTest-&gt;testCmd uses "sh -c" already, so there is no need to do that twice.
</content>
</entry>
<entry>
<title>check_procs: ignore plugin parent process</title>
<updated>2013-11-19T22:57:27Z</updated>
<author>
<name>Anton Lofgren</name>
<email>alofgren@op5.com</email>
</author>
<published>2013-10-18T09:42:46Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=77fc3548ae1be360584082d771fa01696d4f4479'/>
<id>urn:sha1:77fc3548ae1be360584082d771fa01696d4f4479</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>check_procs: fix test with sleeping processes</title>
<updated>2013-09-16T11:49:44Z</updated>
<author>
<name>Sven Nierlein</name>
<email>Sven.Nierlein@consol.de</email>
</author>
<published>2013-09-16T11:39:47Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=adc9d71b4b2c622b26e6403b16f8299a280dab54'/>
<id>urn:sha1:adc9d71b4b2c622b26e6403b16f8299a280dab54</id>
<content type='text'>
at least on freebsd, there are a processes with state 'S', they always
use two character status.
</content>
</entry>
<entry>
<title>plugins/t/check_procs.t: Expect performance data</title>
<updated>2013-08-17T19:59:45Z</updated>
<author>
<name>Holger Weiss</name>
<email>holger@zedat.fu-berlin.de</email>
</author>
<published>2013-08-17T19:59:45Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=4a3901ec70dc4ba0049f24d213b7f07e931d3dda'/>
<id>urn:sha1:4a3901ec70dc4ba0049f24d213b7f07e931d3dda</id>
<content type='text'>
The check_procs plugin now emits performance data, fix the test(s)
accordingly.
</content>
</entry>
<entry>
<title>Check for existence of pre-instaleld pst3 for Solaris tests in t/check_procs.t</title>
<updated>2009-03-17T06:56:26Z</updated>
<author>
<name>Thomas Guyot-Sionnest</name>
<email>dermoth@solaris.beaubien.net</email>
</author>
<published>2009-03-17T06:56:26Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=9a05e9789017c03d192238c0337bc019838c52d4'/>
<id>urn:sha1:9a05e9789017c03d192238c0337bc019838c52d4</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Removing CVS/SVN tags and replacing with git-based versioning</title>
<updated>2008-11-23T05:38:47Z</updated>
<author>
<name>Thomas Guyot-Sionnest</name>
<email>dermoth@users.sourceforge.net</email>
</author>
<published>2008-11-23T05:38:47Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=6fbd14fea5c111a23d9074d25499991cbfa58f79'/>
<id>urn:sha1:6fbd14fea5c111a23d9074d25499991cbfa58f79</id>
<content type='text'>
For contrib/, full tags have been imported from subversion


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
</content>
</entry>
<entry>
<title>Reverted check_procs for solaris back to using pst3 due to truncation</title>
<updated>2008-02-28T16:21:59Z</updated>
<author>
<name>Ton Voon</name>
<email>tonvoon@users.sourceforge.net</email>
</author>
<published>2008-02-28T16:21:59Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=9f3d864fd3e47d4e728b196b1b6948a8a5e47e4e'/>
<id>urn:sha1:9f3d864fd3e47d4e728b196b1b6948a8a5e47e4e</id>
<content type='text'>
for argument fields using other methods


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1937 f882894a-f735-0410-b71e-b25c423dba1c
</content>
</entry>
<entry>
<title>Invalid mount point doesn't make sense because most df implementations</title>
<updated>2005-11-03T15:13:13Z</updated>
<author>
<name>Ton Voon</name>
<email>tonvoon@users.sourceforge.net</email>
</author>
<published>2005-11-03T15:13:13Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=595b2571a417fd2216071e80979fbe20e5cf1d4f'/>
<id>urn:sha1:595b2571a417fd2216071e80979fbe20e5cf1d4f</id>
<content type='text'>
would work out the actual mount point. And fixed typo in check_procs.t


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1271 f882894a-f735-0410-b71e-b25c423dba1c
</content>
</entry>
<entry>
<title>Support for Tru64 for check_procs + additional test cases</title>
<updated>2005-09-20T11:34:34Z</updated>
<author>
<name>Ton Voon</name>
<email>tonvoon@users.sourceforge.net</email>
</author>
<published>2005-09-20T11:34:34Z</published>
<link rel='alternate' type='text/html' href='https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=571e8e5af47c727189798c43095fd903331bc639'/>
<id>urn:sha1:571e8e5af47c727189798c43095fd903331bc639</id>
<content type='text'>
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1231 f882894a-f735-0410-b71e-b25c423dba1c
</content>
</entry>
</feed>
