Skip to content

Instantly share code, notes, and snippets.

# To switch the channel url the message is sent to.
rules:
- match:
alert.d_team_id: "tem_xxx" # Apps Team
actions:
- type: setval
map:
webhook_url: "https://hooks.slack.com/services/aaa/bbb/ccc" # apps channel webhook
- match:
# Example rules for the "Slack (Post to Channel)" integration
# To switch the channel the message is sent to.
# Note this won't work with private channels
rules:
- match:
alert.d_team_id: "tem_xxx" # Apps Team
actions:
- type: setval
map:
channel: "C3QCH7S7C" # apps channel
---
rules:
suppress:
# array of rules of when to suppress
- match:
# ... properties to match
{
always: true,
alert: {...}, // the alert object
integration: {...}, // the integration object
event: string // the event name (ex: alert.resolved)
}
# example rule showing how to suppress the outgoing webhook of any alert that is not 'critical'
rules:
- match:
alert.urgency:
$ne: critical
actions:
- type: ignore
import requests
pload = {
'event_type':'resolve',
'Id':'monitor-1'
}
r = requests.post('https://api.pagertree.com/int_xxxxxxx',data = pload)
print(r.text)
import requests
pload = {
'event_type':'acknowledge',
'Id':'monitor-1'
}
r = requests.post('https://api.pagertree.com/int_xxxxxxx',data = pload)
print(r.text)
import requests
pload = {
'event_type':'create',
'Id':'monitor-1',
'Title': 'Monitor 1 is Down for 60s',
'Description': 'Please check the monitor @ https://this.url'
}
r = requests.post('https://api.pagertree.com/int_xxxxxxx',data = pload)
print(r.text)
# Ignore alerts that don't have "requests a call"
rules:
- match:
alert.description:
$regex: "requests a call"
$options: "i"
actions:
- type: setval
map:
urgency: high
- type: setval
handlebars: true
map:
title: I just changed the title!
description: "See the alert {{log.data.external_url}}"
tags:
- some
- cool
- tags