This plugin will pull alarm stats from Amazon CloudWatch
Often time there is a need to be able to pull Alarm status from AWS with the possible restriction of not being able to integrate with the existing notification solutions available with AWS. There would sometimes be needs to have poll mechanism to handle the same
This simple shim can serve as an external telegraf plugin that is capable of polling in clourwatch alarms at regular intervals. Also, it serve as a reference application of external telegraf plugins
Derived from the existing implementation of the cloudwatch input plugin
Just as the cloudwatch input
plugin, it uses a credential chain for Authentication with the CloudWatch
API endpoint. In the following order the plugin will attempt to authenticate.
- Assumed credentials via STS if
role_arn
attribute is specified (source credentials are evaluated from subsequent rules) - Explicit credentials from
access_key
,secret_key
, andtoken
attributes - Shared profile from
profile
attribute - Environment Variables
- Shared Credentials
- EC2 Instance Profile
NOTE: The Cloudwatch user must have the appropriate permissions to read/Describe Cloudwatch Alarms.
The minimal configuration expects the region
to be set.
[[inputs.awsalarms]]
region = "us-east-1"
## Optionals
## Amazon Credentials
## Credentials are loaded in the following order
## 1) Assumed credentials via STS if role_arn is specified
## 2) explicit credentials from 'access_key' and 'secret_key'
## 3) shared profile from 'profile'
## 4) environment variables
## 5) shared credentials file
## 6) EC2 Instance Profile
# secret_key = ""
# token = ""
# role_arn = ""
# profile = ""
# shared_credential_file = ""
# state_value = "ALARM"
# tags_include = ["tags-to-include"]
# tags_exclude = ["tags_to_exclude"]
The default state_value is "ALARM"
Tags here refer to the attributes of the Alarm: Dimensions
, MetricName
, Namespace
& ArnName
The measurement name being the AlarmName
Note: Currently CompositeAlarms not implemented.
Poll interval can be set with the param -poll_interval
.
Default Poll Interval is 2 minutes.
- Clone the repo
git clone [email protected]:vipinvkmenon/awsalarms.git
- Build the "awsalarm" binary
$ go build -o awsalarm cmd/main.go
- You should be able to call this from telegraf now using execd
[[inputs.execd]]
command = ["/path/to/awsalarm", "-poll_interval 1m"]
signal = "none"
This self-contained plugin is based on the documentations of Execd Go Shim