User Tools

Site Tools


ups

Differences

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

Link to this comparison view

Next revision
Previous revision
ups [2022/05/15 23:51] – created vissieups [2022/05/16 23:26] (current) – [Setup NUT (Network UPS Tools)] vissie
Line 2: Line 2:
  http://www.bernaerts-nicolas.fr/linux/75-debian/335-debian-wheezy-install-monitor-eaton-ups  http://www.bernaerts-nicolas.fr/linux/75-debian/335-debian-wheezy-install-monitor-eaton-ups
   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
 + https://networkupstools.org/stable-hcl.html
  
   sudo vim /etc/nut/ups.conf    sudo vim /etc/nut/ups.conf 
-...+<sxh bash; gutter: false>
 [eaton] [eaton]
 driver = usbhid-ups driver = usbhid-ups
 port = auto port = auto
 desc = "Eaton E5 1100" desc = "Eaton E5 1100"
-sudo upsdrvctl start +vendorid = 0463 
-sudo vim /etc/nut/nut.conf +productid = ffff 
- +</sxh> 
-...+  sudo upsdrvctl start 
 +  sudo vim /etc/nut/nut.conf 
 +<sxh bash; gutter: false>
 MODE=standalone MODE=standalone
-sudo vim /etc/nut/upsd.conf +</sxh> 
-...+  sudo vim /etc/nut/upsd.conf 
 +<sxh bash; gutter: false>
 # LISTEN <address> [<port>] # LISTEN <address> [<port>]
 LISTEN 127.0.0.1 3493 LISTEN 127.0.0.1 3493
 LISTEN ::1 3493 LISTEN ::1 3493
-... +</sxh> 
-sudo systemctl restart nut-server.service  +  sudo systemctl restart nut-server.service  
-sudo systemctl status nut-server.service  +  sudo systemctl status nut-server.service  
-upsc eaton+  sudo systemctl enable nut-server.service  
 +  upsc eaton 
 +   
 +=====upsmon configuration===== 
 +The last step is to configure upsmon to listen to upsd and take action on events. 
 +  vim /etc/nut/upsmon.conf 
 +<sxh bash; gutter: false> 
 +MONITOR upsname@localhost 1 upsduser password master 
 +</sxh> 
 + 
 +Create a notify send script file of sorts  
 +  vim ./send_simple.py  
 +<sxh bash; gutter: false> 
 +#!/usr/bin/python3.7 
 +import telegram 
 +import sys 
 +TOKEN = 'mytokenhere1234567890987654321' 
 +user_id = '01234567890' 
 +msg = sys.argv[1] 
 +bot = telegram.Bot(token=TOKEN_vissie_bot) 
 +bot.send_message(chat_id=user_id, text=msg) 
 +</sxh> 
 +  sudo vim /etc/nut/upsmon.conf  
 +<sxh bash; gutter: false>  
 +RUN_AS_USER root 
 +MONITOR apc-1500@localhost 1 admin xxxx master 
 +MINSUPPLIES 1 
 +NOTIFYCMD /usr/sbin/send.py 
 +POLLFREQ 2 
 +POLLFREQALERT 1 
 +NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC 
 +NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC 
 +NOTIFYFLAG LOWBATT  SYSLOG+WALL+EXEC 
 +</sxh> 
 +  sudo systemctl status nut-monitor.service  
 +  sudo systemctl start nut-monitor.service  
 +  sudo systemctl enable nut-monitor.service  
ups.1652683880.txt.gz · Last modified: 2022/05/15 23:51 by vissie