[Nagiosplug-devel] Nagios execution environment : problem loading libs while executing custom plugin.
Guillaume Tessier
infogerance-admin4.arsit-idf at justice.gouv.fr
Wed Dec 3 18:57:25 CET 2008
Hello!
first of all, please forgive me for my writing as English is not my
native language.
I have successfully written and integrated some plugins for Nagios (all
written in Python).
I do appreciate Nagios for the liberty to write you own plugin.
But i get stuck with the last one....
This plugin is aimed to query databases and return some values (perf
(SGA...) & fonctionnal (nb users connected...)).
It's written in Python and uses the cx_Oracle module to communicate with
Oracle DB's.
OK, let's go to the point!
The plugin executes perfectly from the command line.
However, after being integrated to nagios ans executed within nagios
environment, it fails to execute.
This is NOT a 'no output' error.
After debugging it appear the it can't load properly the cx_Oracle
module because it does not find some files.
Indeed, cx_Oracle module does need some particuliar environment
variables (those for the Oracle client access suite) : ORACLE_HOME,
LD_LIBRARY_PATH and so on...
While debugging, it appears that the environment variables within the
execution environment of nagios are very different from the shell's
variables.
That is quite normal as when i execute the python script through the
shell, it's a son process and it inherit from the shell's environment
variables (which are properly set).
But when executed from Nagios, the environment variables are those :
-----
{'NAGIOS_SERVICEDOWNTIME': '0', 'NAGIOS_HOSTDURATIONSEC': '3645892',
'NAGIOS_SERVICEGROUPNAME': '', 'NAGIOS_SERVICEACKCOMMENT': '',
'NAGIOS_DATE': '03-12-2008', 'NAGIOS_CONTACTPAGER': '',
'NAGIOS_HOSTACKAUTHOR': '', 'NAGIOS_RESOURCEFILE':
'/usr/local/nagios/etc/resource.cfg', 'NAGIOS_LASTHOSTUNREACHABLE': '0',
'SHELL': '/bin/sh'
----
So, finally, my question is :
Where can i set the nagios executing environment variables in order to
load my module properly??????????????
I have looked for it through the Web, but i definitely get stuck....
If you have any idea about it, i would really appreciate!!!!
--
Guillaume
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20081203/c35d41f5/attachment.html>
More information about the Devel
mailing list