check_blackberry5 and error (Return code of 127)

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
heritages
Posts: 58
Joined: Thu Jan 16, 2014 11:55 am

check_blackberry5 and error (Return code of 127)

Post 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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_blackberry5 and error (Return code of 127)

Post 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
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
heritages
Posts: 58
Joined: Thu Jan 16, 2014 11:55 am

Re: check_blackberry5 and error (Return code of 127)

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_blackberry5 and error (Return code of 127)

Post 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.
Former Nagios employee
heritages
Posts: 58
Joined: Thu Jan 16, 2014 11:55 am

Re: check_blackberry5 and error (Return code of 127)

Post 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]$
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_blackberry5 and error (Return code of 127)

Post 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
Former Nagios employee
heritages
Posts: 58
Joined: Thu Jan 16, 2014 11:55 am

Re: check_blackberry5 and error (Return code of 127)

Post 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.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_blackberry5 and error (Return code of 127)

Post 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
Former Nagios employee
heritages
Posts: 58
Joined: Thu Jan 16, 2014 11:55 am

Re: check_blackberry5 and error (Return code of 127)

Post 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]$
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_blackberry5 and error (Return code of 127)

Post 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.
Former Nagios employee
Locked