DRuggeri / nut_exporter

Network UPS Tools Prometheus Exporter
Other
172 stars 25 forks source link

--log.level="info" doesn't work #18

Closed CRCinAU closed 2 years ago

CRCinAU commented 2 years ago

I've just installed nut_exporter, but it seems when its started with the --log.level="info" option, debug logs are still printed to STDOUT.

Running via systemd with the service file:

[Unit]
Description=Prometheus NUT Exporter
After=network-online.target

[Service]
User=prometheus
Restart=always
WorkingDirectory=/home/prometheus/
ExecStart=/home/prometheus/nut_exporter --log.level=warn

Environment="NUT_EXPORTER_SERVER=172.31.1.254"
Environment="NUT_EXPORTER_USERNAME=username"
Environment="NUT_EXPORTER_PASSWORD=password"
Environment="NUT_EXPORTER_METRICS_NAMESPACE=ols1000e"
Environment="NUT_EXPORTER_WEB_TELEMETRY_PATH=/metrics"
Environment="NUT_EXPORTER_WEB_EXPORTER_TELEMETRY_PATH=/stats"
Environment="NUT_EXPORTER_VARIABLES=battery.charge,battery.voltage,battery.voltage.nominal,input.voltage,input.voltage.nominal,ups.load,ups.status,output.voltage"

[Install]
WantedBy=multi-user.target

It seems I still get log entries like:

nut_exporter[30849]: level=debug ts=2022-02-24T02:11:59.147Z caller=nut_collector.go:205 msg="Export the variable? false" count=8 variables="unsupported value type"
nut_exporter[30849]: level=debug ts=2022-02-24T02:11:59.147Z caller=nut_collector.go:117 variable_name=ups.vendorid value=764 type=INTEGER description="Vendor ID for USB devices" writeable=false maximum_length=0 original_type=NUMBER
nut_exporter[30849]: level=debug ts=2022-02-24T02:11:59.147Z caller=nut_collector.go:205 msg="Export the variable? false" count=8 variables="unsupported value type"
DRuggeri commented 2 years ago

Thanks for the report, @CRCinAU! It turned out to be a trivial fix - I just committed the update to fix it and am pushing the release out now.