mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
[Alerting]: Alertmanager API implementation (#32174)
* Add validation for grafana recipient * Alertmanager API implementation (WIP) * Fix encoding/decoding receiver settings from/to YAML * Save templates together with the configuration * update POST to apply latest config * Alertmanager service enabled by the ngalert toggle * Silence API integration with Alertmanager * Apply suggestions from code review Co-authored-by: gotjosh <josue@grafana.com> Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b0ffcfd558
commit
a5e95823b2
@@ -30,6 +30,10 @@ var timeNow = time.Now
|
||||
|
||||
type Alertmanager interface {
|
||||
ApplyConfig(config *apimodels.PostableUserConfig) error
|
||||
CreateSilence(ps *apimodels.PostableSilence) (string, error)
|
||||
DeleteSilence(silenceID string) error
|
||||
GetSilence(silenceID string) (apimodels.GettableSilence, error)
|
||||
ListSilences(filters []string) (apimodels.GettableSilences, error)
|
||||
}
|
||||
|
||||
// API handlers.
|
||||
@@ -40,6 +44,7 @@ type API struct {
|
||||
DataService *tsdb.Service
|
||||
Schedule schedule.ScheduleService
|
||||
Store store.Store
|
||||
AlertingStore store.AlertingStore
|
||||
DataProxy *datasourceproxy.DatasourceProxyService
|
||||
Alertmanager Alertmanager
|
||||
}
|
||||
@@ -53,7 +58,7 @@ func (api *API) RegisterAPIEndpoints() {
|
||||
api.RegisterAlertmanagerApiEndpoints(NewForkedAM(
|
||||
api.DatasourceCache,
|
||||
NewLotexAM(proxy, logger),
|
||||
AlertmanagerApiMock{log: logger},
|
||||
AlertmanagerSrv{store: api.AlertingStore, am: api.Alertmanager, log: logger},
|
||||
))
|
||||
api.RegisterPrometheusApiEndpoints(NewForkedProm(
|
||||
api.DatasourceCache,
|
||||
|
||||
Reference in New Issue
Block a user