mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 04:04:00 -06:00
2e8c514cfd
Updates Grafana Alertmanager to work with new interface from grafana/alerting#161. This change stops passing user-defined templates to the Grafana Alertmanager by persisting them to disk and instead passes them by string.
23 lines
716 B
Go
23 lines
716 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() // TODO: This should return a GettableStatus, for now it returns PostableUserConfig.
|
|
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)
|
|
}
|