mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
e7cd6eb13c
* Alerting: Use `alerting.GrafanaAlertmanager` instead of initialising Alertmanager components directly
23 lines
631 B
Go
23 lines
631 B
Go
package notifier
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
|
)
|
|
|
|
// TODO: We no longer do apimodels at this layer, move it to the API.
|
|
func (am *Alertmanager) GetStatus() apimodels.GettableStatus {
|
|
config := &apimodels.PostableUserConfig{}
|
|
status := am.Base.GetStatus()
|
|
if status == nil {
|
|
return *apimodels.NewGettableStatus(&config.AlertmanagerConfig)
|
|
}
|
|
|
|
if err := json.Unmarshal(status, config); err != nil {
|
|
am.logger.Error("unable to unmarshall alertmanager config", "Err", err)
|
|
}
|
|
|
|
return *apimodels.NewGettableStatus(&config.AlertmanagerConfig)
|
|
}
|