Prometheus configuration: Difference between revisions
From wikinotes
(→Rules) |
|||
Line 23: | Line 23: | ||
</blockquote><!-- Exporters --> | </blockquote><!-- Exporters --> | ||
== Rules == | == Alerts/Rules == | ||
<blockquote> | <blockquote> | ||
You can configure '''Alerts''' with '''rules'''. | |||
</blockquote><!-- Rules --> | <syntaxhighlight lang="yaml"> | ||
global: | |||
evaluation_interval: 15s # rules evaluated every 15s | |||
alerting: | |||
alertmanagers: | |||
- static_configs: | |||
- targets: | |||
- alertmanager:9003 | |||
rule_files: | |||
- first_rules.yml | |||
</syntaxhighlight> | |||
</blockquote><!-- Alerts/Rules --> | |||
</blockquote><!-- Prometheus --> | </blockquote><!-- Prometheus --> |
Revision as of 02:26, 16 February 2022
Prometheus
Exporters
Configure jobs to poll prometheus metric exporter endpoints within
scrape_configs
.
For example, the following config polls metrics fromhttp://localhost:9115/metrics
every5s
.# /usr/local/etc/prometheus.yml global: scrape_interval: 5s scrape_configs: - job_name: my-server metrics_path: /metrics # (default) route to query metrics from scheme: http # (default) scheme to use for query static_configs: - targets: - localhost:9115 # query this ip-addr/portAlerts/Rules
You can configure Alerts with rules.
global: evaluation_interval: 15s # rules evaluated every 15s alerting: alertmanagers: - static_configs: - targets: - alertmanager:9003 rule_files: - first_rules.yml