Prometheus alertmanager: Difference between revisions
From wikinotes
No edit summary |
|||
(23 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
| sample config || https://github.com/prometheus/alertmanager#example | | sample config || https://github.com/prometheus/alertmanager#example | ||
|- | |- | ||
| template docs || https://prometheus.io/docs/prometheus/latest/configuration/template_examples/ | |||
|} | |} | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> | ||
= | = Tutorials = | ||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| grafana/pagerduty tutorial || https://grafana.com/blog/2020/02/25/step-by-step-guide-to-setting-up-prometheus-alertmanager-with-slack-pagerduty-and-gmail/ | |||
|- | |||
|} | |||
</blockquote><!-- Tutorials --> | |||
= Routes = | |||
<blockquote> | <blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 20: | Line 30: | ||
| <code>9093</code> || default port that receives alerts | | <code>9093</code> || default port that receives alerts | ||
|- | |- | ||
| <code> | | <code>http://localhost:9093</code> || alertmanager ui | ||
|- | |- | ||
|} | |} | ||
</blockquote><!-- | </blockquote><!-- Routes --> | ||
= | = Locations = | ||
<blockquote> | <blockquote> | ||
{| class="wikitable" | |||
|- | |||
| <code>${PREFIX}/etc/alertmanager/alertmanager.yml</code> || alertmanager config | |||
</ | |- | ||
| <code>${PREFIX}/etc/prometheus.yml</code> || prometheus config | |||
|- | |||
| <code>/var/log/alertmanager.log</code> || default-log (unless alt syslog service - see [[alertmanager install]].) | |||
|- | |||
| <code>/var/db/alertmanager</code> || data dir | |||
|- | |||
|} | |||
</blockquote><!-- Locations --> | |||
= Notes = | |||
= | |||
<blockquote> | <blockquote> | ||
= | {| class="wikitable" | ||
|- | |||
| [[alertmanager install]] | |||
|- | |||
| [[alertmanager configuration]] | |||
|- | |||
| [[alertmanager configurations]] | |||
|- | |||
| [[alertmanager usage]] | |||
|- | |||
| [[alertmanager debugging]] | |||
|- | |||
|} | |||
</blockquote><!-- Notes --> | |||
= | = Usage = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | |||
<syntaxhighlight lang=" | amtool check-config alertmanager.yml # validate an alertmanager config | ||
</syntaxhighlight> | </syntaxhighlight> | ||
trigger a fake alert ([https://blog.mafr.de/2020/09/13/testing-alertmanager/ source]) | |||
<syntaxhighlight lang="bash"> | |||
#! /usr/bin/env sh | |||
<syntaxhighlight lang=" | |||
# /usr/ | |||
URL="http://localhost:9093/api/v1/alerts" | |||
curl -si -X POST -H "Content-Type: application/json" "$URL" -d ' | |||
[ | |||
{ | |||
"labels": { | |||
"alertname": "InstanceDown", | |||
"instance": "localhost:8080", | |||
"job": "node", | |||
"severity": "critical" | |||
}, | |||
"annotations": { | |||
"summary": "Instance is down" | |||
}, | |||
"generatorURL": "http://localhost:9090/graph" | |||
} | |||
] | |||
' | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- Usage --> | </blockquote><!-- Usage --> |
Latest revision as of 21:09, 20 February 2022
Alertmanager is the official service prometheus communicates with to issue alerts.
Documentation
Tutorials
grafana/pagerduty tutorial https://grafana.com/blog/2020/02/25/step-by-step-guide-to-setting-up-prometheus-alertmanager-with-slack-pagerduty-and-gmail/
Routes
9093
default port that receives alerts http://localhost:9093
alertmanager ui
Locations
${PREFIX}/etc/alertmanager/alertmanager.yml
alertmanager config ${PREFIX}/etc/prometheus.yml
prometheus config /var/log/alertmanager.log
default-log (unless alt syslog service - see alertmanager install.) /var/db/alertmanager
data dir
Notes
alertmanager install alertmanager configuration alertmanager configurations alertmanager usage alertmanager debugging
Usage
amtool check-config alertmanager.yml # validate an alertmanager configtrigger a fake alert (source)
#! /usr/bin/env sh URL="http://localhost:9093/api/v1/alerts" curl -si -X POST -H "Content-Type: application/json" "$URL" -d ' [ { "labels": { "alertname": "InstanceDown", "instance": "localhost:8080", "job": "node", "severity": "critical" }, "annotations": { "summary": "Instance is down" }, "generatorURL": "http://localhost:9090/graph" } ] '