|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (1)
View Page History? !Screenshot from 2018-10-05 15-48-54.png|width=1112!
h1. Alerting
Alerts can be configured in multiple ways, here we'll briefly cover these two:
* *Prometheus* can push alerts to [*Alertmanager*|https://prometheus.io/docs/alerting/alertmanager/] which can notify through various channels
* *Grafana* can raise alerts and notify through various channels (including alertmanager)
h2. Using Prometheus
h3 Configuring rules
Prometheus can parse additional rule files, for this you must specify them in the prometheus configuration file:
{code}
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "alert_rules.yml"
{code}
And then configure alerts rules in this file, for instance :
{code}
groups:
- name: prometheus-alert-rules
rules:
- alert: TooManyErrors
expr: ServiceProviderInvocations{executionStatus="ERROR"} > 10
labels:
severity: minor
annotations:
summary: Services were in error
{code}
Then you can see the rule going to promtheus web UI. Here is an example of a triggered rule:
? !prometheus_alert_triggered.png|width=1112!
h3.Collecting in Alertmanager
h2. using Grafana
First, you must create a [notification channel|http://docs.grafana.org/alerting/notifications/] through grafana UI (Bell icon on the left panel). In our example we'll use email :
!grafana_notification_channel.png!
You may have to [configure SMTP|http://docs.grafana.org/installation/configuration/#smtp] in [grafana config file|http://docs.grafana.org/installation/configuration/].
Then, go to your dashboard and create a graph panel for the desired metric. In our example we'll use the providers services in error:
!grafana_alert_metric.png!
Then go to the "Alert" tab of this graph, and configure the [alert conditions|http://docs.grafana.org/alerting/rules/]. Also remember to add the notification channel to the rule.
!grafana_alert_rule.png!
you will then receive an email if the alert is raised.