From 54378598b0f168734da2297eb9c279689744cfe6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 4 Jan 2022 13:13:15 +0100 Subject: prometheus/node/sensors: fix duplicate type string in promehteus output --- .../exporter/node/templates/textfile-collector-scripts/sensors.j2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'roles/monitoring/prometheus/exporter') diff --git a/roles/monitoring/prometheus/exporter/node/templates/textfile-collector-scripts/sensors.j2 b/roles/monitoring/prometheus/exporter/node/templates/textfile-collector-scripts/sensors.j2 index 1e769389..0ab806c9 100644 --- a/roles/monitoring/prometheus/exporter/node/templates/textfile-collector-scripts/sensors.j2 +++ b/roles/monitoring/prometheus/exporter/node/templates/textfile-collector-scripts/sensors.j2 @@ -11,8 +11,13 @@ local units = { gpio = "status", } +local _typestring_printed = {} + local function metric(name, mtype, labels, value) - print("# TYPE " .. name .. " " .. mtype) + if nil == _typestring_printed[name] then + print("# TYPE " .. name .. " " .. mtype) + _typestring_printed[name] = 1 + end local label_string = "" if labels then -- cgit v1.2.3