Return code of 127; executing script/pluggin

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
User avatar
hbackus
Posts: 36
Joined: Tue May 17, 2011 5:02 pm

Return code of 127; executing script/pluggin

Post by hbackus »

I have added a script check_bw.sh to the /usr/local/nagios/libexec/ folder, made sure it matches the other plugin rights with 'chmod 755'.
When I execute it from a command line "/usr/local/nagios/libexec/check_bw.sh -H 10.32.255.1 -b 1000000000 -v 2c -m input -C public -i ethernet1/1/24 -p 15" I get the response I expected " Current input bandwidth usage is 0.267 Mb/s, 0% used".
When trying to use it as command in a my_bw_check.cfg file I get the message "Return code of 127 is out of bounds. Check if plugin exists"
The path to the my_bw_check.cfg file has been added in the nagios.cfg "cfg_dir=/usr/local/nagios/etc/objects/services". The my_bw_check.cfg file is:

define host{
use generic-switch
host_name stl-core-sw
alias STL-CORE-SW
address 10.32.255.1
hostgroups avpn_switches
}

define hostgroup{
hostgroup_name avpn_switches
alias HSB Switch AVPN
}

define service{
use generic-service
host_name stl-core-sw
service_description CHECK BANDWIDTH
check_command check_bw.sh!stl-core-sw!100!v2!input!public!ethernet1/1/24!30
check_interval 2
retry_interval 1
}

Can you think of any reason why the command runs from a command line but throws a 127 out of bounds when I run it in a my_bw_check.cfg file?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Return code of 127; executing script/pluggin

Post by scottwilkerson »

Did you define a command definition for check_bw.sh, such as?

Code: Select all

define command {
    command_name    check_bw.sh
    command_line    $USER1$/check_bw.sh -H $ARG1$ -b $ARG2$ -v $ARG3$ -m $ARG4$ -C $ARG5$ -i $ARG6$ -p $ARG7$
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
hbackus
Posts: 36
Joined: Tue May 17, 2011 5:02 pm

Re: Return code of 127; executing script/pluggin

Post by hbackus »

Cool!

That's where I messed up!

Thanks Scott!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Return code of 127; executing script/pluggin

Post by scottwilkerson »

hbackus wrote:Cool!

That's where I messed up!

Thanks Scott!
Glad to help!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked