[Nagiosplug-devel] Status flags supported by check_procs

Jochen Bern Jochen.Bern at LINworks.de
Tue Mar 19 14:00:05 CET 2013


On 19.03.2013 13:04, Mauro wrote:
> Note that I asked for a command line option, not a compile one, but I
> understand this could not be feasible.

I can't speak for the maintainers, but seeing that the necessary
adaptations to the OS-provided "ps" include the command, a format string
to parse the output, *and* a list of *internal variables to parse into*,
I'ld say that an execution-time override would be difficult to use at
best, and likely quite difficult to implement ...

> [root at nagios nagios-plugins-1.4.16]# grep -A 1 -B 1 '[^A-Z_]PS_' config.h
> /* Number of columns in ps command */
> #define PS_COLS 9
> 
> /* Verbatim command to execute for ps in check_procs */
> #define PS_COMMAND "/bin/ps axwo 'stat uid pid ppid vsz rss pcpu comm args'"
> 
> /* Format string for scanning ps output in check_procs */
> #define PS_FORMAT "%s %d %d %d %d %d %f %s %n"
> 
> /* Whether the ps utility uses the "procetime" field */
> /* #undef PS_USES_PROCETIME */
> 
> /* Variable list for sscanf of 'ps' output */
> #define PS_VARLIST procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procprog,&pos



> I'm running nagios plugins 1.4.15, nagios 3.2.2, installed from rpm on a
> redhat based distribution.
> Distribution is quite old, but I cannot upgrade it. I can try to re-compile
> nagios plugins with the last source and see how it goes though.

I'ld assume that if you cannot get away from an aged OS distrib, you're
unlikely to find a newer plugin version on a reputed repo, anyway, and
command line control of the "ps" command is definitely absent from
versions up to and including the current 1.4.16. If so, I don't see any
way for you *other* than giving sources and (*if* necessary - see the
'stat' in my command above) explicit "./configure" options a try.

Another word of warning, though: Have a look at the plugin's help text:

>  -s, --state=STATUSFLAGS
>    Only scan for processes that have, in the output of `ps`, one or
>    more of the status flags you specify (for example R, Z, S, RS,  
>    RSZDT, plus others based on the output of your 'ps' command).

The listed process state( char)s are *mutually exclusive*, and the
interpretation of the --state option is that processes will be included
into the selection if *ANY* of the chars appear in their s/stat column.
In other words, you can select for 's'(ession leaders), but won't be
able to make sure that it's not, e.g., 'Zs' or otherwise defunct within
the same check.

(Been there, done that, wrote my own check_nagios_procs explicitly
telling the '^[RS]sl$' master process from its temporary children. :-} )

Regards,
								J. Bern
-- 
*NEU* - NEC IT-Infrastruktur-Produkte im <http://www.linworks-shop.de/>:
Server--Storage--Virtualisierung--Management SW--Passion for Performance
Jochen Bern, Systemingenieur --- LINworks GmbH <http://www.LINworks.de/>
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel




More information about the Devel mailing list