mirror of
https://github.com/openwrt/packages.git
synced 2025-12-26 11:16:31 +04:00
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>
(cherry picked from commit 4edae84499)
This commit is contained in:
committed by
Etienne Champetier
parent
611b372442
commit
87a831fa8e
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user