0

ESXi 7.x NutClient to query upsmon on Synology

After my last move I consolidated my home setup and now I am down to one synology for storage and one ESXi 7.x (currently 7.0u2d) host. I do have these two devices connected to a UPS but since UPS only has 1 USB port I needed a way to signal my two devices to power off in case of power outage.

I plugged in the USB cable from the UPS to my synology NAS and configured the UPS.

In the UI of synology goto Control Panel -> Hardware & Power -> UPS. Click on Enable UPS support and click on Device Information to ensure that your synology is speaking with the UPS.

file

Once this is verified, configure the UPS settings. The following is what I have configured. I added the IP of my ESXi to the Permitted DiskStation Devices

file

You can adapt the Time before DiskStation enters Safe Mode per your needs.

Now lets ssh to our synology and finish the configuration. Login and change directory to /usr/syno/etc/ups and look at ups.conf we are looking for

[ups]
        driver = usbhid-ups
        port = auto
        #pollonly
        #community = name
        #snmp_version = v2c
        #mibs = auto
        #secName = Synology
        #secLevel = noAuthNoPriv
        #authProtocol = MD5
        #authPassword = 111111111111
        #privProtocol = DES
        #privPassword = 222222222222

Now lets look at upsd.users, we are looking for

[monuser]
                password = secret
                upsmon master

You can change the password and the user to anything you like. Now the configuation is complete.

Lets now work on the ESXi7 side. Please download the latest NUT client from https://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/ I downloaded the file locally and scp the file to my ESXi host into /tmp/nut

uncompress the file

[root@localhost:/tmp/nut] tar -zxvf NutClient-ESXi-2.7.4-2.1.6.i386.tar.gz
readme.txt
upsmon-install.sh
upsmon-remove.sh
upsmon-update.sh
upsmon-2.7.4-2.1.6.i386.vib

Install the client

chmod +x upsmon-install.sh
./upsmon-install.sh

Configure the service, log into your ESXi via the GUI and goto Manage -> System -> Advanced settings and look for UserVars.nut and update the values pending your settings

file

Once configured goto Services and look for nutclient and you will find your service listed. Start it and also set it to start/stop with host

file

We are basically done but just to test out the communication between the ESXi host and the Synology NAS you can run the following

[root@localhost:~] /opt/nut/bin/upsc ups@192.168.1.2
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2017/08/17
battery.runtime: 932
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 13.5
battery.voltage.nominal: 12.0
device.mfr: American Power Conversion
device.model: Back-UPS NS 900M
device.serial: 4B1733P13028
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 5
driver.parameter.port: auto
driver.version: DSM6-2-25510-201118
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
input.sensitivity: medium
input.transfer.high: 139
input.transfer.low: 92
input.voltage: 121.0
input.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.shutdown: 20
ups.firmware: 932.a7 .D
ups.firmware.aux: a7
ups.load: 38
ups.mfr: American Power Conversion
ups.mfr.date: 2017/08/17
ups.model: Back-UPS NS 900M
ups.productid: 0002
ups.realpower.nominal: 480
ups.serial: 4B1733P13028
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d

and that is it!. Please ensure that your ESXi shutdown occurs before your synology is set to shutdown or else your ESXi may not be able to communicate with the synology host to get the ups status to shutdown.

jlim0930

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.