Milhouse
Guru
- Joined
- Jun 1, 2011
- Messages
- 564
(Continuation of this thread which I hijacked)
FreeNAS 8.0.1-RELEASE currently supports locally attached UPS, but not network UPS. The aim of this thread is to assist developers in moving towards supporting both local and network UPS.
To get FreeNAS 8.0.1-R (r8081) to monitor a network UPS (called ups, on host 192.168.0.2), the following changes are necessary to hard-coded localhost variables:
1. Modifying rc.conf.local in _nut_config() as follows:
In the above, both the name of the UPS ("ups") and it's host ("localhost") are hardcoded, when both of these should be variables set by the GUI.
2. Changing /usr/local/etc/nut/upsmon.conf:
Again, "ups" is the name of the remote UPS, and 192.168.0.2 the host IP address.
Notice that the monitor type has changed to slave, from master.
The user and password no longer seem to be important when in slave mode, although this could (and indeed most likely is) just my setup lacking authentication (the user on my UPS host is certainly not upsmon, nor is the password fixmepass).
3. In /etc/local/rc.d/nut_upsmon, the following line is erroneous:
The above line causes /usr/local/sbin/upsmon to run with the argument "localhost", which while not a problem is not a valid argument so it is ignored - the setting of nut_upsmon_flags isn't required in nut_upsmon and can be removed.
With the above changes, /etc/local/rc.d/nut_upsmon and /etc/local/rc.d/nut_upslog should be able to start, although unfortunately the config files are overwritten with each service start, which makes testing tricky!
But at least with changes #1 & #2, nut_upslog and nut_upsmon can be started manually, and will log and monitor appropriately. Change #3 is just a nit.
So in summary, the UPS service settings GUI needs to allow the user to choose whether to monitor a local or remote (network) UPS.
When monitoring a network UPS, the UPS name - not necessarily the same as the current Identifier field, though it could be re-used as such, I guess - and the IP/hostname need to be specified, and then used in place of localhost when writing out the configs.
A valid username and password *may* also need to be specified, depending on remote setup/authentication requirements - currently the UPS user is hardcoded as upsmon.
In addition, a way to view the battery status is sorely missing from the GUI - the output from upsc should be sufficient, eg. upsc ups@localhost or upsc ups@192.168.0.2 etc.).
Which OIDs are you interested in? Does the local UPS support SNMP, I don't see it loading or specifying any UPS MIBs.
FreeNAS 8.0.1-RELEASE currently supports locally attached UPS, but not network UPS. The aim of this thread is to assist developers in moving towards supporting both local and network UPS.
To get FreeNAS 8.0.1-R (r8081) to monitor a network UPS (called ups, on host 192.168.0.2), the following changes are necessary to hard-coded localhost variables:
1. Modifying rc.conf.local in _nut_config() as follows:
Code:
# echo "nut_upslog_ups=\"ups@localhost\"" echo "nut_upslog_ups=\"ups@192.168.0.2\""
In the above, both the name of the UPS ("ups") and it's host ("localhost") are hardcoded, when both of these should be variables set by the GUI.
2. Changing /usr/local/etc/nut/upsmon.conf:
Code:
#MONITOR ups 1 upsmon fixmepass master MONITOR ups@192.168.0.2 1 upsmon fixmepass slave
Again, "ups" is the name of the remote UPS, and 192.168.0.2 the host IP address.
Notice that the monitor type has changed to slave, from master.
The user and password no longer seem to be important when in slave mode, although this could (and indeed most likely is) just my setup lacking authentication (the user on my UPS host is certainly not upsmon, nor is the password fixmepass).
3. In /etc/local/rc.d/nut_upsmon, the following line is erroneous:
Code:
nut_upsmon_flags=${nut_upsmon_flags-"localhost"}
The above line causes /usr/local/sbin/upsmon to run with the argument "localhost", which while not a problem is not a valid argument so it is ignored - the setting of nut_upsmon_flags isn't required in nut_upsmon and can be removed.
With the above changes, /etc/local/rc.d/nut_upsmon and /etc/local/rc.d/nut_upslog should be able to start, although unfortunately the config files are overwritten with each service start, which makes testing tricky!
But at least with changes #1 & #2, nut_upslog and nut_upsmon can be started manually, and will log and monitor appropriately. Change #3 is just a nit.
So in summary, the UPS service settings GUI needs to allow the user to choose whether to monitor a local or remote (network) UPS.
When monitoring a network UPS, the UPS name - not necessarily the same as the current Identifier field, though it could be re-used as such, I guess - and the IP/hostname need to be specified, and then used in place of localhost when writing out the configs.
A valid username and password *may* also need to be specified, depending on remote setup/authentication requirements - currently the UPS user is hardcoded as upsmon.
In addition, a way to view the battery status is sorely missing from the GUI - the output from upsc should be sufficient, eg. upsc ups@localhost or upsc ups@192.168.0.2 etc.).
Ofc, there is a dummy-ups, but that doesnt emulate SNMP packets over the network ;)
Which OIDs are you interested in? Does the local UPS support SNMP, I don't see it loading or specifying any UPS MIBs.