DRuggeri / nut_exporter

Network UPS Tools Prometheus Exporter
Other
179 stars 26 forks source link

Can get ups runtime because "unsupported value type" #50

Open zoic21 opened 3 weeks ago

zoic21 commented 3 weeks ago

Hello,

I got an issue to get battery runtime, I have an error with "unsupported value type" :

ts=2024-11-01T14:05:46.715Z caller=nut_collector.go:176 level=debug variable_name=battery.runtime value=1952 type=INTEGER description="Battery runtime (seconds)" writeable=false maximum_length=0 original_type=NUMBER
ts=2024-11-01T14:05:46.715Z caller=nut_collector.go:269 level=debug msg="Export the variable? false" count=8 variables="unsupported value type"

Here my configuration :

services:
  nut-exporter:
    image: druggeri/nut_exporter
    container_name: nut-exporter
    restart: always
    ports:
      - 9199:9199
    command:
      - --nut.vars_enable="battery.runtime,battery.charge,battery.voltage,battery.voltage.nominal,input.voltage,input.voltage.nominal,ups.load,ups.status"
      - --nut.serverport=3493
      - --log.level=debug

I don't understand why it's did that, I think I misconfiguring something but I can't find what....

Thanks in advance

DRuggeri commented 3 weeks ago

This does seem strange. Can you share the full debug output (be sure to trim out any credentials). The NUT library used by this exporter should have support for the NUMBER type listed in the above output, so maybe seeing a bit more information leading up to this point would help

mmeija commented 1 week ago

I think i'm seeing the same behaviour nut_exporter-v3.1.1-linux-amd64 I think it works as expected with native binary? docker does strange things with the nut.vars_enable - I don't know in either case without the nut.vars_enable I don't get battery.runtime - with the vars set in the docker i get battery.runtime but lose ups.status?

here's docker with no nut.vars_enable

docker compose:
services:
  nut-exporter:
    image: druggeri/nut_exporter
    container_name: nut-exporter
    restart: always
    ports:
      - 9199:9199
    command:
      - --log.level=debug
      - --nut.server=10.1.4.20

debug_no_vars.txt

and with:

services:
  nut-exporter:
    image: druggeri/nut_exporter
    container_name: nut-exporter
    restart: always
    ports:
      - 9199:9199
    command:
      - --nut.vars_enable="battery.runtime,battery.charge,battery.charge.low,battery.charge.warning,battery.runtime,battery.temperature,battery.voltage,battery.voltage.nominal,input.transfer.high,input.transfer.low,ups.beeper.status,input.voltage,input.voltage.nominal,ups.load,ups.status"
      - --log.level=debug
      - --nut.server=10.1.4.20

debug_vars.txt

./nut_exporter --nut.server="10.1.4.20" --log.level=debug native_no_vars.txt

./nut_exporter --nut.server="10.1.4.20" --log.level=debug --nut.vars_enable="battery.runtime,battery.charge,battery.charge.low,battery.charge.warning,battery.runtime,battery.temperature,battery.voltage,battery.voltage.nominal,input.transfer.high,input.transfer.low,ups.beeper.status,input.voltage,input.voltage.nominal,ups.load,ups.status" native_vars.txt