@melori.arellano
Could you help me please with the API request?
I use Postman for that.
- Make GET request to
http://url:3000/api/v1/provisioning/alert-rules/I1Nu1J6nz
This what I get:
{
"id": 94,
"uid": "I1Nu1J6nz",
"orgID": 1,
"folderUID": "UpxdWjhnz",
"ruleGroup": "Test",
"title": "Test alert",
"condition": "C",
"data": [
{
"refId": "A",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"datasourceUid": "MGGf-HtGz",
"model": {
"alias": "",
"editorMode": "code",
"expr": "kube_deployment_labels{cluster=\"test\"}",
"format": "table",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"range": true,
"refId": "A"
}
},
{
"refId": "B",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"A"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__"
},
"expression": "A",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"reducer": "mean",
"refId": "B",
"type": "reduce"
}
},
{
"refId": "C",
"queryType": "",
"relativeTimeRange": {
"from": 600,
"to": 0
},
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": [
"B"
]
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"name": "Expression",
"type": "__expr__",
"uid": "__expr__"
},
"expression": "$B < 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "C",
"type": "math"
}
}
],
"updated": "2022-11-25T19:45:17+03:00",
"noDataState": "NoData",
"execErrState": "Alerting",
"for": "15d",
"annotations": {
"summary": "{{ $labels.metric }} - {{ $values.A.Value }}"
},
"labels": {
"test": "true"
}
}
- Make PUT request to
http://url:3000/api/v1/provisioning/alert-rules/I1Nu1J6nz
with that payload in body, changing just the string
"expr": "kube_deployment_labels{cluster=\"test-test\"}"
And I get
{
"message": "invalid alert rule: no queries or expressions are found",
"traceID": ""
}
What is the problem?