Questa è una vecchia versione del documento!
Installazione
In tutti i computer/server, MASTER and SLAVE(S), apri un terminale ed esgui:
sudo apt-get install apcupsd
Configurazioni nel MASTER
1 - Edita il file diconfigurazione: Prima fai una copia del originale:
sudo cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.bak
Poi
sudo nano /etc/apcupsd/apcupsd.conf
Trova e modifica: UPSCABLE, UPSTYPE, DEVICE, TIMEOUT, BATTERYLEVEL e MINUTES
In genere le opzioni come sotto indicati dovrebbero bastare
## apcupsd.conf v1.1 ## # # for apcupsd release 3.14.12 (29 March 2014) - debian # # "apcupsd" POSIX config file # # ========= General configuration parameters ============ # ... UPSCABLE usb ... UPSTYPE usb ... #DEVICE /dev/ttyS0 # POLLTIME <int> # Interval (in seconds) at which apcupsd polls the UPS for status. This # setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, # dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting # will improve apcupsd's responsiveness to certain events at the cost of # higher CPU utilization. The default of 60 is appropriate for most # situations. #POLLTIME 60 # # ======== Configuration parameters used during power failures ========== # # Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so # the first that occurs will cause the initation of a shutdown. ... # If during a power failure, the remaining battery percentage # (as reported by the UPS) is below or equal to BATTERYLEVEL, # apcupsd will initiate a system shutdown. BATTERYLEVEL 50 ... # If during a power failure, the remaining runtime in minutes # (as calculated internally by the UPS) is below or equal to MINUTES, # apcupsd, will initiate a system shutdown. MINUTES 15 # If during a power failure, the UPS has run on batteries for TIMEOUT # many seconds or longer, apcupsd will initiate a system shutdown. # A value of 0 disables this timer. # # Note, if you have a Smart UPS, you will most likely want to disable # this timer by setting it to zero. That way, you UPS will continue # on batteries until either the % charge remaing drops to or below BATTERYLEVEL, # or the remaining battery runtime drops to or below MINUTES. Of course, # if you are testing, setting this to 60 causes a quick system shutdown # if you pull the power plug. # If you have an older dumb UPS, you will want to set this to less than # the time you know you can run on batteries. TIMEOUT 280 # # ==== Configuration statements for Network Information Server ==== # # NETSERVER [ on | off ] on enables, off disables the network # information server. ... NETSERVER on # NISIP <dotted notation ip address> ... NISIP 0.0.0.0
2 - Editare etc/apcupsd/hosts.conf
Questo file contiene i computer o server protetti dal UPS. Nel nostro caso
# Network UPS Tools - hosts.conf # # This file does double duty - it lists the systems that multimon will # monitor, and also specifies the systems that upsstats is allowed to # watch. It keeps people from feeding random addresses to upsstats, # among other things. upsimage also uses this file to know who it # may speak to. upsfstats too. # # Usage: list systems running upsd that you want to monitor # # MONITOR <address> "<host description>" MONITOR 127.0.0.1 "localhost" MONITOR 10.17.61.87 "Hansel Proxmox"
3 - Editare /etc/default/apcupsd
sudo nano /etc/default/apcupsd
impostare:
... ISCONFIGURED=yes ...
4 - Puoi riavviare il servizio apcupsd
sudo systemctl restart apcupsd.service
Configurazioni nel SLAVE
1 - Editare il file di configurazione Prima fare un backup:
sudo cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.bak
Poi
sudo nano /etc/apcupsd/apcupsd.conf
Trova e edita:UPSCABLE, UPSTYPE, DEVICE, TIMEOUT, BATTERYLEVEL e MINUTES In molti casi le configurazioni in seguito possono bastare.
## apcupsd.conf v1.1 ## # # for apcupsd release 3.14.12 (29 March 2014) - debian # # "apcupsd" POSIX config file # # ========= General configuration parameters ============ # ... UPSCABLE ether ... UPSTYPE net ... # set the MASTER COMPUTER IP (10.17.61.21 nel caso nostro) # The default port for apcupsd is 3551 DEVICE 10.17.61.21:3551 # POLLTIME <int> # Interval (in seconds) at which apcupsd polls the UPS for status. This # setting applies both to directly-attached UPSes (UPSTYPE apcsmart, usb, # dumb) and networked UPSes (UPSTYPE net, snmp). Lowering this setting # will improve apcupsd's responsiveness to certain events at the cost of # higher CPU utilization. The default of 60 is appropriate for most # situations. POLLTIME 10 ... # # ======== Configuration parameters used during power failures ========== # # Note: BATTERYLEVEL, MINUTES, and TIMEOUT work in conjunction, so # the first that occurs will cause the initation of a shutdown. ... # If during a power failure, the remaining battery percentage # (as reported by the UPS) is below or equal to BATTERYLEVEL, # apcupsd will initiate a system shutdown. BATTERYLEVEL 50 ... # If during a power failure, the remaining runtime in minutes # (as calculated internally by the UPS) is below or equal to MINUTES, # apcupsd, will initiate a system shutdown. MINUTES 10 # If during a power failure, the UPS has run on batteries for TIMEOUT # many seconds or longer, apcupsd will initiate a system shutdown. # A value of 0 disables this timer. # # Note, if you have a Smart UPS, you will most likely want to disable # this timer by setting it to zero. That way, you UPS will continue # on batteries until either the % charge remaing drops to or below BATTERYLEVEL, # or the remaining battery runtime drops to or below MINUTES. Of course, # if you are testing, setting this to 60 causes a quick system shutdown # if you pull the power plug. # If you have an older dumb UPS, you will want to set this to less than # the time you know you can run on batteries. TIMEOUT 180 # # ==== Configuration statements for Network Information Server ==== # # NETSERVER [ on | off ] on enables, off disables the network # information server. ... NETSERVER on # NISIP <dotted notation ip address> ... NISIP 0.0.0.0
2 - Editare /etc/default/apcupsd
sudo nano /etc/default/apcupsd
imposta:
... ISCONFIGURED=yes ...
3 - In fine riavviare apcupsd
sudo systemctl restart apcupsd.service
ATTENZIONE: Fare caso al valore BATTERYLEVEL,MINUTES e TIMEOUT, così in caso di mancanza corrente i SLAVE si spengano prima del MASTER.
Per vedere apcupsd logs:
tail /var/log/apcupsd.events
Per visualizzare le informazioni del UPS:
apcaccess
root@hansel:~# apcaccess APC : 001,027,0697 DATE : 2019-02-11 15:50:43 +0100 HOSTNAME : hansel VERSION : 3.14.14 (31 May 2016) debian UPSNAME : gamora CABLE : Ethernet Link DRIVER : NETWORK UPS Driver UPSMODE : Stand Alone STARTTIME: 2019-02-11 15:45:43 +0100 MASTERUPD: 2019-02-11 15:50:43 +0100 MASTER : 10.17.61.21:3551 MODEL : Smart-UPS 1500 STATUS : ONLINE SLAVE BCHARGE : 100.0 Percent TIMELEFT : 29.0 Minutes MBATTCHG : 50 Percent MINTIMEL : 10 Minutes MAXTIME : 180 Seconds BATTV : 27.4 Volts NUMXFERS : 0 TONBATT : 0 Seconds CUMONBATT: 0 Seconds XOFFBATT : N/A STATFLAG : 0x05000408 SERIALNO : AS1139122349 NOMBATTV : 24.0 Volts FIRMWARE : COM 02.1 / UPS.05.I END APC : 2019-02-11 15:51:14 +0100