Page 2 of 5

Re: check_blackberry5 and error (Return code of 127)

Posted: Fri Feb 07, 2014 2:00 pm
by heritages
[root@Mis1SmMo02 ~]# cd /usr/local/nagios/libexec
[root@Mis1SmMo02 libexec]# ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
-bash: ./check_blackberry5: Permission denied
[root@Mis1SmMo02 libexec]#

This is what happens when I run it as root.

Re: check_blackberry5 and error (Return code of 127)

Posted: Fri Feb 07, 2014 2:13 pm
by tmcdonald
Please run

ls -l /usr/local/nagios/libexec/check_blackberry5

and share the output

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 7:46 am
by heritages
when run as root....

[root@Mis1SmMo02 libexec]# ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
-bash: ./check_blackberry5: Permission denied

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 10:31 am
by tmcdonald
That's not the command I asked you to run. Please run:

ls -l /usr/local/nagios/libexec/check_blackberry5

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 1:20 pm
by heritages
[root@Mis1SmMo02 ~]# ls -l /usr/local/nagios/libexec/check_blackberry5
-rw-r--r-- 1 nagios users 4465 Jan 29 14:54 /usr/local/nagios/libexec/check_blackberry5
[root@Mis1SmMo02 ~]#

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 1:22 pm
by tmcdonald
There's your problem. Nobody has permission to execute the plugin.

chmod 755 /usr/local/nagios/libexec/check_blackberry5

and it should work

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 1:43 pm
by heritages
[root@Mis1SmMo02 libexec]# ls -l /usr/local/nagios/libexec/check_blackberry5
-rwxr-xr-x 1 nagios users 4465 Jan 29 14:54 /usr/local/nagios/libexec/check_blackberry5
[root@Mis1SmMo02 libexec]# ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
-bash: ./check_blackberry5: /bin/bash^M: bad interpreter: No such file or directory
[root@Mis1SmMo02 libexec]#

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 1:50 pm
by tmcdonald
Same issue we tackled back on the first page:

Run the following and try it again. In order to type the ^M character, hold CTRL and pres v then m:

sed 's/^M//g' check_blackberry5 > check_blackberry5.new
mv check_blackberry5.new check_blackberry5

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 2:03 pm
by heritages
Ok, getting closer....

[root@Mis1SmMo02 libexec]# ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
Timeout: No Response from 172.16.124.149
./check_blackberry5: line 82: [: : integer expression expected
./check_blackberry5: line 86: [: : integer expression expected
OK: Pending Mails: |Pending=;10;20;;

Not sure that the below two lines are correct.
./check_blackberry5: line 82: [: : integer expression expected
./check_blackberry5: line 86: [: : integer expression expected

Re: check_blackberry5 and error (Return code of 127)

Posted: Thu Feb 13, 2014 2:37 pm
by tmcdonald
Means that on those lines there should be a numeric variable but the variable is not being set. The variable is set by running snmpwalk and parsing the output:

Code: Select all

PENDINGMSGOID=`$SNMPWALK_BIN -v 2c -c $community -On $hostname $PENDINGMSG | awk '{print $4}' | tr -d '\n'`;
SNMPWALK_BIN is set to be /usr/bin/snmpwalk, so let's look at the following:

Code: Select all

which snmpwalk
ls -l /usr/bin/snmpwalk
/usr/bin/snmpwalk -v 2c -c <your community string here> -On <hostname here> '1.3.6.1.4.1.3530.6.7.10.40.10.1.16'
/usr/bin/snmpwalk -v 2c -c <your community string here> -On <hostname here> '1.3.6.1.4.1.3530.6.7.10.40.10.1.16' | awk '{print $4}'
/usr/bin/snmpwalk -v 2c -c <your community string here> -On <hostname here> '1.3.6.1.4.1.3530.6.7.10.40.10.1.16' | awk '{print $4}' | tr -d '\n'
Of course make the replacements in <brackets> as necessary.