Grafana grok example influxdb outside threshold range

From wikieduonline
Jump to navigation Jump to search
resource "grafana_rule_group" "example_rule_group" {
 org_id           = 1
 name             = "Every minute"
 folder_uid       = "example-folder-uid"
 interval_seconds = 60

 rule {
   name           = "Resource Usage Outside Threshold Range"
   condition      = "A"
   no_data_state  = "OK"
   exec_err_state = "Error"
   annotations    = {}
   labels         = {}
   is_paused      = false

   data {
     ref_id         = "A"
     datasource_uid = "example-datasource-uid"
     model          = jsonencode({
       datasource    = { type = "influxdb", uid = "example-datasource-uid" }
       measurement   = "telemetry.metric"
       select        = [[{ params = ["usage_value"], type = "field" }]]
       groupBy       = []
       orderByTime   = "ASC"
       policy        = "default"
       resultFormat  = "time_series"
       intervalMs    = 1000
       maxDataPoints = 43200
       conditions    = [
         {
           evaluator = { params = [30000], type = "lt" } # Lower threshold: < 30000
           operator  = { type = "or" }                    # Use OR to combine thresholds
           query     = { params = ["A"] }
           reducer   = { type = "last" }
           type      = "query"
         },
         {
           evaluator = { params = [50000], type = "gt" } # Upper threshold: > 50000
           operator  = { type = "or" }
           query     = { params = ["A"] }
           reducer   = { type = "last" }
           type      = "query"
         }
       ]
     })
     relative_time_range {
       from = 86400
       to   = 0
     }
   }
 }
}


Related[edit]

See also[edit]

Advertising: