prometheus-node-exporter-lua: Add "node_textfile_mtime_seconds" metric

…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>
This commit is contained in:
Rob Hoelz authored and Etienne Champetier committed 2024-06-16 04:41:33 +02:00
1 parent a31d46e0c8
commit 4edae84499
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
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>
@@ -3,8 +3,14 @@
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