[Plugin] NUT v2 - Network UPS Tools


dmacias

Recommended Posts

PSA

 

Since it *appears* that @dmacias is absent and development has stopped on all of his plugins, if in the future this plugin winds up having compatibility issues with the OS then it will be marked as deprecated / obsolete. 

 

There is nothing however at this time that I can tell that would dictate any user to stop using this plugin or for me to take that action (short of a very minor display aberration)

Link to comment

Thanks for the posts @k1netic I have been trying for a couple of weeks to figure out how to  get the digitech UPS connected, your troubleshooting helped a lot. You haven't figured out how to get the system to do a clean shutdown have you? I'm finding that it's ignoring the no ups shutdown command and the delay doesn't work. As soon as the command is sent the UPS shuts off giving unraid a dirty shutdown

Link to comment
On 8/25/2022 at 10:54 PM, cantanga said:

Thanks for the posts @k1netic I have been trying for a couple of weeks to figure out how to  get the digitech UPS connected, your troubleshooting helped a lot. You haven't figured out how to get the system to do a clean shutdown have you? I'm finding that it's ignoring the no ups shutdown command and the delay doesn't work. As soon as the command is sent the UPS shuts off giving unraid a dirty shutdown

 

 

Hey mate,

 

Yeah I have a clean shutdown once the UPS switches to battery mode with notifications working. The settings

 

langid_fix = 0x409
novendor
noscanlangid

 

are needed otherwise I get initial data but nothing after that.

 

 

My problem is the opposite though. The UPS wont shutdown after the server, so the server never knows to turn back on once AC power is reapplied to the UPS.

 

My settings

 

ups.conf

[ups]
driver = nutdrv_qx
port = auto
subdriver = hunnox
productid = 0000
vendorid = 0001
product = MEC0003
protocol = hunnox
langid_fix = 0x409
novendor
noscanlangid

default.battery.voltage.high = 13.7
default.battery.voltage.low = 11
default.battery.voltage.nominal = 12.7
runtimecal = 480,100,1200,50
idleload = 15

ondelay = 360
offdelay = 300

 

upsd.conf

LISTEN 127.0.0.1

 

 

upsd.users

[admin]
password=adminpass
actions=set
actions=fsd
instcmds=all
[monuser]
password=monpass
upsmon master
[slaveuser]
password=slavepass
upsmon slave

 

 

upsmon.conf

MONITOR [email protected] 1 monuser monpass master
SHUTDOWNCMD "/sbin/poweroff"
POWERDOWNFLAG /etc/nut/no_killpower
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYCMD "/usr/sbin/nut-notify"

 

 

What have you done to get an immediate UPS shutdown?

Link to comment

I finally got it all working, i was getting permissions errors and the like trying to get

upsdrvctl shutdown

to work so....

 

I uploaded @IGHOR's file to my dropbox to create a direct download link

 

i edited the nut.plg to point to the file on dropbox and installed the plugin pulling the modified .txz

 

finally for my setup i needed

user = root 

in global settings of ups.conf

 

I can pull the power, the server notifies me, then after a specified time shuts down. Another specified time after that using

offdelay = 180
ondelay = 0

in ups.conf and the ups shuts off too.

 

Finally. That was painful.

  • Like 1
Link to comment
On 8/27/2022 at 11:33 AM, k1netic said:

 

 

Hey mate,

 

Yeah I have a clean shutdown once the UPS switches to battery mode with notifications working. The settings

 

langid_fix = 0x409
novendor
noscanlangid

 

are needed otherwise I get initial data but nothing after that.

 

 

My problem is the opposite though. The UPS wont shutdown after the server, so the server never knows to turn back on once AC power is reapplied to the UPS.

 

...

What have you done to get an immediate UPS shutdown?

 

No idea. Seems to be pretty much the exact same configuration as yours (except for some tweaking on the runtimecal)

 

I am definitely above my head on this one, but hey I'm learning something, not sure what it is, but something.

 

Can I ask what you mean by:

 

i edited the nut.plg to point to the file on dropbox and installed the plugin pulling the modified .txz

 

was it <!ENTITY gitURL you edited? or is it something different you changed in nut.plg to point to the modified .txz?

Edited by cantanga
Link to comment
18 hours ago, cantanga said:

 

No idea. Seems to be pretty much the exact same configuration as yours (except for some tweaking on the runtimecal)

 

I am definitely above my head on this one, but hey I'm learning something, not sure what it is, but something.

 

Can I ask what you mean by:

 

i edited the nut.plg to point to the file on dropbox and installed the plugin pulling the modified .txz

 

was it <!ENTITY gitURL you edited? or is it something different you changed in nut.plg to point to the modified .txz?

 

i left the entity section alone as the other packages rely on those links, i only changed this section

 

<!--
The 'nut-package' file.
-->
<FILE Name="&plgPATH;/nut-2.7.4.20200318-x86_64-1.txz" Min="6.8" Run="upgradepkg --install-new">
<URL>http://dl.dropboxusercontent.com/s/uw90m96dp6altt0/nut-2.7.4.20200318-x86_64-1.txz</URL>
</FILE>

 

you can try that url, no idea how dropbox works for things like this, ill leave it on my dropbox in case it works. Otherwise substitute that url for whatever you like.

 

Ive been playing around with this plg file to see if i can get nut 2.8.0 to work on the RC unraid update, it will download and install, but get permission denied errors on the upsd/upsc/upsmon etc files and related folders.

 

I can change the permissions and it will sort of work but a reboot reverts the changes i make. Anyone smarter than me? I dont know why i'm punishing myself when it works now...

Link to comment
10 hours ago, k1netic said:

I dont know why i'm punishing myself when it works now...

One of the great mysteries of life I guess, your work has helped me at least.

 

Meanwhile I'm giving up. The dropbox plugin (either from my own or the one you put above) method hasn't seemed to help any, still can't get it to safe shutdown so I figure I'll set it to run for 30 minutes before it tries to shut down, battery will die well before that but if it's going to do it unsafely either way then may as well try to get it to ride out any outage as long as it can. At least I got monitoring going. Hopefully someone can get a 2.8.0 plugin (or docker maybe?) up and running for unraid.

Link to comment
18 hours ago, k1netic said:

Have you tried 

 

override.ups.delay.shutdown = time

 

in ups.conf ?

 

offdelay might not be cutting it

 

I had not. I had tried ups.delay.shutdown (or at least some variant I found in the nut documents) and nut wouldn't even start. Looks like override made the world of difference. I now have safe shutdown of unraid. Thanks. I haven't tried to see if the ups turns off and on again like it should but that is a future problem.

Link to comment
On 9/2/2022 at 8:34 PM, k1netic said:

Ive been playing around with this plg file to see if i can get nut 2.8.0 to work on the RC unraid update, it will download and install, but get permission denied errors on the upsd/upsc/upsmon etc files and related folders.

 

I have 2.8.0 running on unraid 6.10.3.  I am using an APC SMT1000RM2U with a AP9630 network management card.  It uses the snmp-ups driver and it was failing with this error:

 

/usr/libexec/nut/snmp-ups: error while loading shared libraries: libnetsnmp.so.35: cannot open shared object file: No such file or directory
Driver failed to start (exit status=127)

 

This post suggested installing net-snmp v5.8, but the file no longer exists.  Instead I decided to try to get nut 2.8.0 to run.  I downloaded these package files to the directory /pkg on the flash drive:

 

https://ftp.sotirov-bg.net/pub/contrib/slackware/packages/slackware64-15.0/nut-2.8.0-x86_64-1gds.txz

https://slackware.uk/slackware/slackware64-15.0/patches/packages/net-snmp-5.9.3-x86_64-1_slack15.0.txz

 

Then added commands to the go script to install the packages and modify the NUT plugin to work with them:

 

# Stop nut plugin
/usr/local/emhttp/plugins/nut/scripts/stop

# Install upgraded nut and net-snmp packages
installpkg /boot/pkg/net-snmp-5.9.3-x86_64-1_slack15.0.txz
installpkg /boot/pkg/nut-2.8.0-x86_64-1gds.txz

# Link nut config to NUT plugin config
rm -rf /etc/ups
ln -s /etc/nut /etc/ups

# Modify the NUT plugin to look for upsmon.pid in new location
sed -i 's@/var/run/nut/upsmon.pid@/var/run/upsmon.pid@' /usr/local/emhttp/plugins/nut/NUTsettings.page
sed -i 's@/var/run/nut/upsmon.pid@/var/run/upsmon.pid@' /usr/local/emhttp/plugins/nut/include/nut_config.php
sed -i 's@/var/run/nut/upsmon.pid@/var/run/upsmon.pid@' /usr/local/emhttp/plugins/nut/include/nut_footer.php
sed -i 's@/var/run/nut/upsmon.pid@/var/run/upsmon.pid@' /usr/local/emhttp/plugins/nut/include/nut_status.php

# Start nut plugin
/usr/local/emhttp/plugins/nut/scripts/start

 

Nut 2.8.0 appears to be working with these changes.

 

EDIT 2023-03-26: This post was originally written for dmacias's version 2023.02.14.  It also works for SimonF's version 2023.02.14.  SimonF suggested using the SNMP plugin to install net-snmp but I have not tried it.

Edited by cassiusdrow
Link to comment
On 9/5/2022 at 8:37 AM, cantanga said:

 

I had not. I had tried ups.delay.shutdown (or at least some variant I found in the nut documents) and nut wouldn't even start. Looks like override made the world of difference. I now have safe shutdown of unraid. Thanks. I haven't tried to see if the ups turns off and on again like it should but that is a future problem.

To test that safely, plug the server directly to the wall, leave the UPS connected by USB, and in terminal issue the command

 

upsdrvctl shutdown

 

See if the UPS turns off after the time you specified in the override.ups.delay.shutdown

If it doesn't or it gives an error try 

 

upsdrvctl -u root shutdown

 

If that works you need to add

 

user = root

 

to the global settings of ups.conf which is above the area [upsname] where your ups specific settings are.

 

On 9/5/2022 at 2:15 PM, cassiusdrow said:

Nut 2.8.0 appears to be working with these changes.

 

Well, thats all super helpful. I havent come across the sed command before, but if those edits work it may be possible to make the changes in the plugin.txz itself. Something to play with anyway.

  • Thanks 1
Link to comment
  • 2 weeks later...

This is my first question post. If there is anything rude or awkward, I think it's because I'm not from an English-speaking world, so please forgive me.

 

I searched for "synology unraid nut", "unraid ups slave", etc, but couldn't find a way.

 

Is there a way to set Synology as a UPS server and Unraid as a slave to make it work properly?

 

Unraid IP address: 192.168.111.10

Synology IP address: 192.168.111.13

 

In addition, Synology and the UPS are connected via USB, and the Windows PC is working fine with WinNUT.

 

1875993123_2022-09-204_35_17.thumb.png.756e7467d576bbda45204642d4a72de6.png

스크린샷 2022-09-20 오후 4.39.47.png

Edited by Donald-K
Link to comment

I now consider this superseded by work from SimonFair. Please install his version here: https://raw.githubusercontent.com/SimonFair/NUT-unRAID/master/plugin/nut-2.8.0.plg

 

Hi All. I've forked this plugin and web searched my way through getting NUT 2.8.0 and net-snmp 5.9.3 working.

 

I AM NOT A DEVELOPER. USE THIS AT YOUR OWN RISK. I don't even know how to use Git efficiently.

 

https://github.com/autumnwalker/NUT-unRAID

 

If you want to install this - open Unraid, navigate to Plugins, click the "install plugin" tab and paste the following URL into the URL field (next to "install") button, then click "install".

 

https://raw.githubusercontent.com/autumnwalker/NUT-unRAID/master/plugin/nut.plg

 

If this works for you then I'm glad. If it doesn't work I probably cannot help you. It took me all day to get this working based on what I was reading in the thread here and cobbling things through google-fu.

 

If anyone wants to take this and "make it right" or validate what I have done please feel free to provide feedback. I'm sure there are better or more efficient ways to do what I've done with the code.

Edited by autumnwalker
  • Thanks 2
Link to comment
  • 2 weeks later...
On 9/27/2022 at 9:10 PM, autumnwalker said:

Hi All. I've forked this plugin and web searched my way through getting NUT 2.8.0 and net-snmp 5.9.3 working.

 

I AM NOT A DEVELOPER. USE THIS AT YOUR OWN RISK. I don't even know how to use Git efficiently.

 

https://github.com/autumnwalker/NUT-unRAID

 

If you want to install this - open Unraid, navigate to Plugins, click the "install plugin" tab and paste the following URL into the URL field (next to "install") button, then click "install".

 

https://raw.githubusercontent.com/autumnwalker/NUT-unRAID/master/plugin/nut.plg

 

If this works for you then I'm glad. If it doesn't work I probably cannot help you. It took me all day to get this working based on what I was reading in the thread here and cobbling things through google-fu.

 

If anyone wants to take this and "make it right" or validate what I have done please feel free to provide feedback. I'm sure there are better or more efficient ways to do what I've done with the code.


I tried this just for the heck of it, and it broke the NUT plugin to the point I had to uninstall both your plugin and @dmacias original plugin, then reinstall the "old og plugin" to get it working again.

Anyway, I've got an annoying problem. 
Sometimes, only sometimes, when I reboot my server, the NUT plugin freaks the f-out and thinks the ups is on battery with 0% left, and instantly orders a safe shutdown of the system. 
This has been ongoing since day one, but it happens so scarcely, that it's more of an annoyance then a problem.

If anyone has a any idea on how to fix it, I'll happily try it! 

Link to comment
On 10/8/2022 at 10:35 AM, BeardElk said:


I tried this just for the heck of it, and it broke the NUT plugin to the point I had to uninstall both your plugin and @dmacias original plugin, then reinstall the "old og plugin" to get it working again.

You probably should remove the @dmacias plugin before installing my version of it. I'm sure there will be wild conflicts otherwise.

Link to comment
  • 3 weeks later...

Hello,

I am using NUT with 6.11.1 however I do not experience any issues with configuration as you mentioned.

 

But what I see (I do not know how it worked before)... There is no realtime update of UPS status in Unraid dashboard. Whole page has to be refreshed to see latest percentage of battery / status. Is this standard behavior?

 

I started to use this plugin only 1 day ago so it is hard for me to judge if it is normal or not.

Edited by ELP1
Link to comment
On 10/30/2022 at 3:34 AM, ELP1 said:

Hello,

I am using NUT with 6.11.1 however I do not experience any issues with configuration as you mentioned.

 

But what I see (I do not know how it worked before)... There is no realtime update of UPS status in Unraid dashboard. Whole page has to be refreshed to see latest percentage of battery / status. Is this standard behavior?

 

I started to use this plugin only 1 day ago so it is hard for me to judge if it is normal or not.

 

I also see the static display on the dashboard that will only update when the page is refreshed.

Have you made any changes to the config files in your NUT setup? The unraid NUT settings page retains the settings. It is the NUT config files that get defaulted. 

Link to comment
  • 2 weeks later...
On 11/2/2022 at 11:08 PM, JudasD said:

 

I also see the static display on the dashboard that will only update when the page is refreshed.

Have you made any changes to the config files in your NUT setup? The unraid NUT settings page retains the settings. It is the NUT config files that get defaulted. 

No, I have not made any changes, just installed.
 

Link to comment
  • 3 weeks later...
On 12/3/2022 at 8:15 PM, cassiusdrow said:

The "netclient" machines must use the IP address of the "netserver" machine, not 127.0.0.1.

Yeah but if I input the correct address it cant connect, bc the netserver is setup with 127.0.0.1 and is greyed out so I cant change it. 

 

Edit:
Got it working! 
Followed this and pieced it together! 

Edited by BeardElk
Link to comment

Hello everyone, I use to use a remote unraid nas server only when I need, and not 24/7. That nas is under a tecnoware ups and I use NUT. I don't want electric energy consumption when the unraid server is off, but (obvsiously) the ups take some energy to charge batteries.
Is there a way to shutdown the ups via command line, as occurs in case of low battery? So then I can put off the smart plug at which ups is connected.

Link to comment
6 hours ago, bigsub said:

Hello everyone, I use to use a remote unraid nas server only when I need, and not 24/7. That nas is under a tecnoware ups and I use NUT. I don't want electric energy consumption when the unraid server is off, but (obvsiously) the ups take some energy to charge batteries.
Is there a way to shutdown the ups via command line, as occurs in case of low battery? So then I can put off the smart plug at which ups is connected.

 

In this page, the author uses this command to trigger a UPS shutdown in the section "Testing with actual results":

 

upsmon -c fsd

 

It appears to activate the actual shutdown process that nut will use during a real low power event.

  • Thanks 1
Link to comment
  • 2 weeks later...

Powerwalker VI 1000 RT doesnt works

 

According to the compatibility list, blazer_usb should be used. Then there is no data / connection at all. If I go to autodetect (unraid server), comes usbhid_ups and also data. However, I get a rhythm every 5 minutes that the UPS has failed. If I switch off the power, the message only comes up after 5 minutes.

Link to comment
  • Rysz featured this topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.