You can enable StackLight LMA to filter notifications and send the
particular ones to specified notification channels. For example, you can
configure StackLight LMA to send the CRITICAL
notifications to email and
WARNING
notifications to Slack.
To enable notifications filtering:
Log in to the Salt Master node.
Open the classes/cluster/<cluster_name>/stacklight/server.yml
file of
the Reclass model for editing.
Specify the label
and value
parameters in the match_re
section for a particular receiver.
Examples:
To send the CRITICAL
notifications to email:
parameters:
prometheus:
alertmanager:
enabled: true
config:
route:
routes:
email:
receiver: SMTP
match_re:
- label: route
value: '(.*email.*)'
- label: severity
value: critical
continue: true
To send the CRITICAL
and WARNING
notifications to Slack:
parameters:
prometheus:
alertmanager:
enabled: true
config:
route:
routes:
slack:
receiver: HTTP-slack
match_re:
- label: route
value: '(.*slack.*)'
- label: severity
value: critical|warning
continue: true
Apply the changes:
salt -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus.server -b1