Alerting: support mute timings configuration through the api for the embedded alertmanager (#41533)

* Alerting: accept mute_timing_intervals through the api for the embedded alertmanager

* add workaround for mutetimeinterval

* add mute timings to routes

* revert changes

* Update pkg/services/ngalert/api/api_alertmanager.go

* Update pkg/services/ngalert/api/api_alertmanager.go

* Update pkg/services/ngalert/api/api_alertmanager.go

* update prometheus/alertmanager dependency

* add some var docs
This commit is contained in:
Jean-Philippe Quéméner
2021-11-19 16:50:55 +01:00
committed by GitHub
parent e7ec219291
commit b9cdad3814
7 changed files with 49 additions and 7 deletions
@@ -587,10 +587,11 @@ func (c *GettableApiAlertingConfig) validate() error {
// Config is the top-level configuration for Alertmanager's config files.
type Config struct {
Global *config.GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
Route *Route `yaml:"route,omitempty" json:"route,omitempty"`
InhibitRules []*config.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"`
Templates []string `yaml:"templates" json:"templates"`
Global *config.GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"`
Route *Route `yaml:"route,omitempty" json:"route,omitempty"`
InhibitRules []*config.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"`
MuteTimeIntervals []config.MuteTimeInterval `yaml:"mute_time_intervals,omitempty" json:"mute_time_intervals,omitempty"`
Templates []string `yaml:"templates" json:"templates"`
}
// A Route is a node that contains definitions of how to handle alerts. This is modified
@@ -3,6 +3,19 @@
"foo": "bar"
},
"alertmanager_config": {
"mute_time_intervals": [
{
"name": "foo",
"time_intervals": [
{
"years": [
"2020:2022",
"2030"
]
}
]
}
],
"receivers": [
{
"email_configs": [
@@ -1,6 +1,12 @@
template_files:
foo: bar
alertmanager_config: |
mute_time_intervals:
- name: foo
time_intervals:
- years:
- 2020:2022
- "2030"
receivers:
- email_configs:
- auth_password: shh