The NUT package can be useful if you have an UPS connected to the router. For example, you have multiple devices connected to the UPS (PC, NAS …), but your router is the only device that runs 24/7 (or at least it runs most of the time). In this case you run NUT in netserver mode, where other devices connect to router to see UPS status and be able to shut down correctly if power fails. NUT must be installed on every machine using this feature.
NUT can be installed from trunk, as of writing this page, the Attitude Adjustment (12.09) does not contain nut packages.
There's problem with some USB UPSes (e.g. EATON) that are not recognized by usbhid-ups. This is apparently a bug in libusb-compat, since libusb (0.1.4) can recognize them.
You can work around this by installing Attitude Adjustment, manually installing packages libusb-compat and nut-driver-usbhid-ups, then manualy remove libusb-compat and install libusb istead (packages in trunk may break on having manually installed libusb)
You will want to have packages nut, nut-server and nut-client packages installed to have main functionality.
You may want to have nut-monitor installed, if you want to shutdown your router when UPS power goes critical and your device can turn itself off. Otherwise, the UPS will only provide information for you and clients.
NUT expects configuration by UCI, by putting the following into /etc/config/ups:
config driver 'eaton' option driver 'usbhid-ups' option port 'auto' config user option username 'guest' option password 'guest' option upsmon 'slave'
For the NUT to run at all, you must change the MODE in /etc/nut/nut.conf to e.g. netserver:
If you want the upsd be acccessible from network (why otherwise would you want to run nut on router?), you must put a LISTEN directive to /etc/nut/upsd.conf:
You may want to change options according to the type of UPS you have and options you want to use.
After you installed and configured NUT, you may want to setup your router for monitoring UPS. You need to install nut-monitor package and add your config to /etc/config/upsmon
Sample upsmon config
config upsmon option 'notifycmd' '/etc/nut/notify.sh' option 'onlinemsg' 'UPS %s on line power' option 'onbattmsg' 'UPS %s on battery' option 'lowbattmsg' 'UPS %s battery is low' option 'fsdmsg' 'UPS %s: forced shutdown in progress' option 'commokmsg' 'Communications with UPS %s established' option 'commbadmsg' 'Communications with UPS %s lost' option 'shutdownmsg' 'Auto logout and shutdown proceeding' option 'replbattmsg' 'UPS %s battery needs to be replaced' option 'nocommmsg' 'UPS %s is unavailable' option 'noparentmsg' 'upsmon parent process died - shutdown impossible' option 'onlinenotify' 'EXEC+SYSLOG' option 'onbattnotify' 'EXEC+SYSLOG' option 'lowbattnotify' 'EXEC+SYSLOG' option 'fsdnotify' 'EXEC+SYSLOG' option 'commoknotify' 'EXEC+SYSLOG' option 'commbadnotify' 'EXEC+SYSLOG' option 'shutdownnotify' 'EXEC+SYSLOG' option 'replbattnotify' 'EXEC+SYSLOG' option 'nocommnotify' 'EXEC+SYSLOG' option 'noparentnotify' 'EXEC+SYSLOG' config master option 'upsname' 'UPS' option 'user' 'guest' option 'password' 'guest'
Upsmon will send to notifycmd script some environment strings:
$UPSNAME - will contain the name of UPS specified in /etc/config/ups $NOTIFYTYPE - will contain the type string of whatever caused this event to happen.
inbox/software.nut.txt · Last modified: 2013/12/07 15:35 (external edit)