Skip to content

Instantly share code, notes, and snippets.

@kylebrandt
Created April 6, 2021 14:35
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/cb1f57e27d4443e63c916e36f3ae7eb2 to your computer and use it in GitHub Desktop.
Save kylebrandt/cb1f57e27d4443e63c916e36f3ae7eb2 to your computer and use it in GitHub Desktop.
Lots of Conditions
POST http://admin:admin@localhost:3000/api/alert-definitions/
Content-Type: application/json
{
"title": "classic many",
"condition": "G",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 300,
"to": 0
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "A",
"scenarioId": "predictable_csv_wave",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "B",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 300
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"hide": false,
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "B",
"scenarioId": "predictable_pulse",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "C",
"queryType": "",
"relativeTimeRange": {
"from": 300,
"to": 0
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 60,
"valuesCSV": "0,0,2,2,1,1"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"hide": false,
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "C",
"scenarioId": "predictable_pulse",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "D",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"hide": false,
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "D",
"scenarioId": "predictable_csv_wave",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "E",
"queryType": "",
"relativeTimeRange": {
"from": 300,
"to": 0
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"hide": false,
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "E",
"scenarioId": "predictable_csv_wave",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "F",
"queryType": "",
"relativeTimeRange": {
"from": 300,
"to": 0
},
"model": {
"alias": "",
"csvWave": {
"timeStep": 30,
"valuesCSV": "1,1,6,6,3,3"
},
"datasource": "gdev-testdata",
"datasourceUid": "000000004",
"hide": false,
"intervalMs": 1000,
"lines": 10,
"maxDataPoints": 100,
"points": [],
"pulseWave": {
"offCount": 3,
"offValue": 1,
"onCount": 3,
"onValue": 2,
"timeStep": 60
},
"refId": "F",
"scenarioId": "predictable_csv_wave",
"stream": {
"bands": 1,
"noise": 2.2,
"speed": 250,
"spread": 3.5,
"type": "signal"
},
"stringInput": ""
}
},
{
"refId": "G",
"queryType": "",
"relativeTimeRange": {
"from": 0,
"to": 0
},
"model": {
"conditions": [
{
"evaluator": {
"params": [
3
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"C"
]
},
"reducer": {
"type": "avg"
}
},
{
"evaluator": {
"params": [
2,
5
],
"type": "within_range"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"B"
]
},
"reducer": {
"type": "max"
}
},
{
"evaluator": {
"params": [
6
],
"type": "gt"
},
"operator": {
"type": "or"
},
"query": {
"Params": [
"A"
]
},
"reducer": {
"type": "sum"
}
},
{
"evaluator": {
"params": [
7
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"A"
]
},
"reducer": {
"type": "last"
}
},
{
"evaluator": {
"params": [],
"type": "no_value"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"C"
]
},
"reducer": {
"type": "diff"
}
},
{
"evaluator": {
"params": [
9
],
"type": "gt"
},
"operator": {
"type": "or"
},
"query": {
"Params": [
"E"
]
},
"reducer": {
"type": "diff_abs"
}
},
{
"evaluator": {
"params": [
10
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"F"
]
},
"reducer": {
"type": "percent_diff"
}
},
{
"evaluator": {
"params": [
11
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"Params": [
"D"
]
},
"reducer": {
"type": "percent_diff_abs"
}
}
],
"datasource": "__expr__",
"datasourceUid": "-100",
"intervalMs": 1000,
"maxDataPoints": 100,
"refId": "G",
"type": "classic_conditions"
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment