Architecture
Alerts based on metrics are generated by Prometheus and routed via Alertmanager. They can be either send centrally from the Alertmanager on XCC or from the Alertmanager on all VMs (MTAs & XCC). While the former is simpler to set up, it creates a single point of failure on the XCC Prometheus / Alertmanager and we recommend to generate alerts on all VMs. Alerts based on logs can only be generated by Loki on XCC, and are routed via the XCC Alertmanager. xorlab does currently not ship with log based alerts by default.Alert receivers
Configuration examples
Alertmanager configuration comes with the following example configurations:alertmanager.yml- No alerts (default)alertmanager.email.yml- Email notification examples, one basic example and one with severity based routing.alertmanager.webhook.yml- Generic webhook examplealertmanager.slack.yml- Slack integaration example.
receivers and adjusting the route configuration accordingly, similar to the Email receiver (with routing) example. Alertmanager supports more receivers and allows for more advanced configuration (e.g. alerts being sent to more than one receiver, complex routing, etc.), see also prometheus.io - Route-related settings.
- No alerts (default)
- Email receiver (basic)
- Email receiver (with routing)
- Webhook receiver
- Slack receiver
By default, Alertmanager does not send alerts to any real receivers, all alerts are routed to a no-op / blackhole receiver.
Applying the configuration
The configuration can be found in the Expert Editor under/monitoring/alertmanager for the XCC monitoring and in the /monitored_mta/alertmanager for the MTA monitoring. The file alertmanager.yml always holds the currently active configuration. To use the config provided in the example files, e.g. for email notifications, you can either:
- rename
alertmanager.ymltoalertmanager.noop.yml, and then renamealertmanager.email.ymltoalertmanager.yml, or - copy the content of
alertmanager.email.ymland paste it into toalertmanager.yml
- Open the Expert Editor.
-
The various config examples described above are saved in
/monitoring/alertmanager -
Optionally you can back up
alertmanager.ymlby duplicating the file, e.g. intoalertmanager.noop.yml -
To use a specific configuration copy and paste the config into:
/monitoring/alertmanager/alertmanager.ymlfor XCC alerting, and/monitored_mta/alertmanager/alertmanager.ymlfor MTA alerting
- Click PUBLISH to commit the changes and wait one minute for the Prometheus to reload the config. See also How to Activate the Configuration.
Testing alerts
To trigger a test alert, and verify that the routing and configuration is correct, SSH to the host and execute the following command:- XCC
- MTA
route.group_wait (or the same value under the specific severity you have used) in the /monitoring/alertmanager/alertmanager.yml file opened in the Expert Editor (the default value is one minute).
Troubleshooting alerts
When something is not working as expected, you can check the logs of Prometheus (which creates the Alerts) and Alertmanager (which sends the alerts to the external systems [receivers]) to see if there are any errors:- XCC
- MTA
Prometheus logs:Alertmanager logs:
log.level setting to enable further debug logs of Prometheus. Go to the /monitoring/prometheus/prometheus.properties (for XCC monitoring) or /monitored_mta/prometheus/prometheus.properties (for MTA monitoring) and uncomment the following line:
infowarnerror
healthy:
Optional Settings
Adding a custom alert
Custom alerting rules should be added to/monitoring/prometheus/alerts/custom.yml for alerting rules evaluated on XCC and to /monitored_mta/prometheus/alerts/custom.yml for alerting rules evaluated on the MTAs. In addition, custom rules must be activated in
/monitoring/prometheus/prometheus.yml, respectively /monitored_mta/prometheus/prometheus.yml.
Alerting rules are described in the official documentation
- Open the Expert Editor.
-
Navigate to the
/monitoring/prometheus/alerts. -
Add rules to
custom.yml -
Add
custom.ymlto the list ofrule_filesin/monitoring/prometheus/prometheus.yml: - Click PUBLISH to commit the changes and wait one minute for the Prometheus to reload the config. See also How to Activate the Configuration.
Customizing a notification template
- Open the Expert Editor.
-
Navigate to the
/monitoring/alertmanager/template/custom.tmpl, and edit the template. These templates use Go templating, some examples can be found in the Alerting documentation. -
Enable the template by uncommenting the corresponding line in the current Alertmanager config file
monitoring/alertmanager/alertmanager.yml(provided you have already choose a config example, e.g.alertmanager.email.ymloralertmanager.slack.yml, see Alert receivers), and comment out the default template line: - Click PUBLISH to commit the changes and wait one minute for the Alertmanager to reload the config. See also How to Activate the Configuration.
Enabling notifications for resolved alerts
If you want to enable notifications about resolved alerts, you have to add thesend_resolved property and set it to true for your selected receiver.
-
Open your active
alertmanager.ymlconfig file. -
Find the
receiversgroup, and under the chosen receiver config addsend_resolved: true. For example, the receivers config for email alerts should look like this: - Click PUBLISH to commit the changes and wait one minute for the Alertmanager to reload the config. See also How to Activate the Configuration.