Difference between revisions of "Prometheus: alert:"

From wikieduonline
Jump to navigation Jump to search
 
(20 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{lowercase}}
+
 
 
* https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
 
* https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/
 +
 +
groups:
 +
- name: example
 +
  [[Prometheus, rules:|rules:]]
 +
  - alert: HighRequestLatency
 +
    expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
 +
    for: 10m
 +
    labels:
 +
      severity: page
 +
    annotations:
 +
      summary: High request latency
 +
  
 
<pre>
 
<pre>
alert: InstanceDown
+
<nowiki>
expr: up == 0
+
alert: InstanceDown
for: 5m
+
expr: up == 0
labels:
+
for: 5m
  severity: page
+
labels:
annotations:
+
  severity: page
  summary: "Instance {{$labels.instance}} down"
+
annotations:
  description: "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."
+
  summary: "Instance {{$labels.instance}} down"
 +
  description: "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."
 +
</nowiki>
 
</pre>
 
</pre>
 
  
 
== Related ==
 
== Related ==
 
* [[Alertmanager]]
 
* [[Alertmanager]]
 +
* <code>[[expr:]]</code>
 +
* [[Go template]]: https://pkg.go.dev/text/template
 +
* <code>[[rule files:]]</code>
  
 
== See also ==
 
== See also ==
 +
* {{Alertmanager}}
 
* {{Prometheus}}
 
* {{Prometheus}}
  
 
[[Category:Monitoring]]
 
[[Category:Monitoring]]
 
[[Category:Prometheus]]
 
[[Category:Prometheus]]

Latest revision as of 08:09, 23 September 2022

groups:
- name: example
  rules:
  - alert: HighRequestLatency
    expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
    for: 10m
    labels:
      severity: page
    annotations:
      summary: High request latency



 alert: InstanceDown
 expr: up == 0
 for: 5m
 labels:
   severity: page
 annotations:
   summary: "Instance {{$labels.instance}} down"
   description: "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."

Related[edit]

See also[edit]

Advertising: