This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "timeseries", | |
| "name": "orders-weather", | |
| "default_datasource": "influx", | |
| "max_evals": 50, | |
| "bucket_interval": "1h", | |
| "span": "auto", | |
| "offset": 30, | |
| "interval": "24h", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "type": "timeseries", | |
| "name": "orders", | |
| "default_datasource": "influx", | |
| "max_evals": 50, | |
| "bucket_interval": "24h", | |
| "span": "auto", | |
| "offset": 30, | |
| "interval": 60, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select temp, clouds from weather where time >='2015-06-30T00:00:00Z' limit 5 | |
| name: weather | |
| time temp clouds | |
| ---- ---- ------ | |
| 1435622400000000000 18.33000000000004 0 | |
| 1435626000000000000 17.760000000000048 0 | |
| 1435629600000000000 16.439999999999998 0 | |
| 1435633200000000000 15.840000000000032 0 | |
| 1435636800000000000 15.340000000000032 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from orders where time >='2015-06-30T00:00:00Z' limit 5 | |
| name: orders | |
| time count | |
| ---- ----- | |
| 1435622400000000000 388 | |
| 1435626000000000000 384 | |
| 1435629600000000000 375 | |
| 1435633200000000000 371 | |
| 1435636800000000000 368 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var model = 'telegraf_metrics_count_value_10s' | |
| var from_measurement = 'loudml' | |
| var out_db = 'telegraf' | |
| var retention_policy = 'autogen' | |
| var out_measurement = 'predicted' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var pos = data | |
| |changeDetect('is_anomaly') | |
| |alert() | |
| .warn(lambda: "is_anomaly" == TRUE) | |
| .crit(lambda: "is_anomaly" == TRUE AND "score" > 90.0) | |
| .message('{{if ne .Level "OK" }} Hey, unexpected situation detected score={{ index .Fields "score" | printf "%0.3f" }} {{else}} Back to normal {{end}}') | |
| .pagerDuty2() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data_dir = "/var/lib/kapacitor" | |
| [pagerduty2] | |
| enabled = true | |
| routing-key = "" | |
| url = "https://events.pagerduty.com/v2/enqueue" | |
| global = false | |
| [logging] | |
| # Destination for logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var neg = data | |
| |stateCount(lambda: "is_anomaly" == FALSE) | |
| |alert() | |
| .info(lambda: "state_count" == 1) | |
| .message('{{ .Time }}: situation back to normal model={{ index .Fields "model" }} state=finished score={{ index .Fields "score" | printf "%0.3f" }}.') | |
| .slack() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var pos = data | |
| // the next node counts abnormal data points | |
| |stateCount(lambda: "is_anomaly" == TRUE) | |
| |alert() | |
| // Warn after 1 point | |
| .warn(lambda: "state_count" >= 1) | |
| // Critical after 5 points and abnormal higher than 90 / 100 | |
| .crit(lambda: "state_count" >= 5 AND "score" > 90.0) | |
| .message('{{ .Time }}: Hey, unexpected situation detected by model={{ index .Fields "model" }} state=ongoing score={{ index .Fields "score" | printf "%0.3f" }}.') | |
| .slack() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var data = stream | |
| // this from node selects all input data received in the given measurement | |
| |from() | |
| .measurement(from_measurement) | |
| .where(lambda: "model" == model) | |
| // this eval node remembers the model name | |
| |eval(lambda: model) | |
| .as('model') | |
| .keep() | |
| // the next five lines save the data to the target database into a new measurement |
NewerOlder