consul2sns
Publish state changes from Consul to AWS SNS.
Usage
On one of the Consul servers, run the following command:
consul watch -type=check cat | ./consul2sns.py -t foo-bar
Pre-reqs
The following Python modules are required:
- boto
Command Line Options
-
-t, --topic TOPICThe AWS SNS topic ARN to publish to. This is an expanding ARN, meaning it will make assumptions to fill in the whole ARN; using the region selected and the AWS account ID of the Boto user. This means that you can use just the SNS topic name (e.g.foobar) and it will expand it to the full ARN (e.g.arn:aws:sns:us-east-1:123456789012:foobar). -
-r, --region REGIONThe AWS region to connect to. -
-f, --filter FILTERThe state transition filter, which is a JSON dictionary of state changes that will be passed to SNS. Default is all state changes. The valid states are: passingwarning-
criticalFor example, if the dictionary was{"warning": ["critical", "passing"], "critical": ["passing"]}, it would only forward state transitions from warning to critical or passing, and from critical to passing. -
--escalationOnly forward escalating states (frompassingup tocritical). -
--de-escalationOnly forward de-escalating states (fromcriticaldown topassing). -
--access-key-id ACCESS_KEY_IDThe AWS IAM access key ID. You should useboto.cfginstead. -
--secret-access-key SECRET_ACCESS_KEYThe AWS IAM secret access key. You should useboto.cfginstead. -
-v, --verbosePrint verbose output.