Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Last active April 2, 2021 16:49
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/222c9801fad83a7b27951f97a593b7f0 to your computer and use it in GitHub Desktop.
Save kylebrandt/222c9801fad83a7b27951f97a593b7f0 to your computer and use it in GitHub Desktop.
Changing Rule Post Example (predicatable pulse)
POST http://admin:admin@localhost:3000/ruler/grafana/api/v1/rules/ng-alert-demo
Content-Type: application/json
{
"name": "test-group2",
"interval": "10s",
"rules": [
{
"grafana_alert": {
"title": "pp query with SSE classic condition",
"condition": "B",
"no_data_state": "NoData",
"exec_err_state": "Alerting",
"uid": "1SWAoclGz",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 30,
"to": 0
},
"model": {
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"intervalMs": 1000,
"maxDataPoints": 100,
"pulseWave": {
"offCount": 6,
"offValue": 1,
"onCount": 6,
"onValue": 10,
"timeStep": 5
},
"refId": "A",
"scenarioId": "predictable_pulse",
"stringInput": ""
}
},
{
"refId": "B",
"queryType": "",
"relativeTimeRange": {
"from": 0,
"to": 0
},
"model": {
"conditions": [
{
"evaluator": {
"params": [
3
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"A"
]
},
"reducer": {
"type": "last"
}
}
],
"datasource": "__expr__",
"datasourceUid": "-100",
"intervalMs": 1000,
"maxDataPoints": 100,
"refId": "B",
"type": "classic_conditions"
}
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment