Nocte
February 21, 2024, 4:59am
1
Hi all.
I am aiming to contribute to the prometheus-node-exporter but there are still some open questions like how to properly implement configurable options with uhttpd. I just now reached out to the maintainer of the packages but it actually might be better to ask for help here in this forum? Any hints are apprecheated. More info in the corresponding ticket:
opened 08:31AM - 21 Dec 23 UTC
Maintainer: @champtar
Environment: OpenWrt 22.03.2, r19803-9a599fee93
Descr… iption:
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: https://github.com/openwrt/packages/compare/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
https://github.com/openwrt/packages/blob/f9af73dcd70c5b5a777afe6cc2fc144379ea91d4/utils/prometheus-node-exporter-lua/files/etc/init.d/prometheus-node-exporter-lua#L32 But the -L switch seams to only take one argument which is a file and no additional parameters. There may be a better approach?
Looking forward to get feedback on this one.
kind regards
1 Like
Nocte
April 29, 2024, 9:13am
2
In case anyone comes across this. here is the pull request:
openwrt:master
← NoctivagusObitus:feature_omit_zero_export
opened 08:07AM - 26 Apr 24 UTC
depending on the configuration there may be multiple interfaces creating multipl… e time series always
reporting 0 value. omiting them from the export saves resources. most notably cpu.
- remove time series with value of zero
- make 'omit_zero_values' configurable
- formating accoding to shfmt and stylua
Signed-off-by: Markus Hube <markus.hube@gmail.com>
1 Like
Nocte
December 2, 2024, 9:49am
3
Hi
Since the pull request is still open and since I got interesting input I would like to point people here to the conversation and ask for additional opinions on how to proceed. (github )
kind regards