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

OS-Nut on OPNSense 24.7.11 configuration of SNMP-driver results in "Driver not connected"-error (likely due to hardcoded 'monuser' profile name in upsmon.conf) #4427

Open
WinterStar2 opened this issue Dec 28, 2024 · 1 comment
Labels
incomplete Issue template missing info

Comments

@WinterStar2
Copy link

WinterStar2 commented Dec 28, 2024

Describe the bug
OS-NUT version 1.9 plugin on OPNSense 24.7.11 does not allow for proper configuration of SNMP (v3) UPS.
Generates syslog error "Driver not connected".

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Services -> NUT -> Configuration
  2. Select 'Service Mode = Netclient'
  3. Fill out 'Name' = <UPSNAME_1>
  4. Select on 'UPS Type' pulldown menu: 'SNMP-Driver'
  5. Fill out under 'Extra Arguments':
    'snmp_version=v3'
    'port=<UPS_IP_Address_or_Hostname(:port)>'
    'mibs=ietf'
    'secName=<name_of_SNMP_profile_on_UPS>'
    'secLevel=authPriv' ' authProtocol=SHA'
    'authPassword=<configured_pw_in_UPS_profile'
    'privProtocol=AES'
    'privPassword=<configured_pw_in_UPS_profile'
  6. Click on 'Enable Nut.'
  7. Click on 'Services -> Nut -> Diagnostics'
  8. See nothing
  9. Click on 'System -> Log files - > General'
  10. See "UPSMon: Driver not connected"
  11. Login with SSH and 'cat / tail' config files
    /usr/local/etc/nut/upsmon.conf contains "MONITOR <UPSNAME_1> monuser <configured_pw_in_UPS_profile> master"
    /usr/local/etc/nut/ups.conf is empty
    /usr/local/etc/nut/upsd.users is empty

Expected behavior
The configuration of NUT is normally done in 3 simple steps:

  1. Edit the configuration file for the UPS, 'ups.conf'. The strings filled out in the 'Extra Arguments'-tab go in this file.

  2. Edit the configuration file for the users of the UPS daemon, 'upsd.users'. This file should contain the following:
    [] (i.e. the chosen name for the UPS entered under 'General Settings, between brackets);
    password = <configured_pw_in_UPS_profile>
    upsmon = primary (or secondary, depending on the power-down priority. Primary, meaning a primary/high priority system, goes last)
    actions = SET
    instcmds = ALL

  3. Edit the configuration file for the monitor, 'upsmon.conf'
    This file should contain at least one line, the 'MONITOR' line, constructed as follows:
    'MONITOR <UPSNAME_1> 1 <Name_of SNMP_profile_on_UPS> <configured_pw_in_UPS_profile> primary (or secondary, depending on power down priority)'

In actuality, the plugin seems to fill out the above files as follows below:

Additional context
/usr/local/etc/nut/upsd.users remains empty but should contain the bracketed UPS name entered under 'Services -> Nut -> General Setttings', followed by the 4 fields described above.

/usr/local/etc/nut/ups.conf should contain the data entered under 'Extra Arguments'.

/usr/local/etc/nut/upsmon.conf does contain a 'MONITOR-line' but this seems to have some wrong/hardcoded strings:
'MONITOR <UPSNAME_1> monuser <configured_pw_in_UPS_profile> master'

'monuser' should be overwritten with <name_of_SNMP_profile_on_UPS>, being the same string as the 'secName' configured under 'Extra Arguments'/the file 'ups.conf'. Default names for such profiles in many UPS'es are generally either 'readonly' or 'readwrite' as far as I know, just for easy reference.

It may be advisable to make editable the word 'master' and allow a selection between 'master', 'primary' or 'secondary' depending on the role of OPNsense (probably either master or primary).

One approach would be to change the dialogue screen of the SNMP-Driver as follows:

  1. 'Extra Arguments' would become 'UPS configuration arguments'
  2. An additional 'UPS monitor configuration' field with a selection of 'primary', 'master' or 'secondary'
    The rest of the info under the MONITOR string of 'upsmon.conf', such as the <UPSNAME_1>, <name_of_SNMP_profile_on_UPS> and <configured_pw_in_UPS_profile> should/could be copied to 'upsmon.conf from the strings entered from the (currently named) 'Extra Arguments'-field).

Additionally, the file 'upsd.users' should/could also be autogenerated with the <UPSNAME_1> and 'password=<configured_pw_in_UPS_profile> entered under the (currently named) 'Extra Arguments'-field.
Finally, just for clarification, I also tried choosing SNMP v1 and/or v2c with corresponding (fewer) arguments, and experienced no difference in behaviour.
My configuration approach additionally worked without exception on 5 Linux-based systems running NUT 2.8.2.

At any rate, my suspicion is that the hardcoded 'monuser' in the MONITOR string in 'upsmon.conf' is the source of the inability to connect, since this name will normally not correspond with the name of the SNMP profile on an UPS.

Environment
OPNSense 24.7.11
DEC840
OS-NUT 1.9

@OPNsense-bot
Copy link

Thank you for creating an issue.
Since the ticket doesn't seem to be using one of our templates, we're marking this issue as low priority until further notice.

For more information about the policies for this repository,
please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.

The easiest option to gain traction is to close this ticket and open a new one using one of our templates.

@OPNsense-bot OPNsense-bot added the incomplete Issue template missing info label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incomplete Issue template missing info
Development

No branches or pull requests

2 participants