Categorygithub.com/tidal-open-source/cw-alert-router
modulepackage
0.1.0
Repository: https://github.com/tidal-open-source/cw-alert-router.git
Documentation: pkg.go.dev

# README

Cloudwatch Alert Router

build&test

Cloudwatch Alert Router is a simple lambda that will take cloudwatch alarms (via event bridge) and deliver them to Slack and/or PagerDuty depending.

Slack channels and PagerDuty delivery can be configured via AWS tags on the Cloudwatch alarms.

API keys

Minimum required environment variables

These are required to be set, otherwise the application may not run correctly.

Environment variableDescriptionExample
DEFAULT_SLACK_CHANNELDefault slack channel where alarms are sent if no channel can be inferredtest-alarms
SLACK_TOKEN_SSM_KEYThe SSM Parameter name where your Slack Oauth access token is stored/lambda/my-lambda-name/slack/app/oauth/access_token
PAGERDUTY_DEFAULT_ROUTING_KEYDefault PagerDuty routing key (otherwise some logic is used to search for a key in SSM)xxxxxxx
IMAGE_BUCKETName of the S3 bucket where temporary graphs are storedmy-bucket-name
IMAGE_BUCKET_REGIONRegion of the bucketus-west-2
IMAGE_HOSThttps://my-bucket-cdn.mysite.com

Optional environment variables

The following environment variables are optional

Environment variableDescriptionDefaultExample
IMAGE_BUCKET_ROLE_ARNRole we need to assume to write to the image bucket (leave empty to use the lambda role)""arn:aws:iam::123456789012:role/role_with_bucket_access
LOG_LEVELLog levelINFODEBUG
OWNER_TAG_KEYAWS tag to determine who owns the alarm - used to infer the slack channel name (-alarms)owner
APP_NAME_TAG_KEYAWS tag for the service that owns the alarm - used to infer a pagerduty routing key from ssm (eg: /service/cw_alert_router/pagerduty/routing_keys/)service

Getting started

A simple example of how to get the lambda up and running:

package main

import (
	log "github.com/sirupsen/logrus"
	"github.com/tidal-open-source/cw-alert-router/lambda"
)

func main() {
	cfg, err := lambda.NewConfig()

	if err != nil {
		log.Fatalf("Error initializing lambda: %v", err)
	}

	lambda.SetConfig(cfg)
	lambda.Start()
}

Compile and upload the lambda - then set the required (and/or optional) environment variables to configure the service to your needs.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Package pagerduty provides a simple interface to send alerts to a specific service.
Package parameterstore wraps AWS Systems Manager Parameter Store in a basic interface that provides calls specific to our needs.
Package s3 wraps AWS S3 API in a basic interface that provides calls specific to our needs.
No description provided by the author
No description provided by the author