From f381d8a9bd46941e6189dcda2fe13952c0e45058 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Mon, 24 Aug 2020 16:48:06 +0200 Subject: [PATCH] documentation/prometheus-mixin: improve PrometheusNotIngestingSamples The alert shouldn't fire when there's no target and no rule configured. Signed-off-by: Simon Pasquier --- documentation/prometheus-mixin/alerts.libsonnet | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/documentation/prometheus-mixin/alerts.libsonnet b/documentation/prometheus-mixin/alerts.libsonnet index e0ddf4152..ffb7971bc 100644 --- a/documentation/prometheus-mixin/alerts.libsonnet +++ b/documentation/prometheus-mixin/alerts.libsonnet @@ -127,7 +127,15 @@ { alert: 'PrometheusNotIngestingSamples', expr: ||| - rate(prometheus_tsdb_head_samples_appended_total{%(prometheusSelector)s}[5m]) <= 0 + ( + rate(prometheus_tsdb_head_samples_appended_total{%(prometheusSelector)s}[5m]) <= 0 + and + ( + sum without(scrape_job) (prometheus_target_metadata_cache_entries{%(prometheusSelector)s}) > 0 + or + sum without(rule_group) (prometheus_rule_group_rules{%(prometheusSelector)s}) > 0 + ) + ) ||| % $._config, 'for': '10m', labels: {