From 0100a2cb26c30ee091a259625b9496dd7805aaaa Mon Sep 17 00:00:00 2001 From: Alex Tomlins Date: Wed, 3 Apr 2019 21:08:11 +0100 Subject: [PATCH 1/2] prometheus-node-exporter-lua: fix missing conntrack values If the /proc/sys/net/netfilter/nc_conntrack_* files are not present, this exporter was outputting a blank value, which is invalid. These files will not be present when using an image that doesn't include the iptables and firewall packages (eg a minimal access-point type image). This updates the collector to only output the metrics if the corresponding /proc files are present. Signed-off-by: Alex Tomlins --- .../usr/lib/lua/prometheus-collectors/conntrack.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua index 93b26c2667..1abb7a1913 100644 --- a/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua @@ -1,8 +1,12 @@ local function scrape() - metric("node_nf_conntrack_entries", "gauge", nil, - string.sub(get_contents("/proc/sys/net/netfilter/nf_conntrack_count"), 1, -2)) - metric("node_nf_conntrack_entries_limit", "gauge", nil, - string.sub(get_contents("/proc/sys/net/netfilter/nf_conntrack_max"), 1, -2)) + local count = get_contents("/proc/sys/net/netfilter/nf_conntrack_count") + local max = get_contents("/proc/sys/net/netfilter/nf_conntrack_max") + if count ~= "" then + metric("node_nf_conntrack_entries", "gauge", nil, string.sub(count, 1, -2)) + end + if max ~= "" then + metric("node_nf_conntrack_entries_limit", "gauge", nil, string.sub(max, 1, -2)) + end end return { scrape = scrape } From deab22044be7ea52fd0e3863516a07c5bee72d68 Mon Sep 17 00:00:00 2001 From: Alex Tomlins Date: Thu, 4 Apr 2019 22:28:40 +0100 Subject: [PATCH 2/2] prometheus-node-exporter-lua: Bump PKG_RELEASE Signed-off-by: Alex Tomlins --- utils/prometheus-node-exporter-lua/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index bab0fde125..18638b39e0 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua PKG_VERSION:=2018.12.30 -PKG_RELEASE:=4 +PKG_RELEASE:=5 PKG_MAINTAINER:=Etienne CHAMPETIER PKG_LICENSE:=Apache-2.0