0
0
mirror of https://github.com/openwrt/packages.git synced 2025-08-06 18:51:45 +00:00
Files
Andre Heider 06c2ef2ce4 prometheus-node-exporter-ucode: add new package
This is a port of prometheus-node-exporter-lua to ucode.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-08-25 10:18:26 +02:00

24 lines
426 B
Ucode

function parse(fn, device, skipdecl) {
let f = fs.open(fn);
if (!f)
return false;
const labels = { device };
let line;
while (line = nextline(f)) {
const x = wsplit(line);
if (length(x) < 2)
continue;
counter(`snmp6_${x[0]}`, null, skipdecl)(labels, x[1]);
}
}
parse("/proc/net/snmp6", "all");
const root = "/proc/net/dev_snmp6/";
for (let device in fs.lsdir(root))
parse(root + device, device, true);