Reputation: 21
I am looking for "working"/"syntactically correct" (python) samples for provisioning unified alerts to grafana.
A have a pure terraform config file, provided by grafana, however, the python syntax complicates it further.
Upvotes: 0
Views: 101
Reputation: 21
I have not the time to post my code yet, however the only problem is defining the model
of RuleGroupRuleData
.
You may want to copy the model of a GUI-defined alert from here:
/api/ruler/grafana/api/v1/rules
Just copy it using a heredoc-python string:
grafana_RuleGroupRuleData = [RuleGroupRuleData(
ref_id = "A",
query_type = "",
relative_time_range = dict(from_ = 600, to = 0),
datasource_uid = grafana_dataSource.uid,
model = """{
"alias": "$col",
"datasource": {
"type": "influxdb",
"uid": "datasource_influxdb"
},
"groupBy": [ ...
"""
Upvotes: 0