…for textfile collector, to make it more consistent with the upstream
Prometheus node-exporter
Signed-off-by: Rob Hoelz <rob@hoelz.ro>
[bump version]
Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
include $(TOPDIR)/rules.mk
PKG_NAME:=prometheus-node-exporter-lua
-PKG_VERSION:=2024.06.15
+PKG_VERSION:=2024.06.16
PKG_RELEASE:=1
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
local fs = require "nixio.fs"
local function scrape()
+ local mtime_metric = metric("node_textfile_mtime_seconds", "gauge")
+
for metrics in fs.glob("/var/prometheus/*.prom") do
output(get_contents(metrics), '\n')
+ local stat = fs.stat(metrics)
+ if stat then
+ mtime_metric({ file = metrics }, stat.mtime)
+ end
end
end