CyberPower PR2000ERT2U and Network UPS Tools on Linux - Basic configuration

Content on this page is probably outdated and represents my personal knowledge, feelings and understading of things at that time.

I recently got my hands on a nice CyberPower PR2000ERT2U UPS and decided to protect my server(s) with it. Network UPS Tools project fits the bill. As I have connected the UPS to one server, but would need to shut down and notify more hosts on power interruption (but more on that in a later post). This blog post is just a quick introduction to the NUT and guides you thorough basic configuration, mostly meant as a self-reference for future, when I forget about this :)

A quick NUT overview

Network UPS Tools is a open source cross-platform project that supports various UPS-es with various connections (USB, IPMI, SNMP,…)

In a simplified view it has several layers that work in conjunction:

So we can have one Server with a connected UPS (or more ups-es, more servers) and various (networked) clients that listen for events and act upon them. Which is exactly what I needed, so that my machines that are connected to one specific UPS can all shutdown safely if needed.

Installation

Network UPS Tools are packaged for all the popular Linux distros so you can install nut-client and nut-server from your favourite package manager. First we will do the basic configuration in /etc/nut/nut.conf where we will set the “santalone” MODE for now.

Detection

There is a Hardware compatibility list and Devices Dumps Library where you can check if your UPS is supported. But even if it’s not on the list (like there is no PR2000ERT2U) - don’t worry.

You can use nut-scanner to scan your system for compatible UPS-es. The -h flag shows all the options, but as we know our UPS is connected via USB, we can just use the -U option.

root@machine:~# nut-scanner -U
SNMP library not found. SNMP search disabled.
Neon library not found. XML search disabled.
IPMI library not found. IPMI search disabled.
Scanning USB bus.
[nutdev1]
  driver = "usbhid-ups"
  port = "auto"
  vendorid = "0764"
  productid = "0601"
  product = "PR2000ERT2U"
  serial = "PVUKS0000000"
  vendor = "CPS"
  bus = "001"

Output after Scanning USB bus is a configuration snippet that we can use in our /etc/nut/ups.conf. Just copy and paste, edit the name in [] (from this example nutdev1) and you are ready to test the connection.

root@machine:~# service nut-server restart
root@machine:~# upsc nutdev1
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 0
battery.charge.warning: 35
battery.mfr.date: CPS
battery.runtime: 4440
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 2.0
battery.voltage.nominal: 22
device.mfr: CPS
device.model: PR2000ERT2U
device.serial: PVUKS2000107
device.type: ups
driver.name: usbhid-ups
driver.parameter.bus: 001
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.product: PR2000ERT2U
driver.parameter.productid: 0601
driver.parameter.serial: PVUKS0000000
driver.parameter.synchronous: no
driver.parameter.vendor: CPS
driver.parameter.vendorid: 0764
driver.version: 2.7.4
driver.version.data: CyberPower HID 0.4
driver.version.internal: 0.41
input.voltage: 239.0
input.voltage.nominal: 230
output.voltage: 255.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 14
ups.mfr: CPS
ups.model: PR2000ERT2U
ups.productid: 0601
ups.realpower.nominal: 2000
ups.serial: PVUKS0000000
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: 0
ups.timer.start: 0
ups.vendorid: 0764

If the configuration and connection is successful, you will get the data about the current state of the UPS, parameters, load, etc.

Actions

Once you have the basic connection setup, you will need to configure (or just tweak the default) the basic monitoring client that will execute actions and notifications.

Let’s first configure only local listening of nut-server, in /etc/nut/upsd.conf: Uncomment line LISTEN 127.0.0.1 3493

Add a local user in /etc/nut/upsd.users:

[upsmon_local]
 	password = <randpassword>
	upsmon master

And finally configure the client to connect to the server in /etc/nut/upsmon.conf:

MONITOR nutdev1@localhost 1 upsmon_local <randpassword> master

Finally restart te services:

root@machine:~# service nut-server restart
root@machine:~# service nut-client restart

There are some basic defaults in upsmon.conf which should be enough for basic protection and shutdown, we will explore this further in another blogpost.