Page 1 of 1

Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Thu Feb 27, 2014 2:43 am
by jraj90
Hi,

I've just spun up a Nagios instance using the pre-configured AMI which is available on the AWS
(http://assets.nagios.com/downloads/nagi ... _Cloud.pdf)

I got this running and configured, and its working great. Next, I am trying to integrate nagios with the AWS cloudwatch plugin
(http://exchange.nagios.org/directory/Pl ... s#rev-2629)

I am facing an issue here, whereby I am getting 'error code 127 out of bounds - plugin may be missing' from the Nagios web panel. However if I ran the command directly on the terminal, it works fine. It just doesn't seem to work when you add it in the 'Service Management' and do a 'test command'. The output is empty.

Anyone has come across this issue, and care the share how it was solved.

Thanks

Re: Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Thu Feb 27, 2014 3:09 pm
by scottwilkerson
did you upload the .rb files through the web UI?

Can you show the permissions for

Code: Select all

ls -l /usr/local/nagios/libexec/check_cloudwatch_status-1.9.98.rb
ls -l /usr/local/nagios/libexec/encrypt_credentials.rb

Re: Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Thu Feb 27, 2014 11:23 pm
by jraj90
yes i did upload it using the web ui

initially the permission was owner=apache group=apache
that didnt work..so i changed the permission to match the rest on of the plugins in that directory

the second file u asked for permission i believe is the cfg file? The encrypt is just a scripts that encrypts your credential.

-rwxr-xr-x. 1 root root 20K Feb 26 04:25 check_cloudwatch_status.rb
-r-------- 1 nagios nagios 130 Feb 19 15:56 /etc/nagios/aws/ec2-nagios_credentials.cfg

I've tried using different permissions and owners, and it works absolutely fine when i run the command directly on the Nagios server terminal:-

ruby /usr/local/nagios/libexec/check_cloudwatch_status.rb -a mydbserver -i mydb -f /etc/nagios/aws/ec2-nagios_credentials.cfg -D CPUUtilization -w 20 -c 10
CloudWatch Metric: CPUUtilization, Average: 3.37, Maximum: 4.41, Minimum: 2.33|metric_average=3.37 metric_maximum=4.41 metric_minimum=2.33


However, from the web ui I get an empty output:-

COMMAND: ruby /usr/local/nagios/libexec/check_cloudwatch_status.rb -a mydbserver -i mydb -f /etc/nagios/aws/ec2-nagios_credentials.cfg -D CPUUtilization
OUTPUT:

Another strange thing is, I suspect the command is not really being executed from the WEB UI. Reason is, if I change one of the parameters above, (eg: the path of the credential file) to a non existent path (eg: -f /abcd/efgh/file.cfg) it still seem to work from the web. It doesn't return error 'path does not exist' which on the terminal it does.

Thanks again for you assist

Re: Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Fri Feb 28, 2014 12:42 pm
by abrist
The "test check command" has certain . . . limitations due to escaping and security. The test check will run as the apache user, may have issues escaping certain characters, and cannot use user macros.
Have you tried just configuring the check in XI and allowing it to check as it normally would?

Re: Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Mon Mar 03, 2014 3:54 am
by jraj90
Hi guys,

thx everyone for their input. I managed to solve the problem by fixing the ruby. Initially i used RVM to manage my rubies and somehow that didnt seem to work. I got rid of that, and installed ruby using 'yum' and that seem to have solved my problem

Re: Nagios AWS AMI + AWS_Cloudwatch metrics

Posted: Mon Mar 03, 2014 10:27 am
by tmcdonald
Glad to see it working. I'll be closing this thread now but feel free to start another if you need to.