Simple wrapper plugin gets "return code of 127" error
Posted: Tue Oct 07, 2014 5:28 am
Hi, folks.
I have a very simple script that wraps up the check_http command, as I'm having all sorts of problems with any non-trivial URLs or check values. (The UI is escaping stuff, then it's escaped again differently before hitting the cmd, so garbage ensues)
In the libexec directory, the permissions are:
If I execute it from the command line, I get:
And if I check the exit code, it is 0.
If I execute it from the "test check command" button in CCM, I get:
Here's the check_user_lockout script:
Here's some debug output I found:
This is all from Nagios Core VM 3.5.0.
I have a very simple script that wraps up the check_http command, as I'm having all sorts of problems with any non-trivial URLs or check values. (The UI is escaping stuff, then it's escaped again differently before hitting the cmd, so garbage ensues)
In the libexec directory, the permissions are:
Code: Select all
-rwxr-xr-x 1 nagios nagios 528 Oct 7 11:17 check_user_lockout
Code: Select all
HTTP OK - HTTP/1.1 302 Found - 0.300 second response time |time=0.299939s;10.000000;30.000000;0.000000 size=960B;;;0
If I execute it from the "test check command" button in CCM, I get:
Code: Select all
COMMAND: /usr/local/nagios/libexec/check_user_lockout -w 10 -c 30
OUTPUT:
Code: Select all
#!/bin/bash
hostname=www.hardcoded.hostname.com
uri=/path.to.file.html?parameter1=value1\¶meter2=value2\¶meter3=value3
warn=10
crit=30
while getopts "w:c:" opt; do
case $opt in
w)
warn=$OPTARG
;;
c)
crit=$OPTARG
esac
done
./check_http -H $hostname -u $uri -r "\!(This account has been locked out)" -w $warn -c $crit
Code: Select all
[1412677140.287574] [2048.1] [pid=1471] Processing: '$USER1$/check_user_lockout-w 10 -c 30'
[1412677140.287651] [2048.1] [pid=1471] Done. Final output: '/usr/local/nagios/libexec/check_user_lockout -w 10 -c 30'
[1412677149.326262] [2048.1] [pid=1471] Done. Final output: 'DATATYPE::SERVICEPERFDATA TIMET::1412677149 HOSTNAME::TestHost SERVICEDESC::User account locked SERVICEPERFDATA:: SERVICECHECKCOMMAND::check_user_lockout!!!!!!!! HOSTSTATE::UP HOSTSTATETYPE::HARD SERVICESTATE::CRITICAL SERVICESTATETYPE::HARD SERVICEOUTPUT::(Return code of 127 is out of bounds - plugin may be missing)'