Skip to content

Instantly share code, notes, and snippets.

@armiiller
Last active February 8, 2021 23:21
Show Gist options
  • Save armiiller/1acac8d8a6e3d2b4bc0025d4a94e3d0d to your computer and use it in GitHub Desktop.
Save armiiller/1acac8d8a6e3d2b4bc0025d4a94e3d0d to your computer and use it in GitHub Desktop.
---
rules:
# Each rule has a single match condition and an actions array. Only the first matching rule will be processed.
# match is an object with
# - key(s) - context property
# - value - operators
# operators: $in, $nin, $exists, $gte, $gt, $lte, $lt, $eq, $ne, $mod, $all, $and, $or, $nor, $not, $size, $type, $regex, $where, $elemMatch. (see https://www.npmjs.com/package/sift)
# You can match multiple properies on the alert.
- match:
alert.title:
"$regex": "special title"
"$options": "i"
# Once a match occurs you can do many actions.
# types: notify, repeat, ignore
# see examples of each below
actions:
# run a notification cycle. 1st notify me via email and slack.
# If the alert is still open after 1 minute, notify me via voice.
# If the alert is still open 5 minutes later, repeat this cycle.
- type: notify
channels:
- email
- slack
timeout: 1m
- type: notify
channels:
- voice
timeout: 5m
# You can repeat this cycle between 0 and 3 times
- type: repeat
times: 1
# if the alert urgency is medium or low, and outside of working hours do not notify me
- match:
$and:
- alert.urgency:
"$in":
- low
- medium
- $timeBetween:
timeformat: 'hh:mm a'
timezone: 'America/Los_Angeles'
starttime: '05:00 pm'
endtime: '08:00 am'
actions:
- type: ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment