grafana/pkg/services/ngalert/notifier/status.go
George Robinson 3ca00f90b5
Contact point testing (#37308)
This commit adds contact point testing to ngalerts via a new API
endpoint. This endpoint accepts JSON containing a list of
receiver configurations which are validated and then tested
with a notification for a test alert. The endpoint returns JSON
for each receiver with a status and error message. It accepts
a configurable timeout via the Request-Timeout header (in seconds)
up to a maximum of 30 seconds.
2021-08-17 13:49:05 +01:00

17 lines
400 B
Go

package notifier
import (
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
)
func (am *Alertmanager) GetStatus() apimodels.GettableStatus {
am.reloadConfigMtx.RLock()
defer am.reloadConfigMtx.RUnlock()
config := apimodels.PostableApiAlertingConfig{}
if am.ready() {
config = am.config.AlertmanagerConfig
}
return *apimodels.NewGettableStatus(&config)
}