[nagios-plugins] check_procs: Support cgroups / LXC (#1222)
eponymousalias at yahoo.com
Tue Jan 7 10:52:34 CET 2014
I'm not familiar with cgroups, but this sounds like a similar
problem we have with Solaris zones, wherein processes in non-global
zones show up in the global-zone listing of processes. To address
this, I have implemented a "-Z ZONELIST" or "--zonelist=ZONELIST"
filtering option ("-z", the natural option letter for this,
was already taken) to constrain the counted processes to those
in the list of named zones. ZONELIST is a comma-separated or
space-separated list of zone names. ".self" may be used as a
virtual zone name for the current zone. For simple operation
across platforms, "global" or ".self" may be used even on
platforms that do not support zones. I implemented this new
option in a manner that preserves backward compatibility with
the old existing behavior (count all visible processes, if no
-Z option is specified to filter the counted processes), even
though it's not clear that this behavior is really desired,
simply so as never to break any existing use of the plugin.
I wish to contribute this extension back to the community, but have
gotten stuck on how to make autoconf/automake stuff work correctly
in sensing the presence or absence of the <zone.h> file. (I want
the autoconf stuff to reliably define [or not] the HAVE_ZONE_H
symbol, depending on whether or not <zone.h> exists, and ensure
that this symbol is effectively propagated to all the Makefile.in
and Makefile files.) If I can get that to work, I'll post the
corrections back to this group, and I think that might serve as
a good basis for your similar request, if suitably generalized.
But my auto-fu is near nonexistent. Any help in this regard would
be appreciated. I asked here once before, but the simple advice
supplied didn't crack the case, and I failed to follow up.
As part of this work, I also fixed a few minor issues with
check_procs plugin output (treatment of newlines, and such).
That's a benefit of thoroughly testing my own changes.
On Mon, 1/6/14, Dominik Schulz <notifications at github.com> wrote:
Subject: [nagios-plugins] check_procs: Support cgroups / LXC (#1222)
To: "nagios-plugins/nagios-plugins" <nagios-plugins at noreply.github.com>
Date: Monday, January 6, 2014, 2:33 AM
The current implementation of
check_procs is nice and handy to make sure that a certain
number of processes is running, e.g. ntp. It does so,
however, in a way that is not suitable for systems running a
cgroup based virtualization (lxc, docker, ...).
On those systems all processes running in the child
containers will show up in the process list of the host and
thus the numbers reported by check_procs are inaccurate.
Please add a switch which will make check_procs obey the
cgroups visible in e.g. /proc//cgroup.
Reply to this email directly or view
it on GitHub.
More information about the Devel