Difference between revisions of "NUT"

From Indie IT Wiki
 
Line 8: Line 8:
  
 
https://pastebin.com/nLdnKPRS
 
https://pastebin.com/nLdnKPRS
 +
 +
 +
 +
 +
https://ultramax.co.uk/catalog/product/view/id/1708/s/ultra-max-1000sc-usb-1000va-600w-line-interactive-battery-backup-ups-system/category/145/
 +
 +
 +
$ apt-get update && apt-get install -y build-essential autoconf gettext libusb-dev git
 +
$ git clone https://github.com/networkupstools/nut
 +
$ cd nut
 +
$ ./autogen.sh
 +
(Add the nut user and nut group before next step)
 +
$ ./configure --prefix=/usr --with-user=nut --with-group=nut --sysconfdir=/etc/nut
 +
$ make
 +
$ sudo make install
 +
 +
 +
user = root
 +
maxretry = 3
 +
[ultramax]
 +
  driver = "nutdrv_qx"
 +
  port = "auto"
 +
  vendorid = "0665"
 +
  productid = "5161"
 +
  product = "USB to Serial"
 +
  vendor = "WCHCH544"
 +
  bus = "003"
 +
  device = "005"
 +
 +
 +
$ sudo upsdrvctl start
 +
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356
 +
Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-Windows-542-gccfb356)
 +
USB communication driver (libusb 1.0) 0.45
 +
Using protocol: Mustek 0.07
 +
Can't autodetect number of battery packs [-1/27.20]
 +
Battery runtime will not be calculated (runtimecal not set)
 +
 +
 +
Jan 30 10:05:11 nas nutdrv_qx[8390]: Can't autodetect number of battery packs [-1/27.20]
 +
Jan 30 10:05:11 nas nutdrv_qx[8390]: Battery runtime will not be calculated (runtimecal not set)
 +
Jan 30 10:05:12 nas nutdrv_qx[8570]: Startup successful
 +
 +
 +
$ upsc ultramax@localhost
 +
battery.voltage: 27.20
 +
device.type: ups
 +
driver.name: nutdrv_qx
 +
driver.parameter.bus: 003
 +
driver.parameter.device: 005
 +
driver.parameter.pollfreq: 30
 +
driver.parameter.pollinterval: 2
 +
driver.parameter.port: auto
 +
driver.parameter.product: USB to Serial
 +
driver.parameter.productid: 5161
 +
driver.parameter.synchronous: auto
 +
driver.parameter.vendor: WCHCH544
 +
driver.parameter.vendorid: 0665
 +
driver.state: quiet
 +
driver.version: 2.8.0-Windows-542-gccfb356
 +
driver.version.data: Mustek 0.07
 +
driver.version.internal: 0.32
 +
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
 +
input.frequency: 50.0
 +
input.voltage: 242.3
 +
input.voltage.fault: 242.3
 +
output.voltage: 242.3
 +
ups.beeper.status: enabled
 +
ups.delay.shutdown: 30
 +
ups.delay.start: 180
 +
ups.load: 13
 +
ups.productid: 5161
 +
ups.status: OL
 +
ups.type: offline / line interactive
 +
ups.vendorid: 0665
 +
 +
 +
$ sudo /usr/sbin/upsmon
 +
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356
 +
fopen /run/upsmon.pid: No such file or directory
 +
Could not find PID file to see if previous upsmon instance is already running!
 +
UPS: ultramax@localhost (primary) (power value 1)
 +
Using power down flag file /etc/killpower
 +
 +
 +
user = root
 +
maxretry = 3
 +
[ultramax]
 +
  driver = "nutdrv_qx"
 +
  port = "auto"
 +
  vendorid = "0665"
 +
  productid = "5161"
 +
  product = "USB to Serial"
 +
  vendor = "WCHCH544"
 +
  bus = "003"
 +
  default.battery.voltage.high = 24
 +
  default.battery.voltage.low = 1
 +
  override.battery.packs = 2
 +
 +
 +
$ upsc ultramax@localhost
 +
battery.charge: 100
 +
battery.packs: 2
 +
battery.voltage: 27.20
 +
battery.voltage.high: 24
 +
battery.voltage.low: 1
 +
device.type: ups
 +
driver.name: nutdrv_qx
 +
driver.parameter.bus: 003
 +
driver.parameter.pollfreq: 30
 +
driver.parameter.pollinterval: 2
 +
driver.parameter.port: auto
 +
driver.parameter.product: USB to Serial
 +
driver.parameter.productid: 5161
 +
driver.parameter.synchronous: auto
 +
driver.parameter.vendor: WCHCH544
 +
driver.parameter.vendorid: 0665
 +
driver.state: quiet
 +
driver.version: 2.8.0-Windows-542-gccfb356
 +
driver.version.data: Mustek 0.07
 +
driver.version.internal: 0.32
 +
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
 +
input.frequency: 50.2
 +
input.voltage: 242.3
 +
input.voltage.fault: 242.3
 +
output.voltage: 242.3
 +
ups.beeper.status: enabled
 +
ups.delay.shutdown: 30
 +
ups.delay.start: 180
 +
ups.load: 13
 +
ups.productid: 5161
 +
ups.status: OL
 +
ups.type: offline / line interactive
 +
ups.vendorid: 0665
 +
 +
 +
MORE TWEAKS!
 +
 +
 +
FIX USER PERMISSIONS AND SET THE BATTERY VOLTAGE AND RUNTIME
 +
 +
 +
$ chown -R root:nut /etc/nut
 +
$ chown -R root:nut /var/state/ups/
 +
$ chmod o-r /etc/nut/upsd.conf
 +
$ chmod o-r /etc/nut/upsd.users
 +
 +
 +
user = nut
 +
maxretry = 3
 +
[ultramax]
 +
  driver = "nutdrv_qx"
 +
  port = "auto"
 +
  vendorid = "0665"
 +
  productid = "5161"
 +
  product = "USB to Serial"
 +
  vendor = "WCHCH544"
 +
  bus = "003"
 +
  default.battery.voltage.high = 24
 +
  default.battery.voltage.low = 1
 +
  override.battery.packs = 2
 +
  runtimecal = 300,100,900,50
 +
  chargetime = 21600
 +
  idleload = 10 
 +
 +
 +
$ /usr/sbin/upsdrvctl start
 +
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356
 +
Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-Windows-542-gccfb356)
 +
USB communication driver (libusb 1.0) 0.45
 +
Using protocol: Mustek 0.07
 +
 +
 +
$ /usr/sbin/upsd
 +
Network UPS Tools upsd 2.8.0-Windows-542-gccfb356
 +
fopen /var/state/ups/upsd.pid: No such file or directory
 +
Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!
 +
listening on 192.168.0.252 port 3493
 +
listening on 127.0.0.1 port 3493
 +
Connected to UPS [ultramax]: nutdrv_qx-ultramax
 +
Found 1 UPS defined in ups.conf
 +
 +
 +
$ upsc ultramax@localhost
 +
battery.charge: 100
 +
battery.packs: 2
 +
battery.runtime: 3000
 +
battery.voltage: 27.20
 +
battery.voltage.high: 24
 +
battery.voltage.low: 1
 +
device.type: ups
 +
driver.name: nutdrv_qx
 +
driver.parameter.bus: 003
 +
driver.parameter.chargetime: 21600
 +
driver.parameter.idleload: 10
 +
driver.parameter.pollfreq: 30
 +
driver.parameter.pollinterval: 2
 +
driver.parameter.port: auto
 +
driver.parameter.product: USB to Serial
 +
driver.parameter.productid: 5161
 +
driver.parameter.runtimecal: 300,100,900,50
 +
driver.parameter.synchronous: auto
 +
driver.parameter.vendor: WCHCH544
 +
driver.parameter.vendorid: 0665
 +
driver.state: quiet
 +
driver.version: 2.8.0-Windows-542-gccfb356
 +
driver.version.data: Mustek 0.07
 +
driver.version.internal: 0.32
 +
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
 +
input.frequency: 50.2
 +
input.voltage: 242.3
 +
input.voltage.fault: 242.3
 +
output.voltage: 242.3
 +
ups.beeper.status: enabled
 +
ups.delay.shutdown: 30
 +
ups.delay.start: 180
 +
ups.load: 13
 +
ups.productid: 5161
 +
ups.status: OL
 +
ups.type: offline / line interactive
 +
ups.vendorid: 0665
 +
 +
 +
$ /usr/sbin/upsmon
 +
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356
 +
kill: No such process
 +
UPS: ultramax@localhost (primary) (power value 1)
 +
Using power down flag file /etc/killpower
 +
 +
 +
STARTUP SCRIPTS FOR UBUNTU LINUX - JUST ADDED IT TO /ETC/RC.LOCAL
 +
 +
 +
$ nano /etc/rc.local
 +
# start NUT
 +
/usr/sbin/upsdrvctl start &>/dev/null
 +
/bin/sleep 30s &>/dev/null
 +
/usr/sbin/upsd &>/dev/null
 +
/bin/sleep 3s &>/dev/null
 +
/usr/sbin/upsmon &>/dev/null
 +
 +
 +
HOW TO STOP THE NUT SOFTWARE CORRECTLY  :)
 +
 +
 +
$ /usr/sbin/upsmon -c stop
 +
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356
 +
 +
$ /usr/sbin/upsd -c stop
 +
Network UPS Tools upsd 2.8.0-Windows-542-gccfb356
 +
 +
$ /usr/sbin/upsdrvctl stop
 +
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356
  
 
== Installation NEW ==
 
== Installation NEW ==

Latest revision as of 12:50, 7 October 2024

The primary goal of the Network UPS Tools (NUT) project is to provide support for Power Devices, such as Uninterruptible Power Supplies, Power Distribution Units, Automatic Transfer Switch, Power Supply Units and Solar Controllers.


Hardware

UltraMax 1000SC

https://pastebin.com/nLdnKPRS



https://ultramax.co.uk/catalog/product/view/id/1708/s/ultra-max-1000sc-usb-1000va-600w-line-interactive-battery-backup-ups-system/category/145/


$ apt-get update && apt-get install -y build-essential autoconf gettext libusb-dev git
$ git clone https://github.com/networkupstools/nut
$ cd nut
$ ./autogen.sh 
(Add the nut user and nut group before next step)
$ ./configure --prefix=/usr --with-user=nut --with-group=nut --sysconfdir=/etc/nut
$ make
$ sudo make install


user = root
maxretry = 3
[ultramax]
  driver = "nutdrv_qx"
  port = "auto"
  vendorid = "0665"
  productid = "5161"
  product = "USB to Serial"
  vendor = "WCHCH544"
  bus = "003"
  device = "005"


$ sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356
Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-Windows-542-gccfb356)
USB communication driver (libusb 1.0) 0.45
Using protocol: Mustek 0.07
Can't autodetect number of battery packs [-1/27.20]
Battery runtime will not be calculated (runtimecal not set)


Jan 30 10:05:11 nas nutdrv_qx[8390]: Can't autodetect number of battery packs [-1/27.20]
Jan 30 10:05:11 nas nutdrv_qx[8390]: Battery runtime will not be calculated (runtimecal not set)
Jan 30 10:05:12 nas nutdrv_qx[8570]: Startup successful


$ upsc ultramax@localhost
battery.voltage: 27.20
device.type: ups
driver.name: nutdrv_qx
driver.parameter.bus: 003
driver.parameter.device: 005
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: USB to Serial
driver.parameter.productid: 5161
driver.parameter.synchronous: auto
driver.parameter.vendor: WCHCH544
driver.parameter.vendorid: 0665
driver.state: quiet
driver.version: 2.8.0-Windows-542-gccfb356
driver.version.data: Mustek 0.07
driver.version.internal: 0.32
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
input.frequency: 50.0
input.voltage: 242.3
input.voltage.fault: 242.3
output.voltage: 242.3
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 13
ups.productid: 5161
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0665


$ sudo /usr/sbin/upsmon
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356
fopen /run/upsmon.pid: No such file or directory
Could not find PID file to see if previous upsmon instance is already running!
UPS: ultramax@localhost (primary) (power value 1)
Using power down flag file /etc/killpower


user = root
maxretry = 3
[ultramax]
  driver = "nutdrv_qx"
  port = "auto"
  vendorid = "0665"
  productid = "5161"
  product = "USB to Serial"
  vendor = "WCHCH544"
  bus = "003"
  default.battery.voltage.high = 24
  default.battery.voltage.low = 1
  override.battery.packs = 2


$ upsc ultramax@localhost
battery.charge: 100
battery.packs: 2
battery.voltage: 27.20
battery.voltage.high: 24
battery.voltage.low: 1
device.type: ups
driver.name: nutdrv_qx
driver.parameter.bus: 003
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: USB to Serial
driver.parameter.productid: 5161
driver.parameter.synchronous: auto
driver.parameter.vendor: WCHCH544
driver.parameter.vendorid: 0665
driver.state: quiet
driver.version: 2.8.0-Windows-542-gccfb356
driver.version.data: Mustek 0.07
driver.version.internal: 0.32
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
input.frequency: 50.2
input.voltage: 242.3
input.voltage.fault: 242.3
output.voltage: 242.3
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 13
ups.productid: 5161
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0665


MORE TWEAKS!


FIX USER PERMISSIONS AND SET THE BATTERY VOLTAGE AND RUNTIME


$ chown -R root:nut /etc/nut
$ chown -R root:nut /var/state/ups/
$ chmod o-r /etc/nut/upsd.conf
$ chmod o-r /etc/nut/upsd.users


user = nut
maxretry = 3
[ultramax]
  driver = "nutdrv_qx"
  port = "auto"
  vendorid = "0665"
  productid = "5161"
  product = "USB to Serial"
  vendor = "WCHCH544"
  bus = "003"
  default.battery.voltage.high = 24
  default.battery.voltage.low = 1
  override.battery.packs = 2
  runtimecal = 300,100,900,50
  chargetime = 21600
  idleload = 10   


$ /usr/sbin/upsdrvctl start
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356
Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-Windows-542-gccfb356)
USB communication driver (libusb 1.0) 0.45
Using protocol: Mustek 0.07


$ /usr/sbin/upsd
Network UPS Tools upsd 2.8.0-Windows-542-gccfb356
fopen /var/state/ups/upsd.pid: No such file or directory
Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!
listening on 192.168.0.252 port 3493
listening on 127.0.0.1 port 3493
Connected to UPS [ultramax]: nutdrv_qx-ultramax
Found 1 UPS defined in ups.conf


$ upsc ultramax@localhost
battery.charge: 100
battery.packs: 2
battery.runtime: 3000
battery.voltage: 27.20
battery.voltage.high: 24
battery.voltage.low: 1
device.type: ups
driver.name: nutdrv_qx
driver.parameter.bus: 003
driver.parameter.chargetime: 21600
driver.parameter.idleload: 10
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: USB to Serial
driver.parameter.productid: 5161
driver.parameter.runtimecal: 300,100,900,50
driver.parameter.synchronous: auto
driver.parameter.vendor: WCHCH544
driver.parameter.vendorid: 0665
driver.state: quiet
driver.version: 2.8.0-Windows-542-gccfb356
driver.version.data: Mustek 0.07
driver.version.internal: 0.32
driver.version.usb: libusb-1.0.20 (API: 0x1000104)
input.frequency: 50.2
input.voltage: 242.3
input.voltage.fault: 242.3
output.voltage: 242.3
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.load: 13
ups.productid: 5161
ups.status: OL
ups.type: offline / line interactive
ups.vendorid: 0665


$ /usr/sbin/upsmon
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356
kill: No such process
UPS: ultramax@localhost (primary) (power value 1)
Using power down flag file /etc/killpower


STARTUP SCRIPTS FOR UBUNTU LINUX - JUST ADDED IT TO /ETC/RC.LOCAL


$ nano /etc/rc.local
# start NUT
/usr/sbin/upsdrvctl start &>/dev/null
/bin/sleep 30s &>/dev/null
/usr/sbin/upsd &>/dev/null
/bin/sleep 3s &>/dev/null
/usr/sbin/upsmon &>/dev/null


HOW TO STOP THE NUT SOFTWARE CORRECTLY  :)


$ /usr/sbin/upsmon -c stop
Network UPS Tools upsmon 2.8.0-Windows-542-gccfb356

$ /usr/sbin/upsd -c stop
Network UPS Tools upsd 2.8.0-Windows-542-gccfb356

$ /usr/sbin/upsdrvctl stop
Network UPS Tools - UPS driver controller 2.8.0-Windows-542-gccfb356

Installation NEW

Installation OLD

sudo apt-get install nut
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo nano /etc/nut/nut.conf
MODE=standalone
sudo nano /etc/nut/ups.conf
[salicru]
    driver = blazer_usb
    port = auto
    vendorid = 0665
sudo nano /etc/nut/upsd.users
[upsmon]
    password  = pass
    upsmon master
sudo nano /etc/nut/upsmon.conf
MONITOR salicru@localhost 1 upsmon pass master
sudo upsdrvctl start
sudo /etc/init.d/nut-server start
sudo systemctl status nut-server.service 
sudo /etc/init.d/ups-monitor start
sudo upsc salicru@localhost

HOWTO: Fix USB Permissions Error

chmod 0666 /dev/bus/usb/005/* && /etc/init.d/upsdrv start
/etc/init.d/upsd start
/etc/init.d/upsmon start
upsc cyberpower@localhost