Konfigurace NUT, změna parametrů a ovládání UPS
Nalezení UPS:
root@nuc:/etc/nut# nut-scanner
Scanning USB bus.
No start IP, skipping SNMP
Scanning XML/HTTP bus.
No start IP, skipping NUT bus (old connect method)
Scanning NUT bus (avahi method).
[nutdev1]
driver = "usbhid-ups"
port = "auto"
vendorid = "051D"
productid = "0002"
product = "Back-UPS RS 900G FW:879.L6 -P.I USB FW:L6 -P"
serial = "0B2418L09188"
vendor = "American Power Conversion"
bus = "001"
/etc/nut/ups.conf
[apc-br900]
driver = "usbhid-ups"
port = "auto"
vendorid = "051D"
productid = "0002"
default.ups.delay.shutdown = 321 # set default value
lowbatt = 33 # set default value
/etc/nut/nut.conf
MODE=netserver
nastavení UPS:
/etc/nut/upsd.conf
# Listen on the interface of this server
LISTEN 127.0.0.1 3493
#LISTEN 192.168.42.5 3493
/etc/nut/upsd.users
[username]
password = secret.password
allowfrom = localhost
actions = set
instcmds = all
upsmon master
Spouštění při bootu a start daemonů:
sudo systemctl enable nut-driver-enumerator.service
sudo systemctl enable nut-server.service
sudo systemctl enable nut-monitor.service (není nutné v případě tahání dat například do Home Assistantu)
sudo systemctl start nut-driver-enumerator.service
sudo systemctl start nut-server.service
sudo systemctl start nut-monitor.service (není nutné v případě tahání dat například do Home Assistantu)
Výpis parametrů UPS pomocí upsc:
root@nuc:~# upsc -L
Init SSL without certificate database
apc-br900: Description unavailable
root@nuc:~# upsc apc-br900@localhost:3493
Init SSL without certificate database
battery.charge: 72
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2024/05/04
battery.runtime: 5835
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 26.8
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS RS 900G
device.serial: 0B2418L09188
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0002
driver.parameter.synchronous: auto
driver.parameter.vendorid: 051D
driver.version: 2.8.0
driver.version.data: APC HID 0.98
driver.version.internal: 0.47
driver.version.usb: libusb-1.0.26 (API: 0x1000109)
input.sensitivity: medium
input.transfer.high: 294
input.transfer.low: 176
input.voltage: 238.0
input.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 879.L6 -P.I
ups.firmware.aux: L6 -P
ups.load: 8
ups.mfr: American Power Conversion
ups.mfr.date: 2024/05/04
ups.model: Back-UPS RS 900G
ups.productid: 0002
ups.realpower.nominal: 540
ups.serial: 0B2418L09188
ups.status: OL CHRG
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
Výpis parametrů UPS pomocí upsrw:
root@nuc:~# upsrw -l apc-br900
[battery.charge.low]
Remaining battery level when UPS switches to LB (percent)
Type: STRING
Maximum length: 10
Value: 10
[battery.mfr.date]
Battery manufacturing date
Type: STRING
Maximum length: 10
Value: 2024/05/04
[battery.runtime.low]
Remaining battery runtime when UPS switches to LB (seconds)
Type: STRING
Maximum length: 10
Value: 120
[input.sensitivity]
Input power sensitivity
Type: STRING
Maximum length: 10
Value: medium
[input.transfer.high]
High voltage transfer point (V)
Type: STRING
Maximum length: 10
Value: 294
[input.transfer.low]
Low voltage transfer point (V)
Type: STRING
Maximum length: 10
Value: 176
[ups.delay.shutdown]
Interval to wait after shutdown with delay command (seconds)
Type: STRING
Maximum length: 10
Value: 20
Výpis konkrétního parametru UPS pomocí upsc:
root@nuc:~# upsc apc-br900 ups.delay.shutdown
Init SSL without certificate database
20
Změna konkrétního parametru UPS pomocí upsrw:
root@nuc:~# upsrw -s "ups.delay.shutdown"="30" apc-br900
Username (root): username in /etc/nut/upsd.users
Password: password in /etc/nut/upsd.users
OK
Kontrola nastavení parametru UPS pomocí upsc:
root@nuc:~# upsc apc-br900 ups.delay.shutdown
Init SSL without certificate database
30
Zjištění dostupných příkazů:
root@HA:~# upscmd -l apc@127.0.0.1
Instant commands supported on UPS [apc]:
beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
shutdown.reboot - Shut down the load briefly while rebooting the UPS
shutdown.stop - Stop a shutdown in progress
test.battery.start.deep - Start a deep battery test
test.battery.start.quick - Start a quick battery test
test.battery.stop - Stop the battery test
test.panel.start - Start testing the UPS panel
test.panel.stop - Stop a UPS panel test
Odeslání příkazu do UPS:
root@HA:~# upscmd -u username -p secretpass apc test.battery.start