Page 1 of 1

ec2 ami/XI... Return code of 127 is out of bounds

Posted: Mon Apr 02, 2012 2:16 pm
by metadojo
Hello,

I am running a small instance of
AMI: nagiosxi/centos/6/2.2-SNAPSHOT-1/x86_64 (ami-8f8d53e6)
the nagios image in AWS EC2.

I tried installing the check_mongo.py plugin into nagios XI with these directions....
http://www.doug.kerr-net.us/mediawiki/i ... _Configure

in short...
define command {
command_name check_mongodb
command_line $USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
}

define service {
use generic-service
hostgroup_name Mongo Servers
service_description Mongo Connect Check
check_command check_mongodb!connect!27017!2!4

}

and then i go to the XI UI and
create a command
a host to point to my mongodb install
and a nagios service that runs the check command

unfortunately i get Return code of 127 is out of bounds, plugin may be missing

I tried installing pymongo manually with yum install pymongo.

I tried changing the command structure from

$USER1$/nagios-plugin-mongodb/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
To
$USER1$ /check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$
To
/usr/local/nagios/libexec/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$

and i chmod the check_mongo.py file to 777

nothing has worked so far.

any ideas?

Re: ec2 ami/XI... Return code of 127 is out of bounds

Posted: Mon Apr 02, 2012 3:14 pm
by scottwilkerson
it should be
$USER1$/check_mongodb.py -H $HOSTADDRESS$ -A $ARG1$ -P $ARG2$ -W $ARG3$ -C $ARG4$

No space between $USER1$ and /check_mongodb.py

just to verify, can you run

Code: Select all

cd /usr/local/nagios/libexec/
ls -l check_mongodb.py

Re: ec2 ami/XI... Return code of 127 is out of bounds

Posted: Mon Apr 02, 2012 3:40 pm
by metadojo
thanks .. my problems were multiple fold.

• The nagios XI web interface uploads the plugin to a directory different than my command path is referering.
• Since I opened in windows before upload its DOS based carriage returns
• The first line in the plugin needed to be edited to do !#/usr/local/python as opposed to what it had !#/usr/local/env python

Re: ec2 ami/XI... Return code of 127 is out of bounds

Posted: Mon Apr 02, 2012 4:00 pm
by scottwilkerson
Yep those DOS based carriage returns can sure throw things off...

Glad you got it resolved.