Page 1 of 1

Nagios UI can't run the plugin

Posted: Wed Oct 18, 2017 2:12 am
by sujan54004
Hi,

I'm trying to get the AWS cloudwatch_status plugin to work and I've installed all the packages necessary for the plugin (ruby and the dependencies in this case).
I'm able to run the cloudwatch command from the the cli using 'root' and 'nagios' users. However, I coundn't get the plugin working in the UI.

When I run normally with either nagios or root user, it ruturns the status without any errors:
ruby /usr/local/nagios/libexec/check_cloudwatch_status.rb -a XXXXXXXX -i "i-XXXXXX" -C CPUUtilization -f /usr/local/nagios/etc/aws_credentials.cfg

But the same thing does not work in the Nagios UI:
Also checked with 'sudo -u nagios', doesn't work.
sudo -u nagios ruby /usr/local/nagios/libexec/check_cloudwatch_status.rb -a XXXXXXXX -i "i-XXXXXX" -C CPUUtilization -f /usr/local/nagios/etc/aws_credentials.cfg

I get the warning message in "Status Information" in the UI:
(No output on stdout) stderr: /usr/local/rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fog (LoadError)

fog and fog-aws packages are installed and works well from the cli.

BR,
Sujan

Re: Nagios UI can't run the plugin

Posted: Wed Oct 18, 2017 11:24 am
by gormank
Check line 55 in the file named in the error.

Re: Nagios UI can't run the plugin

Posted: Wed Oct 18, 2017 1:37 pm
by bolson
Run the following commands and post the result:

Code: Select all

ls -l /usr/local/nagios/libexec/check_cloudwatch_status.rb
ls -l /usr/local/nagios/etc/aws_credentials.cfg

Re: Nagios UI can't run the plugin

Posted: Wed Oct 18, 2017 6:32 pm
by tacolover101
how do you have this defined in Nagios XI? can you post a screenshot?

Re: Nagios UI can't run the plugin

Posted: Thu Oct 19, 2017 2:20 am
by sujan54004
Hi All,

Thanks for your replies.

I've tried different permissions but it didn't help at all. Here are the current permissions for the files:
-rwxrwxr-x. 1 apache nagios 258 10.10. 09:07 check_cloudwatch_status.cfg
-rwxrwxr-x. 1 apache nagios 130 10.10. 09:07 ec2_credentials.cfg

Attachment contains the command definition snapshot.
ruby $USER1$/check_cloudwatch_status.rb -a $ARG1$ -i $ARG2$ -f $USER1$/aws_credentials.cfg -C CPUUtilization -c $ARG3$ -w $ARG4$

Cheers,
Sujan

Re: Nagios UI can't run the plugin

Posted: Thu Oct 19, 2017 8:52 am
by mcapra
This could be an issue with how your Ruby environment is configured. The nagios user's environment likely doesn't have access to the fog gem.

Re: Nagios UI can't run the plugin

Posted: Thu Oct 19, 2017 10:50 am
by kyang
Thanks @mcapra!