Hello,
I am trying to deploy several alerts using the Grafana API, everything works fine expect for the evaluation interval parameter; In my JSON I tried “interval”, “IntervalSeconds” and “interval_seconds” as in terraform doc, but none worked.
Do you have any idea about whats happening?
Here is my JSON:
{
'orgID': 1,
'folderUID': 'ddebef16-293c-4c45-8925-dc442846d644',
'ruleGroup': '$$',
'interval': '3600s',
'title': 'title',
'condition': 'B',
'data': [
{
'refId': 'A',
'queryType': '',
'relativeTimeRange': {
'from': 600,
'to': 0
},
'datasourceUid': 'debcd7b9-3788-44cf-a141-56194c8a707a',
'model': {
'editorMode': 'code',
'format': 'table',
'hide': False,
'intervalMs': 1000,
'maxDataPoints': 43200,
'rawQuery': True,
'rawSql': f"select ... from ... where __ = {event}",
'refId': 'A',
'sql': {
'columns': [
{
'parameters': [],
'type': 'function'
}
],
'groupBy': [
{
'property': {
'type': 'string'
},
'type': 'groupBy'
}
],
'limit': 50
}
}
},
{
'refId': 'B',
'queryType': '',
'relativeTimeRange': {
'from': 600,
'to': 0
},
'datasourceUid': '__expr__',
'model': {
'conditions': [
{
'evaluator': {
'params': [0, 0],
'type': 'gt'
},
'operator': {
'type': 'and'
},
'query': {
'params': []
},
'reducer': {
'params': [],
'type': 'avg'
},
'type': 'query'
}
],
'datasource': {
'name': 'Expression',
'type': '__expr__',
'uid': '__expr__'
},
'expression': '$A == 1',
'intervalMs': 1000,
'maxDataPoints': 43200,
'refId': 'B',
'type': 'math'
}
}
],
'updated': '2023-07-17T09:42:35Z',
'noDataState': 'NoData',
'execErrState': 'Error',
'for': '0s',
'annotations': {
'description': '$$: {{ $labels.$$ }}'
},
'labels': {
'$$': '$$'
},
'isPaused': False
}
One solution I found is creating an empty alert with evaluation group that has an interval set to 1h, and then create alerts with the same evaluation group.
Is there any other solution to specify the interval via the API?