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


Remember Me

Directory Tree


Current Version
Last Release Date
Compatible With
  • Nagios 3.x
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 -i i-XXXXXXXX -f ec2_credentials_1.cfg
** Launching EC2 status retrieval on instance ID: i-XXXXXXXX on Amazon Server: $
Amazon Server:
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
check_command check_ec2_status!i-XXXXXXXX!/etc/nagios3/credentials/ec2_credentials_1.cfg
max_check_attempts 3