Alerting: Implement GetStatus in the remote Alertmanager struct (#84887)

* Alerting: Implement GetStatus in the remote Alertmanager struct

* update tests

* fix tests, extract AlertmanagerConfig from PostableConfig

* get the remote AM config instead of the Grafana one from the remote AM

* pass grafana AM config in test

* return error in GetStatus instead of logging it (internal AM)
This commit is contained in:
Santiago
2024-05-03 13:59:02 +02:00
committed by GitHub
parent b6f899d953
commit b76a9e4d31
11 changed files with 167 additions and 46 deletions
+6 -1
View File
@@ -48,7 +48,12 @@ func (srv AlertmanagerSrv) RouteGetAMStatus(c *contextmodel.ReqContext) response
return errResp
}
status := am.GetStatus()
status, err := am.GetStatus(c.Req.Context())
if err != nil {
srv.log.Error("Unable to get status for the alertmanager", "error", err)
return ErrResp(http.StatusInternalServerError, err, "failed to get status for the Alertmanager")
}
if !c.SignedInUser.HasRole(org.RoleAdmin) {
notifier.RemoveAutogenConfigIfExists(status.Config.Route)
}