Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network_ups_tools_ups_status metric is missing when using NUT_EXPORTER_VARIABLES #52

Closed
varac opened this issue Dec 15, 2024 · 5 comments

Comments

@varac
Copy link

varac commented Dec 15, 2024

I am using this docker-compose.yaml file:

services:
  nut-exporter:
    # https://github.com/DRuggeri/nut_exporter/pkgs/container/nut_exporter
    image: ghcr.io/druggeri/nut_exporter:3.1.1
    hostname: nut-exporter
    container_name: nut-exporter
    restart: unless-stopped
    ports:
      - 10.27.65.51:9199:9199/TCP
    environment:
      - NUT_EXPORTER_SERVER=10.27.65.51
      - NUT_EXPORTER_USERNAME=monitor
      - NUT_EXPORTER_PASSWORD=...

Everything work fine, the metrics network_ups_tools_ups_status is returned for different lables.

But I'd like to get the content of more variables, so I set:

NUT_EXPORTER_VARIABLES="ups.realpower,ups.load,output.voltage,outlet.power,battery.runtime,battery.charge,battery.charge.low,battery.runtime.low"

With this, the metric network_ups_tools_ups_status is missing completely.
How can I get more variables and have still the network_ups_tools_ups_status metric ?

@varac varac changed the title network_ups_tools_ups_status variable is missing when using NUT_EXPORTER_VARIABLES network_ups_tools_ups_status metric is missing when using NUT_EXPORTER_VARIABLES Dec 15, 2024
@maybesheforgot
Copy link

I think I figured it out: the variables need to be in alphabetical order. Tested on my container with this as the env variable: NUT_EXPORTER_VARIABLES=battery.charge,battery.charge.low,battery.runtime,battery.runtime.low,battery.voltage,battery.voltage.nominal,input.voltage,input.voltage.nominal,outlet.power,output.power,output.voltage,ups.load,ups.realpower.nominal,ups.status and I'm able to get everything.

@DRuggeri
Copy link
Owner

DRuggeri commented Jan 10, 2025

Hey there, @maybesheforgot - thanks for sharing this. At first blush, alphabetical order or not sounds like it should be irrelevant. I'll take a look to see if anything stands out. I'm curious how you landed on this solution? What other permutations did you try that ultimately led here?

@DRuggeri
Copy link
Owner

Circling back - I'm able to see the expected status metrics if I use NUT_EXPORTER_VARIABLES="ups.realpower,ups.load,output.voltage,outlet.power,battery.runtime,battery.charge,ups.status,battery.charge.low,battery.runtime.low". At least as far as the original report from @varac, I believe the reason that you didn't see status is because ups.status was just not in the list of requested variables. @maybesheforgot, similarly, I can get status information if I put the ups.status anywhere in the list - so maybe the alphabetical ordering was just coincidence?

Either way, I just pushed a new commit that will issue a warning on startup if ups.status is not in the list of requested metrics since that's one that I anticipate just about everyone would expect to see.

@maybesheforgot
Copy link

Ah, must’ve been coincidental then @DRuggeri. I was looking at the values from another NUT exporter utility I had running on my machine and all the values were listed alphabetically. And since that was what stood out compared to the way they were randomly listed by @varac, I figured that might be why. I want to say I originally only tested a few variables alphabetically at first, but it’s possible ups.status was among those in the test.

Thanks for following up and further clarifying this!

@varac
Copy link
Author

varac commented Jan 23, 2025

Sorry for the late feedback. I can now export all important metrics thanks to @maybesheforgot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants