Network UPS: connecting 3rd party devices to a EX2 running in master-mode

I managed to find our that the EX2 is using NUT aka Network UPS Tools, a standard Linux service to monitor UPS. It consists of a client and a server component and uses tcp connections on port 3493.
You can see it running on the EX2:
root@MyCloudEX2Ultra etc # netstat -tulpn | grep ups
tcp 0 0 127.0.0.1:3493 0.0.0.0:* LISTEN 6876/upsd
tcp 0 0 172.17.42.1:3493 0.0.0.0:* LISTEN 6876/upsd

The config resides in /usr/local/ups/etc.
The file upsd.users shows, that a remote user named “client” can connect using the password “123”.
The system’s local usb-connected ups is called usbhid, as one can see in ups.conf.

On a remote system you need to install nut (apt install nut nut-client) and adjust the file upsmon.conf.
An example entry would look like this:
MONITOR usbhid@MyCloudEX2 1 client 123 slave

I got a debian machine as well as a Synology running DSM connect as ups-clients to the EX2.
On Synology one needs to edit /usr/syno/etc/ups/upsmon.conf and edit the line
MONITOR ups@your-remote-hosts-ip 1 monuser secret slave
so that monuser will be changed to client and secret to 123.
You must restart the ups service afterwards.
This is a little tricky as dsm tends to overwrite it after reboot or using the dsm-webinterface.
One coud try to create a script /volume1/homes/admin/syno_scripts/upsmon-add-mycould.sh and execute it after boot with the following contents:
sed -i – ‘s/monuser secret/client 123/g’ /usr/syno/etc/ups/upsmon.conf
sed -i – ‘s/ups@/ushid@/g’ /usr/syno/etc/ups/upsmon.conf
synoservice --reload ups-net

It might be easier to add the user “monuser” with password “secret” on your EX2, see this tutorial.
Basially you just have to add this:

[monuser]
password = secret
upsmon slave

Under any circumstances you must make the configuration changes permanent, otherwise they will get lost after a reboot.

3 Likes

this is gold, you help me connecting an Ubuntu server to my Nas. mine is an EX4100, but procedure its the same. really appreciate

1 Like

For the NUT noobs out there:

There are two (#1, #2) important pieces highlighted in this post that you will need if you want your WD to be a SLAVE(not master - what I think the original post was doing) to your setup and one (#3) that I will add below:

You must make a user in your upsd.users that matches the hardcoded WD #1 user and #2 password. The one that worked for me is:
[client]
password = 123
monuser secondary

You will also have to rename your UPS in your master’s ups.conf (but I could be wrong here. I am a NUT noob, myself) to the exact #3 name WD looks for in its(WD’s) ups.conf. There are four different names in WD’s ups.conf that it could be depending on what driver is used to connect to the UPS by the master:

[usbhid]
driver = usbhid-ups
[bcmxcp]
driver = bcmxcp_usb
[megatec]
driver blazer_usb
[tripplite]
driver = tripplite_usb

Again, I am also a noob. This is my first NUT setup and my first time back into Linux stuff in a long time. Would love to hear from people who know more about how they could make NUT changes persistent on WD so we aren’t forced to do these changes on our master NUT. There is also a particularly worrying FINALDELAY 6000 line in upsmon.conf that I am worried is way too long that I tried to make a persistent change to FINALDELAY 3 that didn’t stick.

Like, where do you put the sed commands OP mentioned? I would also love to know if I am over-configuring here. Was the UPS rename too much? I have spent too long already to do any more blind tests.