From b584443d658fd05d4c12a7c24b4d83c9d35b7328 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Wed, 25 Jul 2018 20:43:44 +0200 Subject: [PATCH] prometheus-node-exporter-lua: add conntrack collector Also fix missing dependency of openwrt collector Signed-off-by: Etienne Champetier --- utils/prometheus-node-exporter-lua/Makefile | 4 +++- .../files/usr/lib/lua/prometheus-collectors/conntrack.lua | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua diff --git a/utils/prometheus-node-exporter-lua/Makefile b/utils/prometheus-node-exporter-lua/Makefile index 3f5ab7f55..2fc73562f 100644 --- a/utils/prometheus-node-exporter-lua/Makefile +++ b/utils/prometheus-node-exporter-lua/Makefile @@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=prometheus-node-exporter-lua -PKG_VERSION:=2018.06.26 +PKG_VERSION:=2018.07.23 PKG_RELEASE:=1 PKG_MAINTAINER:=Etienne CHAMPETIER @@ -79,6 +79,7 @@ endef define Package/prometheus-node-exporter-lua-openwrt $(call Package/prometheus-node-exporter-lua/Default) TITLE+= (openwrt collector) + DEPENDS:=prometheus-node-exporter-lua endef Build/Compile= @@ -92,6 +93,7 @@ define Package/prometheus-node-exporter-lua/install $(INSTALL_BIN) ./files/usr/bin/prometheus-node-exporter-lua $(1)/usr/bin/prometheus-node-exporter-lua $(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/cpu.lua $(1)/usr/lib/lua/prometheus-collectors/ + $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/conntrack.lua $(1)/usr/lib/lua/prometheus-collectors/ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/filefd.lua $(1)/usr/lib/lua/prometheus-collectors/ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/loadavg.lua $(1)/usr/lib/lua/prometheus-collectors/ $(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/meminfo.lua $(1)/usr/lib/lua/prometheus-collectors/ 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 new file mode 100644 index 000000000..93b26c266 --- /dev/null +++ b/utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/conntrack.lua @@ -0,0 +1,8 @@ +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)) +end + +return { scrape = scrape }