Reputation: 121
I have the following notification rule:
curl -X POST http://influx:8086/api/v2/notificationRules -H "Authorization: Token <my token>" -H "Content-Type: application/json" -d '{
"description": "Alert on spikes detected in traffic data",
"endpointID": "1261ec31969a7d96",
"every": "15s",
"messageTemplate": "Spike detected in {{ .Name }}: Last value: {{ index .Fields \"last\" }}, Mean: {{ index .Fields \"mean\" }}, StdDev: {{ index .Fields \"stddev\" }}",
"name": "spike_detection_rule",
"orgID": "a6ce0bd763dc7a0b",
"query": {
"text": "option task = {name: \"spike_detection_task\", every: 15s}\n\nfrom(bucket: \"one_hour\")\n |> range(start: -15m)\n |> filter(fn: (r) => r._measurement == \"convs_traffic_over_time_15m\")\n |> filter(fn: (r) => r._field == \"all_data\")\n |> mean()\n |> yield(name: \"mean\")\n |> stddev()\n |> yield(name: \"stddev\")\n |> last()",
"type": "flux"
},
"status": "active",
"statusRules": [
{
"currentLevel": "OK"
},
{
"currentLevel": "CRITICAL"
}
],
"type": "http"
}
When the rule task is running it completes successfully. However, the http post request is not going out from influx. The endpoint is define in the notification endpoint for which I am specifying the endpointid in the script. The 'one_hour' bucket data looks like that:
Result: _result
Table: keys: [_start, _stop, _field, _measurement]
_start:time _stop:time _field:string _measurement:string _time:time _value:int
------------------------------ ------------------------------ ---------------------- --------------------------- ------------------------------ --------------------------
2024-09-26T14:06:07.862164087Z 2024-09-26T15:06:07.862164087Z all_data convs_traffic_over_time_15m 2024-09-26T14:06:17.272195842Z 0
Table: keys: [_start, _stop, _field, _measurement]
_start:time _stop:time _field:string _measurement:string _time:time _value:int
------------------------------ ------------------------------ ---------------------- --------------------------- ------------------------------ --------------------------
2024-09-26T14:06:07.862164087Z 2024-09-26T15:06:07.862164087Z count convs_traffic_over_time_15m 2024-09-26T14:06:17.272195842Z 0
Is the bucket missing some information to make the rule task triggered? Is it something wrong in my rule script? influx logs do not show any details about the http post request. Any help is appreciated.
Upvotes: 0
Views: 37