-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
Maintainer: @champtar
Environment: OpenWrt 22.03.2, r19803-9a599fee93
Description:
I am using the Prometheus node exporter on OpenWrt for a while now. What I have noticed is, depending on the config, there may be multiple time series always zero (e.g. node_network_transmit_carrier_total{device="lan1"} 0). To me these don't provide any value but increase cpu load measurably. For the time being I have implemented a filter on my devices locally like shown here: master...NoctivagusObitus:packages:feature_omit_zero_export
diff --git a/utils/prometheus-node-exporter-lua/files/usr/bin/prometheus-node-exporter-lua b/utils/prometheus-node-exporter-lua/files/usr/bin/prometheus-node-exporter-lua
index 36f064c5b..a70a7606a 100755
--- a/utils/prometheus-node-exporter-lua/files/usr/bin/prometheus-node-exporter-lua
+++ b/utils/prometheus-node-exporter-lua/files/usr/bin/prometheus-node-exporter-lua
@@ -45,7 +45,9 @@ end
function metric(name, mtype, labels, value)
output("# TYPE " .. name .. " " .. mtype)
local outputter = function(labels, value)
- print_metric(name, labels, value)
+ if tonumber(value) ~= 0 then
+ print_metric(name, labels, value)
+ end
end
if value then
outputter(labels, value)
lines 1-21/21 (END)
On this Grafana dashboard I disabled my filter. The exported time series where about doubled.

This works fine for me since more then a year now.
I would be happy to contribute a configurable version of this, exporting all series by default. Therefor I would kindly ask for a little push in the right direction for using dynamic arguments in the referenced lua script. From what I understand the node exporter gets called by utthpd in this line
packages/utils/prometheus-node-exporter-lua/files/etc/init.d/prometheus-node-exporter-lua
Line 32 in f9af73d
| procd_set_param command /usr/sbin/uhttpd -f -c /dev/null -l / -L /usr/bin/prometheus-node-exporter-lua |
Looking forward to get feedback on this one.