Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Last active December 15, 2020 15:17
Show Gist options
  • Save kylebrandt/3aee7b851f8afa120f6c11600975cac6 to your computer and use it in GitHub Desktop.
Save kylebrandt/3aee7b851f8afa120f6c11600975cac6 to your computer and use it in GitHub Desktop.
Simpler Data source query Alert Def Post Example
POST http://admin:admin@localhost:3000/api/alert-definitions/
Content-Type: application/json
{
"name": "Example Alert POST",
"condition": {
"refId": "C",
"interval": 10,
"queriesAndExpressions": [
{
"model": {
"points": [],
"stream": {
"type": "signal",
"speed": 250,
"spread": 3.5,
"noise": 2.2,
"bands": 1
},
"pulseWave": {
"timeStep": 300,
"onCount": 3,
"onValue": 2,
"offCount": 3,
"offValue": 1
},
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"stringInput": "",
"scenarioId": "predictable_pulse",
"lines": 10,
"refId": "A",
"alias": "",
"datasource": "gdev-testdata",
"datasourceId": 4
},
"relativeTimeRange": {
"From": 500,
"To": 0
},
"refId": "A"
},
{
"model": {
"type": "reduce",
"datasource": "__expr__",
"reducer": "mean",
"expression": "A"
},
"refId": "B"
},
{
"model": {
"type": "math",
"datasource": "__expr__",
"expression": "$B > 10"
},
"refId": "C"
}
]
}
}
{
"type": "graph",
"title": "Panel Title",
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 9
},
"id": 23763571993,
"datasource": "-- Mixed --",
"targets": [
{
"points": [],
"stream": {
"type": "signal",
"speed": 250,
"spread": 3.5,
"noise": 2.2,
"bands": 1
},
"pulseWave": {
"timeStep": 300,
"onCount": 3,
"onValue": 2,
"offCount": 3,
"offValue": 1
},
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"stringInput": "",
"scenarioId": "predictable_pulse",
"lines": 10,
"refId": "A",
"alias": "",
"datasource": "gdev-testdata"
},
{
"refId": "B",
"type": "reduce",
"datasource": "__expr__",
"reducer": "mean",
"expression": "A"
},
{
"refId": "C",
"type": "math",
"datasource": "__expr__",
"expression": "$B > 10"
}
],
"options": {
"alertThreshold": true
},
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"pluginVersion": "7.4.0-pre",
"renderer": "flot",
"yaxes": [
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short",
"$$hashKey": "object:40"
},
{
"label": null,
"show": true,
"logBase": 1,
"min": null,
"max": null,
"format": "short",
"$$hashKey": "object:41"
}
],
"xaxis": {
"show": true,
"mode": "time",
"name": null,
"values": [],
"buckets": null
},
"yaxis": {
"align": false,
"alignLevel": null
},
"lines": true,
"fill": 1,
"fillGradient": 0,
"linewidth": 1,
"dashes": false,
"hiddenSeries": false,
"dashLength": 10,
"spaceLength": 10,
"points": false,
"pointradius": 2,
"bars": false,
"stack": false,
"percentage": false,
"legend": {
"show": true,
"values": false,
"min": false,
"max": false,
"current": false,
"total": false,
"avg": false
},
"nullPointMode": "null",
"steppedLine": false,
"tooltip": {
"value_type": "individual",
"shared": true,
"sort": 0
},
"aliasColors": {},
"seriesOverrides": [],
"thresholds": [],
"timeRegions": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment