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

* 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

(cherry picked from commit b9cdad3814)

Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com>
This commit is contained in:
Grot (@grafanabot)andJean-Philippe Quéméner authored and GitHub committed 2021-11-19 17:17:08 +01:00
1 parent 66a91bb55b
commit 3d4a5ce8fa
7 files changed
+49 -7

No files matched your search

@@ -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