Subscription
Siren lets you subscribe to a notification when they are triggered. You can define custom matching conditions and use receivers to describe which medium you want to use for getting the notifications when a notification is triggered. A notification could be triggered on-demand via API or by the incoming alerts via webhook.
Example Subscription:
{
"id": "385",
"urn": "siren-dev-prod-critical",
"namespace": "10",
"receivers": [
{
"id": "2"
},
{
"id": "1",
"configuration": {
"channel_name": "siren-dev-critical"
}
}
],
"match": {
"environment": "production",
"severity": "CRITICAL"
},
"created_at": "2021-12-10T10:38:22.364353Z",
"updated_at": "2021-12-10T10:38:22.364353Z"
}
The above means whenever any alert which has labels matching the labels
"environment": "production", "severity": "CRITICAL"
, send this alert to two medium defined by receivers with id: 2
and 1
. Assuming the receivers id 2
to be of Pagerduty type, a PD call will be invoked and assuming the receiver with id 1
to be slack type, a message will be sent to the channel #siren-dev-critical.
API Interface
Create a subscription
- CLI
- HTTP
$ siren subscription create --file subscription.yaml
$ curl --request POST
--url http://localhost:8080/v1beta1/subscriptions
--header 'content-type: application/json'
--data-raw '{
"urn": "siren-dev-prod-critical",
"receivers": [
{
"id": "1",
"configuration": {
"channel_name": "siren-dev-critical"
}
},
{
"id": "2"
}
],
"match": {
"severity": "CRITICAL",
"environment": "production"
},
"namespace": "10"
}'
Update a subscription
- CLI
- HTTP
$ siren subscription edit --id 10 --file subscription.yaml
$ curl --request PUT
--url http://localhost:8080/v1beta1/subscriptions/10
--header 'content-type: application/json'
--data-raw '{
"urn": "siren-dev-prod-critical",
"receivers": [
{
"id": "1",
"configuration": {
"channel_name": "siren-dev-critical"
}
},
{
"id": "2"
}
],
"match": {
"severity": "CRITICAL",
"environment": "production"
},
"namespace": "10"
}'
Get all subscriptions
- CLI
- HTTP
$ siren subscription list
$ curl --request GET
--url http://localhost:8080/v1beta1/subscriptions
Get a subscriptions
- CLI
- HTTP
$ siren subscription view 10
$ curl --request GET
--url http://localhost:8080/v1beta1/subscriptions/10
Delete subscriptions
- CLI
- HTTP
$ siren subscription delete 10
$ curl --request DELETE
--url http://localhost:8080/v1beta1/subscriptions/10