Skip to content

Send Slack reminders about Opsgenie alerts open for too long

License

Notifications You must be signed in to change notification settings

orsinium-labs/opsgenie-reminder

Repository files navigation

opsgenie-reminder

A CLI tool that fetches from Opsgenie alerts that are open for too long and sends Slack notifications.

Installation

Pick one of the options below.

Download binary

  1. Download a binary release from Github Releases page.
  2. Place it somewhere in your $PATH: mv opsgenie-reminder ~/.local/bin/.

Install using Go

Install the latest version using Go:

go install github.com/orsinium-labs/opsgenie-reminder@latest
opsgenie-reminder --help

Build from source

git clone --depth 1 git@github.com:orsinium-labs/opsgenie-reminder.git
cd opsgenie-reminder
go build .
./opsgenie-reminder --help

Build Docker image

git clone --depth 1 git@github.com:orsinium-labs/opsgenie-reminder.git
cd opsgenie-reminder
sudo docker build --tag opsgenie-reminder .
sudo docker run opsgenie-reminder

Usage

opsgenie-reminder \
    --opsgenie-token    ${OPSGENIE_TOKEN} \
    --opsgenie-api-url  https://api.eu.opsgenie.com \
    --opsgenie-url      https://${MY_ORG_NAME}.app.eu.opsgenie.com/ \
    --slack-token       ${SLACK_TOKEN} \
    --slack-channel     opsgenie-reminders

Run opsgenie-reminder --help to see the full list of options.

The tool stores the state between runs in a local file (.opsgenie-reminder-state.json by default). Make sure to preserve this file between runs, or you can get notified about the same alert.

You can also create a config.yaml file in the current directory which may contain any of the CLI options and also mapping of opsgenie team IDs to SLack groups and channels. For example:

teams:
  183c81ae-8828-1904-41f0-61278c80bb25:
    # use this group handle in the reminder message
    group:   team-backend
  2fcf93e8-b32c-aede-42ea-7c53ef6b16e8:
    group:   team-processing
    # send reminders to this slack channel
    channel: processing-bugs
  bd270922-b32c-cc87-42ea-7c53ef6b16e8:
    channel: processing-bugs
  bd270922-77c6-89e5-47a2-bcd6c3a50812:
    # do not send reminders
    ignore: true