Page 1 of 1

Ec2 instance monitoring

Posted: Mon May 03, 2021 12:40 am
by krupats
Hi,

I am trying to add EC2 instance to Nagios XI using access and secret key, but getting ""There were no Instances found. Verify your AWS credentials and try again"".

What can be the issue ?

Kindly help me with prerequisites and proper steps to be followed while adding Ec2 instance to Nagios XI for monitoring.

Thanks

Re: Ec2 instance monitoring

Posted: Mon May 03, 2021 12:55 pm
by ssax
Please SSH into the XI server and su - to the nagios user, and run the command from the CLI, and PM the full output:
- Change xxxx/yyyy

Code: Select all

su - nagios
/usr/local/nagios/libexec/check_ec2.py -v --getinstances --accesskeyid='xxxx' --secretaccesskey='yyyy'

Re: Ec2 instance monitoring

Posted: Mon May 10, 2021 5:35 pm
by ssax
Does it work if you do this?
- Set the region to what yours is

Code: Select all

su - nagios
/usr/local/nagios/libexec/check_ec2.py -v --getinstances --accesskeyid='xxxx' --secretaccesskey='yyyy' --region 'xx-xxxx-x'

Re: Ec2 instance monitoring

Posted: Tue May 11, 2021 10:14 am
by emguru1
I'm having the same issue in the latest release of XI. The error I'm getting presented with from the command line after inputting my keys and region is as follows.

[nagios@nagiosxi ~]$ /usr/local/nagios/libexec/check_ec2.py -v --getinstances --accesskeyid='munged' --secretaccesskey='munged' --region 'us-east-2'
File "/usr/local/nagios/libexec/check_ec2.py", line 176
print instance_list
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(instance_list)?

Re: Ec2 instance monitoring

Posted: Wed May 12, 2021 10:51 am
by vtrac
Hi,
How are you doing?

I am assuming that you are using "Python 3".

Please add the below line at the top of "/usr/local/nagios/libexec/check_ec2.py" file:

Code: Select all

from __future__ import print_function
Now, please try the command again.

Code: Select all

/usr/local/nagios/libexec/check_ec2.py -v --getinstances --accesskeyid='munged' --secretaccesskey='munged'

Best Regards,
Vinh