Hey, can someone help me understand the ‘interval: 5m’, ‘relativeTimeRange’ , ‘intervalMs’ and ‘maxDataPoints’ ?
I am using this yaml:
groups:
- orgId: 1
name: statefulset status
folder: derms
interval: 5m
rules:
- uid: f37b5c90-7485-4adf-b056-d216df1d1d0c
title: statefulset
condition: C
data:
- refId: A
relativeTimeRange:
from: 600
to: 0
datasourceUid: prometheus
model:
editorMode: code
expr: sum(kube_statefulset_replicas) by (namespace, statefulset) - sum(kube_statefulset_status_replicas_ready) by (namespace, statefulset)
hide: false
instant: false
intervalMs: 1000
maxDataPoints: 43200
range: true
refId: A
- refId: B
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params: []
type: gt
operator:
type: and
query:
params:
- B
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: A
hide: false
intervalMs: 1000
maxDataPoints: 43200
reducer: last
refId: B
type: reduce
- refId: C
relativeTimeRange:
from: 600
to: 0
datasourceUid: __expr__
model:
conditions:
- evaluator:
params:
- 0
type: gt
operator:
type: and
query:
params:
- C
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: __expr__
expression: B
hide: false
intervalMs: 1000
maxDataPoints: 43200
refId: C
type: threshold
noDataState: NoData
execErrState: Error
for: 10m
annotations:
summary: |
{{` {{ $values.B }} {{ $labels.statefulset }} pod(S) in namespace {{ $labels.namespace }} are not running. `}}
labels:
SendTo: slack
Severity: critical
isPaused: false
- I understand that it evaluate the rule every 5 minute, but will send alert only if the alert happen for 10 min?
- if in between the pod statefulset was running, will it not alert?
- Is this a good example of using the grafana alert? at first I thought to make it check every 30 min, and give the pod another 5 min to come back, but I understand this is not how it is working… (?)