Prometheus
prometheus.io › docs › prometheus › latest › configuration › alerting_rules
Alerting rules | Prometheus
groups: - name: example labels: team: myteam rules: - alert: HighRequestLatency expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 for: 10m keep_firing_for: 5m labels: severity: page annotations: summary: High request latency · The optional for clause causes Prometheus to wait for a certain duration between first encountering a new expression output vector element and counting an alert as firing for this element.
Should I use PromQL's increase function as an alert rule expression for a resource quota breach?
See offset docs here: https://prometheus.io/docs/prometheus/latest/querying/basics/ I’m not sure if increase is reliable across long time windows like this, but it should handle resets in the counters, which the offset won’t handle. If you know that the metric is monotonic and never resets, then you could use the offset instead. Finally, you can take a look at recording rules, which allow to generate a new precalculated metric out of another metrics. More on reddit.com
Alert not firing
So the alert you have written should test against 0, not 1 for the up metric. Alert are fired with the expression is true not false. Like in your test with just ‘up{job=“website”}==0’ up is fairly simple metric and in your case does the job. But their is a caveat, if your metrics are hosted in your website (like the website has a page with a /metrics that you configure Prometheus to scrape) and the website goes down, the missing metrics will not fire as there is no more up metric to test against. For that you have the ‘absent’ operator that you can setup like ‘absent(up{job=“website”})’ and that will be of value of 1 if the metrics doesn’exist (like mentioned website goes down with it’s metrics) Mind that the ‘absent’ operation will not have labels on it so if you compose the alert message with like “{{ $labels.instance }}’ that would not work, in my case I write the label that I expect directly in the label section of the alert. More on reddit.com
Alerts indefinitely stay inactive, despite underlying expression is successfully evaluated
For alerts with big `for` value, like in your example, it is better to check ALERTS_FOR_STATE metric to see whether the condition has been triggered and for how long. It could be that condition was true up to 9min in a row and then once it wasn't - so all the progress will be reset. If you care to dig deeper, you can try using vmalert - a ruler component from VictoriaMetrics stack. You can feed it with the same alerting rule and configure it to query Prometheus for data. When you have that running you can check the alert's state in the vmalert UI. This would show you how many successful consecutive evaluations it had. More on reddit.com
Prometheus is getting killed OOMKilled
My Prometheus instance is consuming a lot of memory over 13Gi, the node has a max 16Gb, so it's getting killed by k8s, how can I configure or should… More on reddit.com
26:50
Alerting Rules in Prometheus with Examples | Add Alerting Rules ...
13:55
Prometheus Alertmanager - YouTube
42:07
Full Tutorial: AlertManager Set up and PrometheusRules - YouTube
24:42
06 How to configure recording & Alerting Rules with example in ...
How to send Alerts in Prometheus - Alertmanager
13:26
Alerting Rules in Prometheus | Prometheus Tutorial for Beginners ...
Samber
samber.github.io › home › rules
1162 Prometheus Alerting Rules for 94 Services | Awesome Prometheus Alerts
Awesome Prometheus AlertsAPA · ⌘K · Sponsored by · Search · 1162 alerting rules across 94 services and 13 categories. ⚠️ · Alert thresholds depend on the nature of your applications. Some queries may have arbitrary tolerance thresholds. Building an efficient monitoring platform takes time.
Prometheus
prometheus.io › docs › prometheus › latest › configuration › recording_rules
Defining recording rules | Prometheus
Must be a valid label value. alert: <string> # The PromQL expression to evaluate. Every evaluation cycle this is # evaluated at the current time, and all resultant time series become # pending/firing alerts. expr: <string> # Alerts are considered firing once they have been returned for this long.
GitHub
github.com › bdossantos › prometheus-alert-rules
GitHub - bdossantos/prometheus-alert-rules: Collection of Prometheus Alert Rules · GitHub
--- groups: - name: <group-name> rules: - alert: <AlertName> expr: > (<PromQL expression>) * on(instance) group_left (nodename) node_uname_info{nodename=~".+"} for: <duration> labels: severity: <page|warning|info> annotations: summary: <Human readable description> (instance {{ $labels.instance }}) description: "<detailed description>\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
Author: bdossantos
Dzyoba
alex.dzyoba.com › blog › prometheus-alerts
Prometheus alerts examples | There is no magic here
October 29, 2019 - The essence of this alert is expression which states up{job="node_exporter"} == 0. I’ve seen a lot of examples that just use up == 0 but it’s strange because every exporter that is being scraped by Prometheus has this metric, so you’ll be alerted on a completely unwanted thing like restart ...
Nais Documentation
doc.nais.io › observability › alerting › reference › prometheusrule
Prometheus Alerting Rule Reference - Nais
The name of the group. This is used to group alerts in the Alertmanager. The name of the alert. This is used to identify the alert in the Alertmanager. Typically this is a short, descriptive name on the form CamelCase. The expression that defines when the alert should fire.
Medium
medium.com › @suchitasharma1106 › writing-alerts-in-promql-a-guide-to-prometheus-query-language-and-alert-definitions-e430b53180a9
Writing Alerts in PromQL: A Guide to Prometheus Query Language and Alert Definitions | by Suchita Sharma | Medium
October 7, 2024 - An alert rule is usually written in the prometheus.yml configuration file or in a separate rule file. Here's the general structure for defining an alert: groups: - name: <group_name> rules: - alert: <alert_name> expr: <promql_expression> for: <duration> labels: severity: <severity_level> annotations: summary: <short_description> description: <detailed_description>
DoHost
dohost.us › home › 2025 › september › 27 › writing prometheus alerting rules for critical conditions
Writing Prometheus Alerting Rules for Critical Conditions - DoHost
September 27, 2025 - Step 1: Understand the Alerting Rule Structure: Prometheus alerting rules are defined using YAML syntax. A basic rule consists of the alert name, the expr (expression) that triggers the alert, and optional annotations and labels.
VictoriaMetrics
victoriametrics.com › blog › prometheus alerting 101: rules, recording rules, and alertmanager
Prometheus Alerting 101: Rules, Recording Rules, and Alertmanager
March 18, 2025 - Once the CPU usage drops back to normal (the expression evaluates to no time series), the alert system sends a resolved message to the Alertmanager: ... At that point, you’ll get a notification letting you know that everything’s back to normal. But the rule itself doesn’t stop—it continues to be evaluated at regular intervals and you will get notified again if the condition is met.
Medium
medium.com › @squadcast › how-to-write-effective-prometheus-alert-rules-bd8d043df120
How to Write Effective Prometheus Alert Rules | by Squadcast | Medium
January 15, 2025 - Alert: This field specifies the alert’s name. It identifies the alert and must be unique within a Prometheus instance. Expr: This field specifies the Prometheus query expression that evaluates the alert condition.
GitHub
github.com › prometheus › prometheus › blob › main › docs › configuration › alerting_rules.md
prometheus/docs/configuration/alerting_rules.md at main · prometheus/prometheus
groups: - name: example labels: team: myteam rules: - alert: HighRequestLatency expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 for: 10m keep_firing_for: 5m labels: severity: page annotations: summary: High request latency · The optional for clause causes Prometheus to wait for a certain duration between first encountering a new expression output vector element and counting an alert as firing for this element.
Author: prometheus
Rancher
ranchermanager.docs.rancher.com › advanced user guides › monitoring configuration guides › advanced configuration › configuring prometheusrules
Configuring PrometheusRules | Rancher
May 29, 2025 - Alerting rules allow you to define alert conditions based on PromQL (Prometheus Query Language) expressions and to send notifications about firing alerts to an external service.
Java Code Geeks
javacodegeeks.com › home › software development
Prometheus Sample Alert Rules - Java Code Geeks
June 21, 2023 - An alerting rule consists of a condition expression, a time duration for which the condition must be true to trigger an alert, and an optional list of annotations and labels to provide additional context to the alert.