Prometheus rules: Difference between revisions
From wikinotes
No edit summary |
|||
Line 30: | Line 30: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
service prometheus restart | service prometheus restart | ||
</syntaxhighlight> | </syntaxhighlight> | ||
now <code>node_available_memory_percent</code> metric should be cached and queryable. | |||
</blockquote><!-- Custom Metric --> | </blockquote><!-- Custom Metric --> |
Revision as of 02:33, 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 restartnow
node_available_memory_percent
metric should be cached and queryable.