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
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Uses the AWS PHP SDK to query EC2 instance state.

Requires SDK installed somewhere in the include path (ubuntu in my case /usr/share/php) and requires authentication keys to be set in SDK.
Expects to receive the instance id passed on the command line.

I’ve created hosts with the instance-id as the hostname, it will return warning if instance is in pending state, and critical if state is stopped or stopping.
Also returns warning if instance has been recently started (to remind me to rebind the elastic ip)

If you notice script returning “STATE UNKNOWN TO THIS SCRIPT”, chances are it’s a 272 instance code, which looks like a known issue, couldn’t find a fix, but aws forums recommend restarting the instance.

Script prints the received instance code with the message it provides to nagios.

Easily changed values are listed at the top, min_uptime for controlling how long instance needs to be up to not trigger a warning and messages passed to nagios for various conditions.

Currently running and tested with Nagios 3.x.


Reviews (1)
Took a little while to get this working cos I'm not a developer.. so here are a few tips to get the SDK working

This needs version 1 of the AWS SDK for PHP

As stated, you punch in your AWS credentials into a file called
Good idea to test the sdk with the sample script that comes with the SDK called "cli-s3_get_urls_for_uploads.php"

If you are behind a proxy, you can specify the proxy in sdk.class.php in the line "public proxy = "
eg., public $proxy = "http://username:password@proxy:8080";

Nb. I hit errors with proxies until I found out that proxy support was fixed in a recent commit:

The AWS SDK for PHP defaults to the US East Region. (
You need to set the region if your instances are in a different region.
eg., if you were in Asia Pacific Singapore region..

Add a line after "$ec2 = new AmazonEC2();"

For a list of hosts and for the regions, refer to this...