Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Created March 31, 2021 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylebrandt/144a89302b811060abd38a628b96bcf6 to your computer and use it in GitHub Desktop.
Save kylebrandt/144a89302b811060abd38a628b96bcf6 to your computer and use it in GitHub Desktop.
cc ruler post example
POST http://admin:admin@localhost:3000/ruler/grafana/api/v1/rules/ng-alert-demo
Content-Type: application/json
{
"name": "test-group",
"interval": "10s",
"rules": [
{
"grafana_alert": {
"title": "prom query with SSE classic condition",
"condition": "B",
"no_data_state": "NoData",
"exec_err_state": "Alerting",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 300,
"to": 0
},
"model": {
"expr": "avg (node_network_transmit_bytes_total) by (instance,device)",
"legendFormat": "",
"interval": "",
"datasource": "gdev-prometheus",
"datasourceUid": "000000002",
"hide": false,
"intervalMs": 1000,
"refId": "A"
}
},
{
"model": {
"refId": "B",
"type": "classic_conditions",
"datasource": "__expr__",
"hide": false,
"conditions": [
{
"evaluator": {
"params": [
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasourceUid": "__expr__"
},
"refId": "B"
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment