From 8d38e81521b9ef1f51bdca72be2fa7db041f2764 Mon Sep 17 00:00:00 2001
From: Matthias Loibl <mail@matthiasloibl.com>
Date: Thu, 13 Sep 2018 14:43:46 +0200
Subject: [PATCH] contrib/kube-prometheus: Create missing Prometheus operator
 alerts

---
 .../kube-prometheus/alerts/alerts.libsonnet   |  3 +-
 .../alerts/prometheus-operator.libsonnet      | 50 +++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 jsonnet/kube-prometheus/alerts/prometheus-operator.libsonnet

diff --git a/jsonnet/kube-prometheus/alerts/alerts.libsonnet b/jsonnet/kube-prometheus/alerts/alerts.libsonnet
index 19568a24..1b2d94eb 100644
--- a/jsonnet/kube-prometheus/alerts/alerts.libsonnet
+++ b/jsonnet/kube-prometheus/alerts/alerts.libsonnet
@@ -1,4 +1,5 @@
 (import 'alertmanager.libsonnet') +
 (import 'general.libsonnet') +
 (import 'node.libsonnet') +
-(import 'prometheus.libsonnet')
+(import 'prometheus.libsonnet') +
+(import 'prometheus-operator.libsonnet')
diff --git a/jsonnet/kube-prometheus/alerts/prometheus-operator.libsonnet b/jsonnet/kube-prometheus/alerts/prometheus-operator.libsonnet
new file mode 100644
index 00000000..33dd97ce
--- /dev/null
+++ b/jsonnet/kube-prometheus/alerts/prometheus-operator.libsonnet
@@ -0,0 +1,50 @@
+{
+  prometheusAlerts+:: {
+    groups+: [
+      {
+        name: 'prometheus-operator',
+        rules: [
+          {
+            alert: 'PrometheusOperatorAlertmanagerReconcileErrors',
+            expr: |||
+              rate(prometheus_operator_alertmanager_reconcile_errors_total{%(prometheusOperatorSelector)s}[5m]) > 0.01
+            ||| % $._config,
+            labels: {
+              severity: 'warning',
+            },
+            annotations: {
+              message: 'Errors while reconciling Alertmanager in {{$labels.namespace}} namespace.',
+            },
+            'for': '10m',
+          },
+          {
+            alert: 'PrometheusOperatorPrometheusReconcileErrors',
+            expr: |||
+              rate(prometheus_operator_prometheus_reconcile_errors_total{%(prometheusOperatorSelector)s}[5m]) > 0.01
+            ||| % $._config,
+            labels: {
+              severity: 'warning',
+            },
+            annotations: {
+              message: 'Errors while reconciling Prometheus in {{$labels.namespace}} namespace.',
+            },
+            'for': '10m',
+          },
+          {
+            alert: 'PrometheusOperatorNodeLookupErrors',
+            expr: |||
+              rate(prometheus_operator_node_address_lookup_errors_total{%(prometheusOperatorSelector)s}[5m]) > 0.01
+            ||| % $._config,
+            labels: {
+              severity: 'warning',
+            },
+            annotations: {
+              message: 'Errors while reconciling Prometheus in {{$labels.namespace}} namespace.',
+            },
+            'for': '10m',
+          },
+        ],
+      },
+    ],
+  },
+}
-- 
GitLab