Install a UPS (nut)
From NAS-Central Buffalo - The Linkstation Wiki
(First draft) |
(2nd pass) |
||
| Line 32: | Line 32: | ||
Now that you've installed nut, you must set it up. | Now that you've installed nut, you must set it up. | ||
| - | Follow | + | Follow instructions under /usr/share/doc/nut/README.Debian |
or use this quick and dry way: | or use this quick and dry way: | ||
cd /etc/nut/ | cd /etc/nut/ | ||
| - | cp /usr/share/doc/nut/examples/ups.conf | + | cp /usr/share/doc/nut/examples/ups.conf . |
| - | cp /usr/share/doc/nut/examples/upsd.conf | + | cp /usr/share/doc/nut/examples/upsd.conf . |
| - | cp /usr/share/doc/nut/examples/upsmon.conf | + | cp /usr/share/doc/nut/examples/upsmon.conf . |
| - | cp /usr/share/doc/nut/examples/upsd.users | + | cp /usr/share/doc/nut/examples/upsd.users . |
chown nut:nut * | chown nut:nut * | ||
chmod 600 * | chmod 600 * | ||
| - | Edit ups.conf | + | ==== Edit ups.conf ==== |
| - | + | Add this anywhere inside the file: | |
| - | [myups] | + | [myups] |
driver = newhidups | driver = newhidups | ||
port = auto | port = auto | ||
| Line 51: | Line 51: | ||
desc = "My APC 1000 UPS": | desc = "My APC 1000 UPS": | ||
| - | Edit upsd.users | + | ==== Edit upsd.users ==== |
| - | + | ||
| - | [monuser] | + | Add this anywhere inside the file: |
| + | |||
| + | [monuser] | ||
password = blah | password = blah | ||
allowfrom = localhost | allowfrom = localhost | ||
| Line 64: | Line 65: | ||
| - | Edit upsmon.conf | + | ==== Edit upsmon.conf ==== |
| + | |||
Add this line: | Add this line: | ||
MONITOR myups@localhost 1 monuser blah master | MONITOR myups@localhost 1 monuser blah master | ||
| Line 71: | Line 73: | ||
in upsd.users | in upsd.users | ||
| - | Edit /etc/default/nut | + | |
| + | ==== Edit /etc/default/nut ==== | ||
Modify the first few lines to: | Modify the first few lines to: | ||
| - | # start upsd | + | # start upsd |
| - | START_UPSD=yes | + | START_UPSD=yes |
| - | # start upsmon | + | # start upsmon |
| - | START_UPSMON=yes | + | START_UPSMON=yes |
| + | |||
| + | ==== Issue a reboot ==== | ||
| + | to load the newhisups driver, upsd and upsmon | ||
reboot | reboot | ||
=== Verify UPS connectivity === | === Verify UPS connectivity === | ||
| + | |||
| + | ==== Basic connectivity ==== | ||
newhidups -u root -D -D -a apc | newhidups -u root -D -D -a apc | ||
| Line 97: | Line 105: | ||
Aug 11 15:31:38 LinkStation upsd[1608]: Client monuser@127.0.0.1 logged into UPS [myups] | Aug 11 15:31:38 LinkStation upsd[1608]: Client monuser@127.0.0.1 logged into UPS [myups] | ||
| + | ==== Power outage detection ==== | ||
If this all works, try removing power from your UPS to verify id the Linkstation will detect it. | If this all works, try removing power from your UPS to verify id the Linkstation will detect it. | ||
You should see this in your syslogs, again using | You should see this in your syslogs, again using | ||
Revision as of 07:54, 12 August 2006
Contents |
Connecting a UPS to your Linkstation
Installing Network UPS Tools (nut)
Prerequisites
Install the 2.6 kernel to get the new USB HID modules http://linkstationwiki.net/index.php?title=Category:Kernel
Setup your system to accept packages from the unstable branch (follow instructions for everything except the last step to "apt-get -t install xyz" ) http://www.linkstationwiki.net/index.php?title=Get_access_to_packages_from_the_Debian_unstable_branch#Unstable_Packages
Fix your localhost entry if applicable. This is a current bug with freelink 1.11 HG:
Modify /etc/hosts This line:
127.0.0.1 Linkstation
to
127.0.0.1 Linkstation localhost
if there was "127.0.0.1 localhost", this is good already, no need to change it.
Installing
apt-get -t unstable install nut nut-usb
which will also add the appropriate lib-usb. and install nut & nut-usb 2.0.4-2 or better
Config files setup
Now that you've installed nut, you must set it up. Follow instructions under /usr/share/doc/nut/README.Debian or use this quick and dry way:
cd /etc/nut/ cp /usr/share/doc/nut/examples/ups.conf . cp /usr/share/doc/nut/examples/upsd.conf . cp /usr/share/doc/nut/examples/upsmon.conf . cp /usr/share/doc/nut/examples/upsd.users . chown nut:nut * chmod 600 *
Edit ups.conf
Add this anywhere inside the file:
[myups]
driver = newhidups
port = auto
pollinterval = 10
desc = "My APC 1000 UPS":
Edit upsd.users
Add this anywhere inside the file:
[monuser]
password = blah
allowfrom = localhost
actions = SET
upsmon master
blah is the password you wish to use. Make sure you use the same one in upsmon.conf
Edit upsmon.conf
Add this line:
MONITOR myups@localhost 1 monuser blah master
blah is the password you wish to use. Make sure you use the same one in upsd.users
Edit /etc/default/nut
Modify the first few lines to:
# start upsd START_UPSD=yes
# start upsmon START_UPSMON=yes
Issue a reboot
to load the newhisups driver, upsd and upsmon
reboot
Verify UPS connectivity
Basic connectivity
newhidups -u root -D -D -a apc
You should see your UPS information showing up.
tail -1000 /var/log/syslog |grep ups
You should see something like this: Aug 11 15:31:38 LinkStation newhidups[1606]: Startup successful Aug 11 15:31:38 LinkStation upsd[1607]: Connected to UPS [myups]: newhidups-auto Aug 11 15:31:38 LinkStation upsd[1608]: Startup successful Aug 11 15:31:38 LinkStation upsmon[1610]: Startup successful Aug 11 15:31:38 LinkStation upsd[1608]: Connection from 127.0.0.1 Aug 11 15:31:38 LinkStation upsd[1608]: Client monuser@127.0.0.1 logged into UPS [myups]
Power outage detection
If this all works, try removing power from your UPS to verify id the Linkstation will detect it. You should see this in your syslogs, again using
tail -1000 /var/log/syslog |grep ups
Aug 10 15:59:28 LinkStation upsmon[1613]: UPS myups@localhost on battery
Aug 10 16:04:39 LinkStation upsmon[1613]: UPS myups@localhost on line power
References
Peter Selinger: Linux and the APC Back-UPS ES http://www.mathstat.dal.ca/~selinger/ups/backups.html
Network UPS Tools (nut) http://www.networkupstools.org

