Home

Awesome

AWS Lambda Pingdom cache

An AWS Lambda function, written in Python, to create a small cache of information from the Pingom API, stored in a DynamoDB database table. The intention is to call this function every minute (or possibly every 5 minutes) via a CloudWatch Events Schedule.

More information about Pingdom is available from https://pingdom.com/. More information about the Pingdom API is at https://www.pingdom.com/resources/api.

Edit the 4 variables at the top of the function to include your Pindom API credentials and DynamoDB table name. By default, the DynamoDB table is called 'pingdom-cache'.

The fields stored in the table are as follows:

FieldDescription
idIdentifier of the Pingdom check
availability1dayAvailability over the last 24 hours (stored as an integer between 0 and 1000, i.e. 99.95% is stored as 9995)
availability1monthAvailability over the past 30 days (see above)
availability1weekAvailability over the past 7 days (see above)
availability3monthsAvailability over the past 90 days (see above)
cacheupdateTime of last cache update (stored as seconds since the epoch)
lasterrorendTime that the last error condition ended (see above)
lasterrorstartTime that the last error condition started (see above)
nameName of the Pingdom check
status'up', 'down' or 'unknown'
type'customer', 'external' or 'internal' (depending on presence of tags)

Note that this function includes a verbatim copy of the https://github.com/drcraig/python-restful-pingdom module written by @drcraig (see https://github.com/drcraig).