[Nagiosplug-devel] Nagios execution environment : problem loading libs while executing custom plugin.

Guillaume Tessier infogerance-admin4.arsit-idf at justice.gouv.fr
Sun Dec 7 10:34:53 CET 2008


Hi!

Thanks for replying!

Yes, i already did set up the shell environment properly (actually in 
/etc/profile).
I just did the test you adviced : user a shell script to launch the 
python script. But it is exactly the same behaviour.

i ask the program to display the environment variables (print os.environ) :
- when lauched from the command line, the python script (and the shell 
script) returns me exactly the same variable than the shell. I can even 
set up new variables (os.environ["TESTVAR2"]="blibli") and it display fine.

---- output ----
{'LANG': 'fr_FR at euro', 'TERM': 'xterm', 'SHELL': '/bin/sh', 
'ORACLE_HOME': '/opt/oracle/product/10.2.0/client_1', 'SHLVL': '2', 
'ORACLE_BASE': '/opt/oracle', 'TESTVAR2': 'blibli', 'PWD': 
'/home/www-data', 'LOGNAME': 'www-data', 'USER': 'www-data', 'MAIL': 
'/var/mail/www-data', 'PATH': 
'/opt:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/oracle/product/10.2.0/client_1/bin', 
'HOME': '/home/www-data', 'LD_LIBRARY_PATH': 
'/opt/oracle/product/10.2.0/client_1/lib', '_': 
'/usr/local/nagios/libexec/dbRequest.py'}
---------------
You can even see the variable TESTVAR2 that i set in the python script.....


- when lauched from Nagios, the python script (and the shell script) 
returns me this stuff :
 {'NAGIOS_SERVICEDOWNTIME': '0', 'NAGIOS_HOSTDURATIONSEC': '3956006', 
'NAGIOS_SERVICEGROUPNAME': '', 'NAGIOS_SERVICEACKCOMMENT': '', 
'NAGIOS_DATE': '07-12-2008', 'NAGIOS_CONTACTPAGER': '', 
'NAGIOS_HOSTACKAUTHOR': '', 'NAGIOS_RESOURCEFILE': 
'/usr/local/nagios/etc/resource.cfg', 'NAGIOS_LASTHOSTUNREACHABLE': '0', 
'SHELL': '/bin/sh'

I don't know where it gets that from....

Wait!!!
I just performed a test while writing. This confirm my fears...
I just create a new command that just launch a shell script. The shell 
script just echo an environment variable.
when echoing $PATH, i get this frim nagios : 
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin

This is different than the shell environment PATH variable set in 
/etc/profile : 
PATH=/opt:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/oracle/product/10.2.0/client_1/bin

The best : if i try to echo $ORACLE_HOME, guess what?..... "no output"!!!!

Those tests really show that some setting completely substitutes its own 
environment variables to those from the shell.....


WAIT AGAIN!!!!
Amazing : if i restart the /etc/init.d/nagios then things go ok!
But if i reboot the machine (/etc/init.d/nagios is in the runlevel 
scripts) then it fails back!!!!

There is really something going strange with nagios executing environment!!!


If you have any idea about it!!! I'll look in the init script if it has 
something special....

Guillaume 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20081207/979ecf16/attachment.html>


More information about the Devel mailing list