Skip to content

Instantly share code, notes, and snippets.

@palladius
Last active November 22, 2022 08:59
Show Gist options
  • Select an option

  • Save palladius/5c109015324fc6bffbfce2f58525760f to your computer and use it in GitHub Desktop.

Select an option

Save palladius/5c109015324fc6bffbfce2f58525760f to your computer and use it in GitHub Desktop.
Sample JSON policy: it alerts me when my Macbook battery life is below 20%
{
"name": "projects/ric-cccwiki/alertPolicies/4142185058226000775",
"displayName": "Macbook at home K40 needs charger",
"documentation": {
"content": "Your Macbook Battery at home is below 50%. Mattley, fa qualcosa!",
"mimeType": "text/markdown"
},
"userLabels": {
"env": "prod",
"scope": "personal",
"reason": "macbook-needs-charger"
},
"conditions": [
{
"name": "projects/ric-cccwiki/alertPolicies/4142185058226000775/conditions/6329688841835481336",
"displayName": "Riccardo Macbook Battery - custom/BatteryLife",
"conditionThreshold": {
"aggregations": [
{
"alignmentPeriod": "300s",
"perSeriesAligner": "ALIGN_MEAN"
}
],
"comparison": "COMPARISON_LT",
"duration": "0s",
"filter": "resource.type = \"gce_instance\" AND resource.labels.instance_id = \"ricc-macbookpro3\" AND metric.type = \"custom.googleapis.com/BatteryLife\"",
"thresholdValue": 40,
"trigger": {
"count": 1
}
}
}
],
"alertStrategy": {
"autoClose": "604800s"
},
"combiner": "OR",
"enabled": true,
"notificationChannels": [
"projects/ric-cccwiki/notificationChannels/11244395096800566643",
"projects/ric-cccwiki/notificationChannels/13099078121529356635",
"projects/ric-cccwiki/notificationChannels/16791546489941562055"
],
"creationRecord": {
"mutateTime": "2022-11-10T04:55:42.517981702Z",
"mutatedBy": "my-private-email@gmail.com"
},
"mutationRecord": {
"mutateTime": "2022-11-12T17:31:36.396408365Z",
"mutatedBy": "my-private-email@gmail.com"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment