[Nagiosplug-devel] question on check_procs and shell environment

Thomas Guyot-Sionnest dermoth at aei.ca
Wed Mar 31 00:54:15 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30/03/10 11:57 AM, Frost, Mark {PBC} wrote:
>> -----Original Message-----
>> From: Thomas Guyot-Sionnest [mailto:dermoth at aei.ca]
>> Sent: Friday, March 26, 2010 11:54 PM
>> To: Nagios Plugin Development Mailing List
>> Subject: Re: [Nagiosplug-devel] question on check_procs and shell
>> environment
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 26/03/10 12:07 PM, Frost, Mark {PBC} wrote:
>>> It seems that the check_procs configuration used on HPUX (and it looks
>> like AIX although I haven't tested that one) doesn't handle command
>> arguments at all, although the command implies that it does.  It uses
>> "/usr/bin/ps -el" as the execution command which does not return
>> arguments.  The end result is that the "command" and "arguments" values
>> are to the same value (i.e. command=sh and arguments=sh) which is pretty
>> useless.  -a and --ereg-arguments-array just match on the command value.
>>> By comparison, on Linux, these values are fully accessible.
>>>
>>> While you can run 'ps' on HPUX and get more fields and better sets of
>> arguments, you still don't quite get them all.  There are no variants of
>> 'ps' on HPUX that will give all the fields that the check_procs command
>> allows unless you turn on UNIX95 standards compliance.  Then you can
>> make the HPUX 'ps'  function like Linux 'ps' and specify the fields you
>> want.  However, this means you have to set an environment variable as in
>>> UNIX95= /usr/bin/ps -ex -o 'state uid pid ppid vsz sz pcpu comm args'
>>>
>>> I prefer to "really fix it" approach to "mostly fix it".
>>>
>>> check_procs calls run_cmd().  The comments in the code seem to
>> indicate that the idea of passing in any environment is not allowed
>> other than the single variable that is hardcoded in run_cmd_open
>> (LC_ALL=C).  I changed the code to also include the "UNIX95="
>> environment variable and check_procs works as it does on Linux.
>>> The only way I can think of to make this work reasonably is to somehow
>> allow passing in this environment variable via run_cmd() say via a
>> compile time options like the setting of PS_COMMAND, but it's my
>> impression that this is not something that anyone wants to do for
>> security reasons under any circumstances.  I think the spopen() call is
>> the wave of the future for these things, but it works similarly in that
>> it doesn't allow environment arguments to be passed in.
>>> Is this idea of passing in environment just something that is an
>> impassible barrier?
>>
>> Hi Mark,
>>
>> Thank you for this very insightful explanation of the issues with
>> check_procs on HPUX. Do you know if the UNIX95 trick will work on any
>> decently-recent version of UX?
>>
> 
> Thomas,
> 
> Honestly, I don't know.  I have the impression that this is an HPUX only
> thing.  I think other vendors have just adopted the UNIX95 standard
> outright.  HPUX has held back for some reason.  I think there's other
> incompatibilities with some of their other tools so they opted to make
> the UNIX95 support optional.  Always swimming upstream...

I meant any decently-recent version of <<HP-UX>> (I used "UX" as a
diminutive).

What I mean it that I don't want to break other HP-UX servers with a fix
that work only on the newer ones, so I wanted to know if this has been
working like that for some time.


- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFLsoEX6dZ+Kt5BchYRAmqGAJ92RmIShF+zWrpB9BuHn9QaeePmZACdF2T0
QJr/X3PHnDAclYqni6mom8Y=
=q/rd
-----END PGP SIGNATURE-----




More information about the Devel mailing list