Run perl/pyton script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
s.bjorn
Posts: 1
Joined: Thu Jan 30, 2014 3:47 am

Run perl/pyton script

Post 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?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Run perl/pyton script

Post 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.
Former Nagios employee
Locked