Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
service:nut [2024/09/24 13:24] – willy | service:nut [2024/10/18 12:38] (current) – removed willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== UPS - battery backup ====== | ||
- | |||
- | An UPS is basically a big battery capable of powering your critical devices in case the main power goes out. This is very important for self-hosted services as an outage might result in a mess, specially if you are not home to restart / verify that things are back up running. | ||
- | |||
- | Running an UPS is not a set and forget task tough... Batteries usually last about 1 year, maximum 2 years for top products, and you need to replace them before they dies on you. Also, even new batteries do not have infinte capacity and you might need to poweroff your systems before they run out in case of a prolonged outage. | ||
- | |||
- | Using a good monitoring tool for UPS helps a lot. | ||
- | |||
- | ====== Network UPS Tools ====== | ||
- | |||
- | [[https:// | ||
- | |||
- | For a proper setup follow the great [[https:// | ||
- | |||
- | ===== Installation ===== | ||
- | |||
- | It's pretty simple: | ||
- | <code bash> | ||
- | emerge --ask sys-power/ | ||
- | </ | ||
- | |||
- | To detect your UPS devices, assuming it is connected locally or over the network: | ||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | the output from this command will go into the **/ | ||
- | |||
- | If your UPS is USB, you need also the following: | ||
- | <code bash> | ||
- | usermod -a -G usb nut | ||
- | </ | ||
- | |||
- | ===== Configuration ===== | ||
- | |||
- | You need to populate the following files: | ||
- | <file - nut.conf> | ||
- | MODE=netserver | ||
- | </ | ||
- | |||
- | Here you put the output of the scan command above: | ||
- | <file - ups.conf> | ||
- | [nutdev1] | ||
- | driver = " | ||
- | port = " | ||
- | vendorid = " | ||
- | productid = " | ||
- | product = "Eaton 3S" | ||
- | serial = " | ||
- | vendor = " | ||
- | bus = " | ||
- | </ | ||
- | |||
- | <file - upsd.conf> | ||
- | LISTEN 127.0.0.1 3493 | ||
- | LISTEN 10.0.0.1 3493 | ||
- | </ | ||
- | |||
- | <file - upsd.users> | ||
- | [monmaster] | ||
- | password = monmaster | ||
- | upsmon master | ||
- | |||
- | [monslave] | ||
- | password = monslave | ||
- | upsmon slave | ||
- | </ | ||
- | |||
- | <file - upsmon.conf> | ||
- | MONITOR nutdev1@127.0.0.1 1 monmaster monmaster master | ||
- | </ | ||
- | |||
- | <file - upssched.conf> | ||
- | AT ONBATT * START-TIMER onbatt 300 | ||
- | AT ONLINE * CANCEL-TIMER onbatt online | ||
- | AT LOWBATT * EXECUTE onbatt | ||
- | AT COMMBAD * START-TIMER commbad 30 | ||
- | AT COMMOK * CANCEL-TIMER commbad commok | ||
- | AT NOCOMM * EXECUTE commbad | ||
- | AT SHUTDOWN * EXECUTE powerdown | ||
- | AT REPLBATT * EXECUTE replacebatt | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ===== Autostart ===== | ||
- | |||
- | Add the following services: | ||
- | <code bash> | ||
- | rc-update add upsdrv default | ||
- | rc-update add upsd default | ||
- | rc-update add upsmon default | ||
- | |||
- | # start now: | ||
- | rc-service upsdrv start | ||
- | rc-service upsd start | ||
- | rc-service upsmon start | ||
- | </ | ||
- | |||