diff --git a/dist/charts/ping-exporter/files/prometheus.rules b/dist/charts/ping-exporter/files/prometheus.rules new file mode 100644 index 0000000..1974e8a --- /dev/null +++ b/dist/charts/ping-exporter/files/prometheus.rules @@ -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" diff --git a/dist/charts/ping-exporter/templates/prometheusrule.yaml b/dist/charts/ping-exporter/templates/prometheusrule.yaml new file mode 100644 index 0000000..5b2677d --- /dev/null +++ b/dist/charts/ping-exporter/templates/prometheusrule.yaml @@ -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 }} diff --git a/dist/charts/ping-exporter/values.yaml b/dist/charts/ping-exporter/values.yaml index f4e4e58..1fe3a1f 100644 --- a/dist/charts/ping-exporter/values.yaml +++ b/dist/charts/ping-exporter/values.yaml @@ -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