Skip to content

Commit

Permalink
Merge pull request #51 from projectsyn/fix_alertmanager_config
Browse files Browse the repository at this point in the history
Fix alertmanager config
  • Loading branch information
TheBigLee authored Sep 26, 2022
2 parents 92d2a83 + 6247fd5 commit ae9d82c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 77 deletions.
14 changes: 13 additions & 1 deletion component/common.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ local removeNamespace = {
},
};

local resetAlertManagerConfig = {
alertmanager+:: {
config+:: {
receivers: [],
inhibit_rules: [],
route+: {
routes: [],
},
},
},
};

local stackForInstance = function(instanceName)
local confWithBase = com.makeMergeable(params.base) + com.makeMergeable(params.instances[instanceName]);
local cm = std.foldl(function(prev, k) prev {
Expand All @@ -95,7 +107,7 @@ local stackForInstance = function(instanceName)
// We need to explicitly handle enabling thanos, as upstream has a "null" in the field, making standard merge impossible
[if std.objectHas(confWithBase.prometheus.config, 'thanos') then 'thanos']: confWithBase.prometheus.config.thanos,
},
} + com.makeMergeable(cm),
} + resetAlertManagerConfig + com.makeMergeable(cm),
} + com.makeMergeable(overrides) + removeNamespace;

local render_component(configuredStack, component, prefix, instance) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"critical\"\n \"target_match_re\":\n \"severity\": \"warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"warning\"\n \"target_match_re\":\n \"severity\": \"info\"\
\n\"receivers\":\n- \"name\": \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\"\
: \"Critical\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"match\":\n \"alertname\": \"Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"match\":\n \"severity\": \"critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"critical\"\n \"target_match_re\":\n \"severity\": \"warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"warning\"\n \"target_match_re\":\n \"severity\": \"info\"\
\n\"receivers\":\n- \"name\": \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\"\
: \"Critical\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"match\":\n \"alertname\": \"Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"match\":\n \"severity\": \"critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = critical\"\n \"target_matchers\":\n - \"severity =~ warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = warning\"\n \"target_matchers\":\n - \"severity = info\"\n\
\"receivers\":\n- \"name\": \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\"\
: \"Critical\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"matchers\":\n - \"alertname = Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"matchers\":\n - \"severity = critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = critical\"\n \"target_matchers\":\n - \"severity =~ warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = warning\"\n \"target_matchers\":\n - \"severity = info\"\n\
- \"equal\":\n - \"namespace\"\n \"source_matchers\":\n - \"alertname = InfoInhibitor\"\
\n \"target_matchers\":\n - \"severity = info\"\n\"receivers\":\n- \"name\"\
: \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\": \"Critical\"\n- \"name\"\
: \"null\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"matchers\":\n - \"alertname = Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"matchers\":\n - \"alertname = InfoInhibitor\"\
\n \"receiver\": \"null\"\n - \"matchers\":\n - \"severity = critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = critical\"\n \"target_matchers\":\n - \"severity =~ warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = warning\"\n \"target_matchers\":\n - \"severity = info\"\n\
- \"equal\":\n - \"namespace\"\n \"source_matchers\":\n - \"alertname = InfoInhibitor\"\
\n \"target_matchers\":\n - \"severity = info\"\n\"receivers\":\n- \"name\"\
: \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\": \"Critical\"\n- \"name\"\
: \"null\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"matchers\":\n - \"alertname = Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"matchers\":\n - \"alertname = InfoInhibitor\"\
\n \"receiver\": \"null\"\n - \"matchers\":\n - \"severity = critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = critical\"\n \"target_matchers\":\n - \"severity =~ warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_matchers\":\n\
\ - \"severity = warning\"\n \"target_matchers\":\n - \"severity = info\"\n\
\"receivers\":\n- \"name\": \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\"\
: \"Critical\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"matchers\":\n - \"alertname = Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"matchers\":\n - \"severity = critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ metadata:
namespace: syn-prometheus
stringData:
alertmanager.yaml: "\"global\":\n \"resolve_timeout\": \"5m\"\n\"inhibit_rules\"\
:\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"critical\"\n \"target_match_re\":\n \"severity\": \"warning|info\"\
\n- \"equal\":\n - \"namespace\"\n - \"alertname\"\n \"source_match\":\n \
\ \"severity\": \"warning\"\n \"target_match_re\":\n \"severity\": \"info\"\
\n\"receivers\":\n- \"name\": \"Default\"\n- \"name\": \"Watchdog\"\n- \"name\"\
: \"Critical\"\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"group_interval\"\
: \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\n \"repeat_interval\"\
: \"12h\"\n \"routes\":\n - \"match\":\n \"alertname\": \"Watchdog\"\n\
\ \"receiver\": \"Watchdog\"\n - \"match\":\n \"severity\": \"critical\"\
\n \"receiver\": \"Critical\""
: []\n\"receivers\": []\n\"route\":\n \"group_by\":\n - \"namespace\"\n \"\
group_interval\": \"5m\"\n \"group_wait\": \"30s\"\n \"receiver\": \"Default\"\
\n \"repeat_interval\": \"12h\"\n \"routes\": []"
type: Opaque

0 comments on commit ae9d82c

Please sign in to comment.