When trying to create panels with alerts, Client.SetDashboard returns
HTTP error 422: returns alert validation error: Panel id is not correct...
Below is how I created the Alert, I have filled in all the fields available.
resultAlert := sdk.Alert{
AlertRuleTags: map[string]string{},
Conditions: []sdk.AlertCondition{alertCondition},
ExecutionErrorState: panel.ExecutionErrorState,
Frequency: DefaultAlert.Frequency,
Handler: 1,
Name: alertName,
NoDataState: panel.NoDataState,
Notifications: []sdk.AlertNotification{alertNotification},
Message: panel.AlertMessage,
For: panel.ForDuration,
}
Let me know if you require details regarding each of the variables.
I found this line in Grafana: https://github.com/grafana/grafana/blob/0124dc8e6b0fb6cd881bb51c98391f2efe203b78/pkg/models/alert.go#L93
Through some testing, I found that adding a PanelID field to Alert in panel.go, then assigning a value to it fixes the problem.
May I know if this is indeed what should be added to the Alert struct or am I using it wrong?
When trying to create panels with alerts,
Client.SetDashboardreturnsHTTP error 422: returns alert validation error: Panel id is not correct...Below is how I created the
Alert, I have filled in all the fields available.Let me know if you require details regarding each of the variables.
I found this line in Grafana: https://github.com/grafana/grafana/blob/0124dc8e6b0fb6cd881bb51c98391f2efe203b78/pkg/models/alert.go#L93
Through some testing, I found that adding a
PanelIDfield toAlertinpanel.go, then assigning a value to it fixes the problem.May I know if this is indeed what should be added to the
Alertstruct or am I using it wrong?