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
2022-12-02 09:25:17 -06:00
committed by Etienne Champetier
parent a31d46e0c8
commit 4edae84499
2 changed files with 7 additions and 1 deletions

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>

View File

@@ -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