From e5637ee92cd1e64f6d510c759f7aa1516746b6e4 Mon Sep 17 00:00:00 2001
From: Nacho Barrientos <nacho.barrientos@cern.ch>
Date: Fri, 14 Feb 2025 12:36:26 +0100
Subject: [PATCH] Do not try to push metrics to local Fluentbit if not
 installed

This should prevent the following from happening in the MONIT clusters
that push metrics directly from Prometheus to MoM without any
Fluentbit in between:

ts=2025-02-14T11:37:32.111Z caller=dedupe.go:112 component=remote
level=warn remote_name=6c01d0
url=http://it-monit-metrics-fluentbit:8080/api/prom/push msg="Failed
to send batch, retrying" err="Post
\"http://it-monit-metrics-fluentbit:8080/api/prom/push\": dial tcp:
lookup it-monit-metrics-fluentbit on 10.254.0.10:53: no such host"
---
 templates/prometheus/prometheus.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/templates/prometheus/prometheus.yaml b/templates/prometheus/prometheus.yaml
index 5195952..86d66fd 100644
--- a/templates/prometheus/prometheus.yaml
+++ b/templates/prometheus/prometheus.yaml
@@ -38,6 +38,7 @@ spec:
   ruleSelector: {}
   ruleNamespaceSelector: {}
   remoteWrite:
+    {{- if .Values.metrics.fluentbit.enabled }}
     - url: "http://it-monit-metrics-fluentbit:8080/api/prom/push"
       queueConfig:
         capacity: 5000
@@ -54,6 +55,7 @@ spec:
         {{- end }}
       metadataConfig:
         send: false
+    {{ end -}}
     {{if .Values.metrics.prometheus.server.remoteWrite.endpoint }}
     - url: {{ .Values.metrics.prometheus.server.remoteWrite.endpoint }}
       tlsConfig:
-- 
GitLab