Open call-stack opened 1 year ago
Setting up a cloudwatch alert on metric. But when I am opening the alert in grafana. Getting below error.
but when I re-select the same datasource from the list(done in UI) again, it worked.
Below is the code I am using to setup alert.
cloudwatch_alert = AlertRulev9( title="Test Alert", condition="B", triggers=[ CloudwatchMetricsTarget( datasource="fO0jguEGk", refId="A", dimensions={ "ClusterName": "test-cluster-qa", "ServiceName":"test-cluster-qa-jamuna" }, metricName = "RunningTaskCount", namespace="ECS/ContainerInsights" ), AlertExpression( refId="B", expressionType=EXP_TYPE_CLASSIC, expression='A', conditions=[ AlertCondition( evaluator=LowerThan(1), operator=OP_AND, reducerType=RTYPE_MIN ) ] ) ], evaluateFor="3m", ) # An AlertGroup is one group contained in an alert folder. alertgroup = AlertGroup( name="test-alert-group", rules=[ cloudwatch_alert ] ) my_alergroup_json = json.dumps(alertgroup.to_json_data())
Removing "datasource": self.datasource, from CloudwatchMetricsTarget inside grafanalib/cloudwatch.py fixed issue for me. Not sure if that is a correct way to handle it but temporarily it working fine for me.
"datasource": self.datasource,
CloudwatchMetricsTarget
grafanalib/cloudwatch.py
What happened?
Setting up a cloudwatch alert on metric. But when I am opening the alert in grafana. Getting below error.
but when I re-select the same datasource from the list(done in UI) again, it worked.
How to reproduce it?
Below is the code I am using to setup alert.