Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Check_AWS_EC2_instance_status

Current Version
1.4.27
Last Release Date
2011-07-12
Compatible With
  • Nagios 3.x
Owner
License
Apache
Hits
103466
Files:
FileDescription
check_ec2_status.rbThe ruby script that check the status of an instance on AWS EC2.
check_ec2_status.cfgThe definition of the nagios command.
sample_host.cfgSample of use.
encrypt_credentials.rbRuby script that encrypts Amazon Web Services Credentials.
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This is a ruby script that checks the status of an instance on Amazon Web Service EC2 using Amazon EC2 API.
The Amazon credentials (Access Key ID and Secret Access Key) are read from an encrypted file.
Using Amazon EC2 API, this is possible to retrieve the status of an instance without installing any agent or configuring SNMP daemon.
Moreover, this requires only read-only credentials that could be easily generated using Amazon IAM. For security reasons, we use encrypted credentials that are decrypted by this plugin.

Here is a command line sample of use:
debian-secludit # RUBYOPT=rubygems ruby check_ec2_status.rb -v -a ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com -i i-XXXXXXXX -f ec2_credentials_1.cfg
** Launching EC2 status retrieval on instance ID: i-XXXXXXXX on Amazon Server: $ec2.us-east-1.amazonaws.com
Amazon Server: ec2.us-east-1.amazonaws.com
EC2 Status Check: OK - State Name: running, State Code: 16|running=1

The ec2_credentials_1.cfg files contains the encrypted credentials as follow:
[blank_space]ec2_access_id[blank_space]B64_encoding(BF-CBC-Cipher_encoding(Access Key ID)
[blank_space]ec2_access_key[blank_space]B64_encoding(BF-CBC-Cipher_encoding(Secret Access Key)
You can use the encrypt_credentials.rb ruby script that does that as follow:
debian-secludit # RUBYOPT=rubygems ruby encrypt_credentials.rb -A XXXXXXXXXXXXXXXXXXXX -S XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -f ec2_credentials.cfg

Here is a sample configuration file for nagios.
define host {
name Amazon_EC2_Instance_Name
use generic-host
address ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
check_command check_ec2_status!i-XXXXXXXX!/etc/nagios3/credentials/ec2_credentials_1.cfg
max_check_attempts 3
}