From 92029bad5f244c122df9f496778026cb3e4df9f2 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 11 Nov 2020 14:06:27 +0100 Subject: [PATCH] TT#71030 Fix influxdb checks conditionals for when it is present InfluxDB is going to be running either when it is the current monitoring backend, or when it is not but its data has not yet been migrated. We want to check both cases so make sure the service is there and contains data. Change-Id: I45c71f41b6e2106b1ecf3a2665f669c920e59074 --- templates/821_network-ports-ngcp.yaml.tt2 | 4 ++-- templates/910_service-monitoring.yaml.tt2 | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/821_network-ports-ngcp.yaml.tt2 b/templates/821_network-ports-ngcp.yaml.tt2 index 2a3d410..84aa5de 100644 --- a/templates/821_network-ports-ngcp.yaml.tt2 +++ b/templates/821_network-ports-ngcp.yaml.tt2 @@ -230,10 +230,10 @@ port: # InfluxDb Query tcp:8086: - listening: true + listening: [% monitoring.backend == 'influxdb' || monitoring.influxdb_migrated == 'no' ? 'true' : 'false' %] ip: ["[% ha_int_ips.0 %]"] # InfluxDb Backup/Restore RPC tcp:8088: - listening: true + listening: [% monitoring.backend == 'influxdb' || monitoring.influxdb_migrated == 'no' ? 'true' : 'false' %] ip: ["127.0.0.1"] diff --git a/templates/910_service-monitoring.yaml.tt2 b/templates/910_service-monitoring.yaml.tt2 index 7926793..2a9c0c4 100644 --- a/templates/910_service-monitoring.yaml.tt2 +++ b/templates/910_service-monitoring.yaml.tt2 @@ -9,8 +9,8 @@ ha_ips = out.merge(ha_ips); -%] command: +[% IF monitoring.backend == 'influxdb' || monitoring.influxdb_migrated == 'no' -%] -[% IF monitoring.backend == 'influxdb' -%] influx -execute 'show databases': exit-status: 0 stdout: @@ -20,7 +20,9 @@ command: - "/^telegraf$/" stderr: [] timeout: 10000 -[% ELSE -%] +[% END -%] +[% IF monitoring.backend == 'prometheus' -%] + promtool query instant http://[% ha_ips.0 || 'localhost' %]:[% prometheus.port || 9090 %] '{__name__=~".+"}': exit-status: 0 stdout: