User Tools

Site Tools

This wiki is read only and for archival purposes only. >>>>>>>>>> Please use the new OpenWrt wiki at <<<<<<<<<<


This shows you the differences between two versions of the page.

Link to this comparison view

inbox:software.nut [2013/05/11 18:19]
inbox:software.nut [2015/05/30 20:23] (current)
RoganDawes Add command to shut down the UPS when done
Line 1: Line 1:
 +====== Installing NUT (Network UPS Tools) ======
 +The [[http://​​|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 [[doc:​techref:​uci|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.
 +==== Configuring upsmon ====
 +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
 +<​code>​config upsmon
 +        option '​shutdowncmd'​ '/​lib/​nut/​upsdrvctl shutdown'​
 +        option '​notifycmd'​ '/​etc/​nut/​'​
 +        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.