This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ups [2022/05/16 00:02] – vissie | ups [2022/05/16 23:26] (current) – [Setup NUT (Network UPS Tools)] vissie | ||
---|---|---|---|
Line 2: | Line 2: | ||
| | ||
sudo apt-get install nut nut-monitor | sudo apt-get install nut nut-monitor | ||
+ | To get vendorid and productid if you have more than one UPS: | ||
+ | lsusb | ||
+ | Lookup UPS from dmesg to find driver to use | ||
+ | | ||
sudo vim / | sudo vim / | ||
Line 9: | Line 13: | ||
port = auto | port = auto | ||
desc = "Eaton E5 1100" | desc = "Eaton E5 1100" | ||
+ | vendorid = 0463 | ||
+ | productid = ffff | ||
</ | </ | ||
sudo upsdrvctl start | sudo upsdrvctl start | ||
Line 23: | Line 29: | ||
sudo systemctl restart nut-server.service | sudo systemctl restart nut-server.service | ||
sudo systemctl status nut-server.service | sudo systemctl status nut-server.service | ||
+ | sudo systemctl enable nut-server.service | ||
upsc eaton | upsc eaton | ||
+ | | ||
+ | =====upsmon configuration===== | ||
+ | The last step is to configure upsmon to listen to upsd and take action on events. | ||
+ | vim / | ||
+ | <sxh bash; gutter: false> | ||
+ | MONITOR upsname@localhost 1 upsduser password master | ||
+ | </ | ||
+ | |||
+ | Create a notify send script file of sorts | ||
+ | vim ./ | ||
+ | <sxh bash; gutter: false> | ||
+ | # | ||
+ | import telegram | ||
+ | import sys | ||
+ | TOKEN = ' | ||
+ | user_id = ' | ||
+ | msg = sys.argv[1] | ||
+ | bot = telegram.Bot(token=TOKEN_vissie_bot) | ||
+ | bot.send_message(chat_id=user_id, | ||
+ | </ | ||
+ | sudo vim / | ||
+ | <sxh bash; gutter: false> | ||
+ | RUN_AS_USER root | ||
+ | MONITOR apc-1500@localhost 1 admin xxxx master | ||
+ | MINSUPPLIES 1 | ||
+ | NOTIFYCMD / | ||
+ | POLLFREQ 2 | ||
+ | POLLFREQALERT 1 | ||
+ | NOTIFYFLAG ONLINE | ||
+ | NOTIFYFLAG ONBATT | ||
+ | NOTIFYFLAG LOWBATT | ||
+ | </ | ||
+ | sudo systemctl status nut-monitor.service | ||
+ | sudo systemctl start nut-monitor.service | ||
+ | sudo systemctl enable nut-monitor.service | ||
+ |