Prometheus rules: Difference between revisions
From wikinotes
No edit summary |
|||
Line 1: | Line 1: | ||
Rules can be used to create new metrics, or to trigger alerts. | |||
= Documentation = | = Documentation = | ||
<blockquote> | <blockquote> | ||
Line 8: | Line 10: | ||
</blockquote><!-- Documentation --> | </blockquote><!-- Documentation --> | ||
= | = Custom Metric = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
Line 30: | Line 32: | ||
service prometheus restart # new metric should be available | service prometheus restart # new metric should be available | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</blockquote><!-- | </blockquote><!-- Custom Metric --> |
Revision as of 02:32, 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/
Custom Metric
# /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 restart # new metric should be available