Page 1 of 5

check_blackberry5 and error (Return code of 127)

Posted: Tue Jan 28, 2014 11:00 am
by heritages
Hello,

I'm attempting to configure the Blackberry 5.03 BES check found at the link below.

http://exchange.nagios.org/directory/Pl ... E3/details

I've installed the plugin, changed the permission to root(0).

Created the following commands...
check_blackberry_version
$ /usr/local/nagios/libexec/check_blackberry5 -H $HOSTADDRESS$ -C $ARG1$ -Q bes-version
$ARG1$= smtp community (ddgpublic)
e.g. output: BlackBerry Enterprise Server Version: 5.0.3.19

check_blackberry_srpconnect
$ /usr/local/nagios/libexec/check_blackberry5 -H $HOSTADDRESS$ -C $ARG1$ -Q srpconnect
$ARG1$= smtp community (ddgpublic)
e.g. output: OK: Successful connected to SRP-Router. Last Connection: Fri Dec 11 13:47:46 EST 2009

check_blackberry_pendingmail
$ /usr/local/nagios/libexec/check_blackberry5 -H $HOSTADDRESS$ -C $ARG1$ -Q pending $ARG2$
$ARG1$= smtp community (ddgpublic)
$ARG2$= warning values (-w 10 -c 20)
e.g. output: CRITICAL: Pending Mails: 1260554597|Pending=1260554597;10;20;;

check_blackberry_LicensesUsed
$ /usr/local/nagios/libexec/check_blackberry5 -H $HOSTADDRESS$ -C $ARG1$ -Q licenses $ARG2$
$ARG1$= smtp community (ddgpublic)
$ARG2$= warning values (-w 85 -c 90)
e.g. output: OK: Licenses used: 81|Licenses=81;85;90;;

Created HostGroup
SVC - Blackberry BES 5.03

Created Services
SVC - Blackberry 5.03 LicensesUsed
SVC - Blackberry 5.03 PendingMail
SVC - Blackberry 5.03 SrpConnect
SVC - Blackberry 5.03 Version

Installed SNMP Service on Blackberry server and configured SNMP Trap community name ddgpublic linked to Nagios IP.

When I view the services in Nagios XI I find that the each have the following error.
(Return code of 127 is out of bounds - plugin may be missing)

Suggestions

Re: check_blackberry5 and error (Return code of 127)

Posted: Tue Jan 28, 2014 5:19 pm
by sreinhardt
127 generally means that the nagios daemon either cannot access it or it does not have execute rights. So I would first suggest listing the permissions on that check

Code: Select all

ls -lva /usr/local/nagios/libexec/check_blackberry5
Then also su to the nagios user and attempt to execute it.

Code: Select all

su nagios
cd /usr/local/nagios/libexec
check_blackberry5 -H $HOSTADDRESS$ -C ddgpublic -Q pending -w 10 -c 20

Re: check_blackberry5 and error (Return code of 127)

Posted: Wed Jan 29, 2014 8:01 am
by heritages
Hi there,

Here's some output you were asking about...

The permission I changed to root after importing the plugin...
[root@Mis1SmMo02 ~]# ls -lva /usr/local/nagios/libexec/check_blackberry5
-rwxr-xr-x 1 root root 4465 Jan 28 08:45 /usr/local/nagios/libexec/check_blackberry5
[root@Mis1SmMo02 ~]#

Then also su to the nagios user and attempt to execute it...
[nagios@Mis1SmMo02 libexec]$ check_blackberry5 -H <IP REMOVED> -C ddgpublic -Q pending -w 10 -c 20
bash: check_blackberry5: command not found

Let me know what you think.

Thanks

Re: check_blackberry5 and error (Return code of 127)

Posted: Wed Jan 29, 2014 11:37 am
by tmcdonald
Ahh, typo. You need to run

Code: Select all

./check_blackberry5 -H $HOSTADDRESS$ -C ddgpublic -Q pending -w 10 -c 20
while in that directory.

Re: check_blackberry5 and error (Return code of 127)

Posted: Wed Jan 29, 2014 1:22 pm
by heritages
THis is what I got...

[root@Mis1SmMo02 libexec]# su nagios
[nagios@Mis1SmMo02 libexec]$ cd /usr/local/nagios/libexec
[nagios@Mis1SmMo02 libexec]$ ./check_blackberry5 -H <IP REMOVED> -C ddgpublic -Q pending -w 10 -c 20
bash: ./check_blackberry5: /bin/bash^M: bad interpreter: No such file or directory
[nagios@Mis1SmMo02 libexec]$

Re: check_blackberry5 and error (Return code of 127)

Posted: Wed Jan 29, 2014 1:37 pm
by tmcdonald
Looks like you copy+pasted the plugin code? That happens often when you see the ^M issue.

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: Wed Jan 29, 2014 2:55 pm
by heritages
Response

[nagios@Mis1SmMo02 libexec]$ sed 's/^M//g' check_blackberry5 > check_blackberry5.new
[nagios@Mis1SmMo02 libexec]$ mv check_blackberry5.new check_blackberry5
mv: try to overwrite `check_blackberry5', overriding mode 0755 (rwxr-xr-x)? y
[nagios@Mis1SmMo02 libexec]$

What would you like me to do next.

Re: check_blackberry5 and error (Return code of 127)

Posted: Wed Jan 29, 2014 3:03 pm
by tmcdonald
You need to run the check itself:
tmcdonald wrote:

Code: Select all

./check_blackberry5 -H $HOSTADDRESS$ -C ddgpublic -Q pending -w 10 -c 20

Re: check_blackberry5 and error (Return code of 127)

Posted: Fri Feb 07, 2014 9:26 am
by heritages
This is what I get...

[root@Mis1SmMo02 ~]# su nagios
[nagios@Mis1SmMo02 root]$ cd /usr/local/nagios/libexec
[nagios@Mis1SmMo02 libexec]$ ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
bash: ./check_blackberry5: Permission denied
[nagios@Mis1SmMo02 libexec]$

Re: check_blackberry5 and error (Return code of 127)

Posted: Fri Feb 07, 2014 12:55 pm
by tmcdonald
heritages wrote: [nagios@Mis1SmMo02 libexec]$ ./check_blackberry5 -H 172.16.***.*** -C ddgpublic -Q pending -w 10 -c 20
bash: ./check_blackberry5: Permission denied
You will of course need to run it as root or chmod/chown it so you can run it as nagios.