You are on page 1of 5

CHAPTER 5

TESTING OF UPS
LAB 5 MONITORING A UPS WITH NUT ON UBUNTU LINUX
Estimated time to complete this lab: 30 minutes

ORI: http://mikebeach.org/2013/04/24/installing-ups-monitoring-for-a-usb-upson-ubuntu-server/
https://www.howtoforge.com/monitoring-ups-power-status-with-nut-onopensuse10.3
Network UPS Tools (NUT) is a collection of programs which provide a common
interface for monitoring and administering UPS hardware.
The primary goal of the Network UPS Tools (NUT) project is to provide reliable
monitoring of UPS hardware and ensure safe shutdowns of the systems which are
connected.
This is a developing project to monitor a large assortment of UPS hardware. Many
models have ports on the back to allow other devices to check the status. If it
gives basic information about the power and battery status, it can probably be
supported without too much difficulty.
In this lab you will monitor the UPS with NUT using dummy-ups driver. dummyups is a Driver for multi-purpose UPS emulation. There are 2 mode for dummyups: Dummy Mode & Repeater Mode. For this lab we will use Dummy Mode.
Note that, in Dummy mode, dummy-ups looks like a standard device driver to
upsd(8) and allows one to change any value for testing purposes. It is both
interactive, controllable through the upsrw(1) and upscmd(1) commands (or
equivalent graphical tool), and batchable through script files. It can be configured,
launched and used as any other real driver. This mode is mostly useful for
development and testing purposes.
After completing this lab, you will be able to install NUT on Ubuntu Server and
perform UPS monitoring using NUT.

Topology

Dummy UPS

Monitoring a UPS with NUT on Ubuntu Linux

Ubuntu Server

5-1

Lab Objectives
After completing this lab, students you will be able to:
Monitor UPS status with NUT on Ubuntu Server

Lab Procedures
A. Monitoring UPS Status with NUT on Ubuntu Server
Follow these steps to install NUT on Ubuntu Server.
1. Install the NUT software using the following command:
$ sudo apt-get install nut

2. Open file /etc/nut/ups.conf using the following command:


$ nano /etc/nut/ups.conf

3. Add the following line to ups.conf file


[dummy]
driver = dummy-ups
port = evolution500.dev
desc = "dummy-ups in dummy mode"

Note: The label in the square brackets can be anything. It identifies


the UPS to upsd and upsmon. Find your UPS model on the NUT
hardware compatibility list and substitute the corresponding driver
for usbhid-ups above. If your UPS isnt listed, find similar ones.
They probably use the same driver. If you have a USB-based UPS,
you can leave the port as auto; its ignored. Otherwise, the port will
usually be /dev/ttyS0, the first serial port, or /dev/ttyS1, the second.
If your UPS is connected via the serial port, youll need to modify
the permissions on the serial port device so that nut can access it.
Create the file /etc/udev/rules.d/99_nut-serialups.rules:
# /etc/udev/rules.d/99_nut-serialups.rules
KERNEL=="ttyS0", GROUP="nut"

Replace ttyS0 with ttyS1 if your UPS is connected to the second


serial port. Next, issue the following two commands to force udev
to make the necessary permissions change:
$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

4. Now, we need to configure upsd and upsmon. upsd communicates


with the UPS driver that we just started. upsmon communicates
with upsd and actually shuts down the machine in the event of a
power failure. Create the file /etc/nut/upsd.conf as follows:
$ sudo nano /etc/nut/upsd.conf

5. Add the following line to ups.conf file:

Monitoring a UPS with NUT on Ubuntu Linux

5-2

ACL all 0.0.0.0/0


ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all

This rejects all connections not originating from the local machine.
If you need to monitor from multiple machines, see the man page
for upsd.conf.
6. Next, create /etc/nut/upsd.users:
$ sudo nano /etc/nut/upsd.users

7. Add the following line to upsd.users file:


[local_mon]
password = oracle
allowfrom = localhost
upsmon master

You should add multiple users if you are monitoring from multiple
machines. See the man page for upsd.users for more information.
Now we need to configure upsmon.
8. Create /etc/nut/upsmon.conf as follows:
$ sudo nano /etc/nut/upsmon.conf

9. Add the following line to upsmon.conf file:


MONITOR dummy@localhost 1 local_mon oracle master
POWERDOWNFLAG /etc/killpower
SHUTDOWNCMD "/sbin/shutdown -h now"

10. Since these files contain sensitive data, we should fix the
permissions:
$ sudo chown root:nut /etc/nut/*
$ sudo chmod 640 /etc/nut/*

11. Finally, edit /etc/default/nut so that upsd and upsmon will start at
system boot:
$ sudo nano /etc/default/nut

12. Edit the following line in nut file:


START_UPSD=yes
START_UPSMON=yes

13. Run the following command which should print out some
statistics:
$ upsc dummy
battery.alarm.threshold: 0
battery.charge: 100.0

Monitoring a UPS with NUT on Ubuntu Linux

5-3

battery.charge.restart: 00
battery.date: 08/21/15
battery.packs: 000
battery.runtime: 3060
battery.runtime.low: 120
battery.voltage: 28.01
battery.voltage.nominal: 024
driver.name: dummy-ups
driver.parameter.cable: 940-0095B
driver.parameter.pollinterval: 2
driver.parameter.port: evolution500.dev
driver.version: 2.2.2
driver.version.internal: 1.99.8
input.frequency: 60.25
input.quality: FF
input.sensitivity: L
input.transfer.high: 132
input.transfer.low: 103
input.transfer.reason: S
input.voltage: 122.2
input.voltage.maximum: 122.8
input.voltage.minimum: 122.2
output.voltage: 122.2
output.voltage.nominal: 115
ups.delay.shutdown: 020
ups.delay.start: 000
ups.firmware: 60.8.D
ups.id: dummy-ups
ups.load: 037.9
ups.mfr: dummy-ups
ups.mfr.date: 08/21/15
ups.model: dummy-ups
ups.serial: xxxxxxxxxxxxx
ups.status: OL
ups.temperature: 036.4
ups.test.interval: 1209600
ups.test.result: NO

Monitoring a UPS with NUT on Ubuntu Linux

5-4

ga bisa diusahakan keluar screenshot tampilan??? Terus


dari output ini, berikan kesimpulan dan konsiderasi
buat
diperhatikan
siswanya.
(itu
output
dari
ubuntunya, kalo saya screenshoot mah item warnanya)

Dari hasil output di atas, dapat dilihat bahwa UPS yang sedang
Anda monitor memiliki nilai battery.alarm.threshold = 0
yang artinya alarm akan dihasilkan sesegera mungkin.
Beberapa parameter penting yang Anda harus monitor di antaranya
adalah:

battery.voltage:

pastikan sesuai dengan spesifikasi dari

vendors

output.voltage:

pastikan sesuai dengan spesifikasi dari

vendors

ups.status: pastikan

ups.temperature:

statusnya OL (Online)

pastikan masih di batas temperatur


normal sesuai dengan spesifikasi vendors

Untuk informasi lebih lengkapnya buka link di bawah ini:


http://www.networkupstools.org/docs/usermanual.chunked/apcs01.html

Monitoring a UPS with NUT on Ubuntu Linux

5-5

You might also like