Page 1 of 1

Run perl/pyton script

Posted: Thu Jan 30, 2014 4:01 am
by s.bjorn
Hi.
I'm facing for the first time the development of plugins/command for Nagios Core. Nagios Core is running under a centos6.4 machine. Actually I'm stuck on the command definition, calling script. Here what I'm trying to do :

I'm defining command that run single unix command or run a python / perl script . For example :

define command {
command_name message
command_line /usr/bin/python /usr/lib/nagios/plugins/msg.py admin@local 'MyText'
}

Nothing happen. Calling it directly from root with :
/usr/bin/python /usr/lib/nagios/plugins/msg.py admin@local 'MyText' work perfectly .

I don't get if the problems are at unix level ( permits / ownership ) or at nagios level ( can't run / can't call )
The msg.py file is xwr by user ( nagios is the owner ) , by group and executable,readable by all

What am I doing wrong?

Re: Run perl/pyton script

Posted: Thu Jan 30, 2014 12:14 pm
by tmcdonald
Change

Code: Select all

command_line /usr/bin/python /usr/lib/nagios/plugins/msg.py admin@local 'MyText'
to just

Code: Select all

command_line /usr/lib/nagios/plugins/msg.py admin@local 'MyText'
and make sure you have "#!/usr/bin/python" on the first line of the script.