Page 1 of 1

Return code of 127; executing script/pluggin

Posted: Fri May 03, 2019 1:47 pm
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?

Re: Return code of 127; executing script/pluggin

Posted: Fri May 03, 2019 1:58 pm
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$
}

Re: Return code of 127; executing script/pluggin

Posted: Fri May 03, 2019 6:49 pm
by hbackus
Cool!

That's where I messed up!

Thanks Scott!

Re: Return code of 127; executing script/pluggin

Posted: Mon May 06, 2019 6:51 am
by scottwilkerson
hbackus wrote:Cool!

That's where I messed up!

Thanks Scott!
Glad to help!

Locking thread