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

nut-scanner should add non-standard NUT ports to "nutclient" configs #1815

Closed
jimklimov opened this issue Jan 16, 2023 · 1 comment · Fixed by #1814
Closed

nut-scanner should add non-standard NUT ports to "nutclient" configs #1815

jimklimov opened this issue Jan 16, 2023 · 1 comment · Fixed by #1814

Comments

@jimklimov
Copy link
Member

jimklimov commented Jan 16, 2023

While searching for devices served by upsd on a random NUT_PORT in the NIT suite, the script gets the following config from nut-scanner:

[nutdev1]
        driver = "nutclient"
        port = "dummy@127.0.0.1"
[nutdev2]
        driver = "nutclient"
        port = "UPS1@127.0.0.1"
[nutdev3]
        driver = "nutclient"
        port = "UPS2@127.0.0.1"

So the NUT_PORT values are not appended, e.g. as port = "UPS2@127.0.0.1:12345". As currently provided, clients using this config would try upsd on port 3493 which would likely not serve such devices.

This ticket is about fixing that, after making sure the clients (dummy-ups relay, upsc, etc.) can actually parse this format (should for decades, unless something broke).

Tests added per #1814 should verify that the port is mentioned in output (unless it is default).

@jimklimov jimklimov added this to the 2.8.1 milestone Jan 16, 2023
@jimklimov
Copy link
Member Author

The format does work for dummy-ups:

:; DEBUG_SLEEP=600 make check-NIT &
...
[INFO] Sleeping now as asked (for 600 seconds starting Mon Jan 16 09:27:07 UTC 2023),
 so you can play with the driver and server running; hint: export NUT_PORT=35078

:; ./drivers/dummy-ups -s ddd -d1 -x port="UPS1@127.0.0.1:35078"
Network UPS Tools - Device simulation and repeater driver 0.15 (2.8.0-Windows-433-ga050851b2)
battery.charge: 90
battery.charge.low: 30
battery.runtime: 3690
battery.voltage: 230.0
device.mfr: MGE UPS SYSTEMS
device.model: Pulsar Evolution 500
device.serial: AV2G3300L
device.type: ups
driver.name: dummy-ups
driver.parameter.mode: repeater
driver.parameter.pollinterval: 2
driver.parameter.port: UPS1@127.0.0.1:35078
driver.parameter.synchronous: auto
driver.state: dumping
driver.version: 2.8.0-Windows-433-ga050851b2
driver.version.internal: 0.15
input.frequency: 49.0
input.transfer.boost.low: 184.0
input.transfer.high: 294.0
input.transfer.low: 160.0
input.transfer.trim.high: 265.0
input.voltage: 230.0
outlet.1.autoswitch.charge.low: 0
outlet.1.delay.shutdown: -1
outlet.1.delay.start: -1
outlet.1.desc: PowerShare Outlet 1
outlet.1.id: 1
outlet.1.switch: 1
outlet.1.switchable: 1
outlet.2.autoswitch.charge.low: 0
outlet.2.delay.shutdown: -1
outlet.2.delay.start: -1
outlet.2.desc: PowerShare Outlet 2
outlet.2.id: 2
outlet.2.switch: 1
outlet.2.switchable: 1
outlet.desc: Main Outlet
outlet.id: 0
outlet.switchable: 0
output.current: 0.00
output.frequency: 49.0
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.delay.shutdown: -1
ups.delay.start: -10
ups.load: 10
ups.mfr: MGE UPS SYSTEMS
ups.model: Pulsar Evolution 500
ups.power.nominal: 500
ups.serial: AV2G3300L
ups.status: OL CHRG
ups.test.interval: 604800
ups.test.result: Done and passed

Same for upsc:

:; ./clients/upsc "UPS1@127.0.0.1:35078"
battery.charge: 90
battery.charge.low: 30
battery.runtime: 3690
battery.voltage: 230.0
device.mfr: MGE UPS SYSTEMS
device.model: Pulsar Evolution 500
device.serial: AV2G3300L
device.type: ups
driver.name: dummy-ups
driver.parameter.mode: dummy-loop
driver.parameter.pollinterval: 2
driver.parameter.port: evolution500.seq
driver.parameter.synchronous: auto
driver.state: quiet
driver.version: 2.8.0-Windows-433-ga050851b2
driver.version.internal: 0.15
input.frequency: 49.0
input.transfer.boost.low: 184.0
input.transfer.high: 294.0
input.transfer.low: 160.0
input.transfer.trim.high: 265.0
input.voltage: 230.0
outlet.1.autoswitch.charge.low: 0
outlet.1.delay.shutdown: -1
outlet.1.delay.start: -1
outlet.1.desc: PowerShare Outlet 1
outlet.1.id: 1
outlet.1.switch: 1
outlet.1.switchable: 1
outlet.2.autoswitch.charge.low: 0
outlet.2.delay.shutdown: -1
outlet.2.delay.start: -1
outlet.2.desc: PowerShare Outlet 2
outlet.2.id: 2
outlet.2.switch: 1
outlet.2.switchable: 1
outlet.desc: Main Outlet
outlet.id: 0
outlet.switchable: 0
output.current: 0.00
output.frequency: 49.0
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.delay.shutdown: -1
ups.delay.start: -10
ups.load: 10
ups.mfr: MGE UPS SYSTEMS
ups.model: Pulsar Evolution 500
ups.power.nominal: 500
ups.serial: AV2G3300L
ups.status: OL CHRG
ups.test.interval: 604800
ups.test.result: Done and passed

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

Successfully merging a pull request may close this issue.

1 participant