mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
3ca00f90b5
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.
17 lines
400 B
Go
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)
|
|
}
|