Note
This feature is available starting from the MCP 2019.2.9 maintenance update. Before using the feature, follow the steps described in Apply maintenance updates.
This section describes how to enable StackLight LMA to send notifications to specific receivers such as PagerDuty, OpsGenie, and so on using the Alertmanager service on an existing MCP cluster. For a list of supported receivers, see Prometheus Alertmanager documentation: Receiver.
The changes performed within the following procedure are backward compatible with previous MCP releases. Therefore, you do not need to change any of the already configured Alertmanager receivers and routes.
To enable Alertmanager integrations:
Open your project Git repository with the Reclass model on the cluster level.
Open the <classes/cluster/<cluster>/stacklight/server.yml>
file for
editing.
Configure the Alertmanager receiver route as required:
parameters:
prometheus:
alertmanager:
enabled: true
config:
route:
routes:
<route_name>:
receiver: <receiver_name>
match_re:
- label: '<name_of_the_alert_label>'
value: '<regex_to_identify_the_route>'
continue: true
receiver:
<receiver_name>:
enabled: true
generic_configs: # <- here is the difference
<chosen_Alertmanager_receiver_type>:
<receiver_endpoint_name>:
<receiver_config>
Parameter name | Description |
---|---|
routes |
Specify a unique route name. |
receiver |
Specify a unique receiver name. |
match_re |
|
receiver |
Specify a unique receiver name. Set to the same value as routes . |
generic_configs |
|
Example configuration:
parameters:
prometheus:
alertmanager:
enabled: true
config:
route:
routes:
opsgenie:
receiver: HTTP-opsgenie
match_re:
- label: route
value: '(.*opsgenie.*)'
continue: true
receiver:
HTTP-opsgenie:
enabled: true
generic_configs:
opsgenie_configs:
opsgenie-endpoint:
api_url: "https://example.app.eu.opsgenie.com/"
api_key: "opsgeniesecretkey"
send_resolved: true
If you have previously configured email notifications through Alertmanager,
verify that the prometheus_server_alert_label_route
parameter also
includes the receiver that you are configuring. For example:
parameters:
_param:
prometheus_server_alert_label_route: email;opsgenie;
Log in to the Salt Master node.
Verify the Reclass model:
reclass -i
The output should not include any errors.
Verify that the changes render properly:
salt '*mon*' state.sls prometheus.alertmanager test=True
Example of system response for the configuration provided above:
routes:
- receiver: default
[...]
# opsgenie
- receiver: HTTP-opsgenie
continue: True
match_re:
route: '(.*opsgenie.*)'
[...]
receivers:
- name: 'default'
[...]
- name: 'HTTP-opsgenie'
opsgenie_configs:
# opsgenie-endpoint
-
api_key: opsgeniesecretkey
api_url: https://example.app.eu.opsgenie.com/
send_resolved: true
[...]
Update the Prometheus and Alertmanager configuration:
salt '*mon*' state.sls prometheus.server -b 1
salt '*mon*' state.sls prometheus.alertmanager