Browse Source

Merge pull request #5894 from aparcar/prom-export

prometheus-node-exporter-lua: textfile collector
lilik-openwrt-22.03
champtar 7 years ago
committed by GitHub
parent
commit
5800538882
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions
  1. +13
    -1
      utils/prometheus-node-exporter-lua/Makefile
  2. +11
    -0
      utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/textfile.lua

+ 13
- 1
utils/prometheus-node-exporter-lua/Makefile View File

@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua
PKG_VERSION:=2017.12.08
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_MAINTAINER:=Christian Simon <simon@swine.de>
PKG_LICENSE:=Apache-2.0
@ -70,6 +70,12 @@ define Package/prometheus-node-exporter-lua-bmx7
DEPENDS:=prometheus-node-exporter-lua bmx7 +lua-cjson +bmx7-json
endef
define Package/prometheus-node-exporter-lua-textfile
$(call Package/prometheus-node-exporter-lua/Default)
TITLE+= (textfile collector)
DEPENDS:=prometheus-node-exporter-lua +luci-lib-nixio
endef
Build/Compile=
define Package/prometheus-node-exporter-lua/install
@ -119,6 +125,11 @@ define Package/prometheus-node-exporter-lua-bmx7/install
$(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/bmx7.lua $(1)/usr/lib/lua/prometheus-collectors/
endef
define Package/prometheus-node-exporter-lua-textfile/install
$(INSTALL_DIR) $(1)/usr/lib/lua/prometheus-collectors
$(INSTALL_BIN) ./files/usr/lib/lua/prometheus-collectors/textfile.lua $(1)/usr/lib/lua/prometheus-collectors/
endef
$(eval $(call BuildPackage,prometheus-node-exporter-lua))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-nat_traffic))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-netstat))
@ -126,3 +137,4 @@ $(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-wifi_stations))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx6))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-bmx7))
$(eval $(call BuildPackage,prometheus-node-exporter-lua-textfile))

+ 11
- 0
utils/prometheus-node-exporter-lua/files/usr/lib/lua/prometheus-collectors/textfile.lua View File

@ -0,0 +1,11 @@
#!/usr/bin/lua
local fs = require "nixio.fs"
local function scrape()
for metrics in fs.glob("/var/prometheus/*.prom") do
output(get_contents(metrics), '\n')
end
end
return { scrape = scrape }

Loading…
Cancel
Save