Prometheus rules: Difference between revisions
From wikinotes
Line 10: | Line 10: | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> | ||
= | = Recording Rules (custom metrics) = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> |
Revision as of 02:34, 18 February 2022
Rules can be used to create new metrics, or to trigger alerts.
Documentation
official docs https://prometheus.io/docs/prometheus/latest/configuration/recording_rules/
Recording Rules (custom metrics)
# /usr/local/etc/memory_rules.yml groups: - name: available_memory rules: - record: node_available_memory_percent # metric rule-result is exposed as expr: node_memory_free_bytes / node_memory_size_bytes # PromQL query rule performs# /usr/local/etc/prometheus.yml rule_files: - "memory_rules.yml"service prometheus restartnow
node_available_memory_percent
metric should be cached and queryable.