Skip to content

Commit

Permalink
Add Prometheus alerting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
djjudas21 committed Aug 29, 2024
1 parent e1ddbc7 commit d641e66
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dist/charts/ping-exporter/files/prometheus.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- alert: HighPingLossRatio
expr: round(ping_loss_ratio * 100) > 0
for: 5m
labels:
severity: warning
annotations:
summary: High ping loss ratio for {{ $labels.target }}
description: "Ping loss ratio for {{ $labels.target }} is {{ $value }}"
- alert: HighPingRtt
expr: round(ping_rtt_mean_seconds * 1000, 0.1) > 100
for: 5m
labels:
severity: warning
annotations:
summary: High ping latency for {{ $labels.target }}
description: "Ping latency for {{ $labels.target }} is {{ $value }} seconds"
14 changes: 14 additions & 0 deletions dist/charts/ping-exporter/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.prometheusRules.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
prometheus: service-prometheus
role: alert-rules
name: {{ include "ping_exporter.fullname" . }}
spec:
groups:
- name: ping_exporter.rules
rules:
{{ .Files.Get "files/prometheus.rules" }}
{{- end }}
4 changes: 4 additions & 0 deletions dist/charts/ping-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ config:
# Create a serviceMonitor resource to be consumed by Prometheus Operator
serviceMonitor:
enabled: false

# Create basic Prometheus alerting rules
prometheusRules:
enabled: false

0 comments on commit d641e66

Please sign in to comment.