plugins
plugins copied to clipboard
sysutils/nut: Diagnostics --> UPS Status is empty in service mode standalone
Important notices Before you add a new report, we ask you kindly to acknowledge the following:
- [x] I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- [x] I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- [x] The title contains the plugin to which this issue belongs
Describe the bug I previously had the nut plugin running in service mode netclient and changed to standalone now because I connected my UPS directly via USB now. Under NUT --> UPS Type --> Netclient I only unchecked the enabled-checkbox but did not empty the other fields. This resulted in the UPS Status page being empty.
To Reproduce Steps to reproduce the behavior:
- Go to 'NUT --> Configuration --> General Settings'
- Check 'Enable Nut'
- Switch 'Service Mode' to 'standalone'
- Set 'Name' to 'ups'
- Click on 'Apply'
- Go to 'NUT --> Configuration --> UPS Type --> Netclient'
- Uncheck 'enable'
- Enter some valid IP-Address in 'IP Address', e.g. '10.20.10.20'
- Click on 'Apply'
- Go to 'NUT --> Diagnostics --> UPS Status'
- See empty page
Expected behavior Show the correct UPS status for '[email protected]', although an IP-Address is configured under 'NUT --> Configuration --> UPS Type --> Netclient', when Netclient is 'disabled' and/or 'service mode' is 'standalone'.
Relevant log files 'System --> Log Files --> Backend', e.g.:
2022-02-19T17:20:05 | Error | configd.py | [57265914-fd05-4dca-863f-bb098703c008] Script action failed with Command '/usr/local/bin/upsc '[email protected]'' returned non-zero exit status 1. at Traceback (most recent call last): File "/usr/local/opnsense/service/modules/processhandler.py", line 478, in execute subprocess.check_call(script_command, env=self.config_environment, shell=True, File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '/usr/local/bin/upsc '[email protected]'' returned non-zero exit status 1.
-- | -- | -- | --
Additional context https://github.com/opnsense/plugins/blob/c526550c15bf1ad8efbaef819ed1b98daf71d286/sysutils/nut/src/opnsense/mvc/app/controllers/OPNsense/Nut/Api/DiagnosticsController.php#L41-L44
Environment OPNsense 22.1.1_3-amd64 FreeBSD 13.0-STABLE OpenSSL 1.1.1m 14 Dec 2021
And what happens when you remove all configs? Usually its empty If it doesnt receive data.
Emptying 'IP Address' solves the problem. It took me some time to figure that out though. I recommend adding an additional check for $mdl->netclient->enabled
This code is only for DiagnosticsController, it won't prevent false user handling. Maybe some constraints in the model would help here.
IMHO unchecking the 'enabled' checkbox for netclient and expecting the rest of the settings on this page to be ignored is no false user handling.

The only other place these settings seem to be used is the template for upsmon.conf
https://github.com/opnsense/plugins/blob/c526550c15bf1ad8efbaef819ed1b98daf71d286/sysutils/nut/src/opnsense/service/templates/OPNsense/Nut/upsmon.conf#L9-L13
The value of ''OPNsense.Nut.netclient.enable' ' is checked there. Why not add a similar check to the DiagnosticsController too to fix this bug? I'll be happy to submit a PR if you agree.
Sure, thx :)
I can confirm that this bug exists, and I was just fighting it for a while after going through the same process. I had been using nut in netclient mode and then switched to local USB connection, but didn't delete the old config out of the netclient "driver" section (but I did uncheck "enable" for netclient).
Thanks to Starkstromkonsument for figuring this out!
@Starkstromkonsument are you still working on a PR for it?
Hi, no sorry. I startend working on it, ran into a problem and lost track.
Any update on this?
I just installed nut, accidentally "enabled" USB when I really needed netclient. "Unenabled" USB and "enabled" netclient and nothing is happening. Presumably still looking for a "USB". The logs said.
netclient connect failed: Connection failure: Operation already in progress
@Starkstromkonsument are you still working on a PR for it?
Didn't see a pr for this so I assume it's still an unresolved issue?
This issue has been automatically timed-out (after 180 days of inactivity).
For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.
If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.
I can confirm that this bug exists, and I was just fighting it for a while after going through the same process. I had been using
nutin netclient mode and then switched to local USB connection, but didn't delete the old config out of the netclient "driver" section (but I did uncheck "enable" for netclient).Thanks to Starkstromkonsument for figuring this out!
Were you able to find a way to fix this? Not fixed for me.