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
Labels
incomplete
Issue template missing info
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:
'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'
/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:
Edit the configuration file for the UPS, 'ups.conf'. The strings filled out in the 'Extra Arguments'-tab go in this file.
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
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:
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
The text was updated successfully, but these errors were encountered: