I am trying to setup grafana alerts in helm chart.
For that, using the existing manually created alert from another grafana instance, which we want to keep in new grafana setup by default with helm chart.
As not able to find any export/import option, trying to edit manually. In this sample: helm-charts/values.yaml at main · grafana/helm-charts (github.com)
Found the alerts option in the values file link/ But not able to set below attributes
But, not able to find below option in the values file to set.
Please help. And also where to get datasourceUid and orgId values to set in alerts?
sample rule in chart:
alerting:
rules.yaml:
apiVersion: 1
groups:
- orgId: 1
folder: "Performance Metrics"
name: qtm
interval: 60s
rules:
- uid: my_id_1
condition: B
title: qtm
data:
- refId: A
queryType: ""
relativeTimeRange:
from: 600
to: 0
datasourceUid: "-100"
model:
editorMode: code
expr: '100 * (sum(rate(n_bolt_api_usage{app="data-cruncher-read-replica", err="internal"}[60m])) or vector(0)) / (vector(1) or (sum(rate(n_bolt_api_usage{app="data-cruncher-read-replica"}[60m]))))'
hide: false
intervalMs: 1000
legendFormat: __auto
maxDataPoints: 43200
range: true
refId: A
- refId: B
queryType: ""
relativeTimeRange:
from: 0
to: 0
datasourceUid: "-100"
model:
conditions:
- evaluator:
params:
- 10
type: gt
operator:
type: and
query:
params:
- A
reducer:
params: []
type: last
type: query
datasource:
type: __expr__
uid: "-100"
expression: A
hide: false
intervalMs: 1000
maxDataPoints: 43200
refId: B
type: classic_conditions
updated: "2022-09-22T18:27:51Z"
noDataState: NoData
execErrState: Alerting
for: 1h
annotations:
summary: P1 QTM High Internal Errors in API Usage
Getting error as:
logger=ngalert uid=my_id_1 org=1 version=4 attempt=0 now=2022-09-23T15:52:00Z t=2022-09-23T15:52:00.001235843Z level=error msg="failed to evaluate alert rule" results="[{Instance: State:Error Error:failed to execute conditions: invalid expression command type in 'A' EvaluatedAt:2022-09-23 15:52:00 +0000 UTC EvaluationDuration:1.232689ms EvaluationString: Values:map[]}]" duration=92.684µs