dmacias

[Plugin] NUT v2 - Network UPS Tools

Recommended Posts

NUT plugin v2 for unRAID 6.1+

 

NUT - Network UPS Tools - http://www.networkupstools.org/

 

Based on the original NUT plugin by macester

Original thread

https://forums.lime-technology.com/topic/40690-plug-in-nut-network-ups-tools/

 

Features

- Start on boot

- All NUT usb drivers selectable (can set custom driver)

- Shutdown on (Battery Level, Battery Runtime, Timer)

- Turn off ups (needed for auto-poweron)

- Settings in webGui

- Stats in webGui

- Notifications to webGui and email

 

1. Copy the plugin url:

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

2. Paste url into install plugin text input and click install

 

To disable the built in UPS try settiing it to:

Start APC UPS daemon: No

UPS cable: Custom

UPS type: Dumb

 

Change Log

###2017.11.29
- fix permissions so nut conf are not world readable
- fix nut-scanner options, only scan usb for auto config
###2017.11.26
- fix plugin install service starting when disabled

###2017.11.25
- fix snmp port input box length and add ip mask

###2017.11.03
- update killpower flag
- update permissions and security for nut configs
- change username and password variables
- add slave user and password

###2017.10.28
- downgrade nut package to 2.7.4 due to usb resets in 6.4rc10b
###2017.10.10
- fix ipaddr filter
- update input masks for ipaddr, name and username

###2017.10.08a
- fix move old pids to new location
- compile nut package to latest commit 2017.09.21
- fix: new nut package uses /etc/nut and /var/run/nut
###2017.10.05
- fix add username and password to upsd users
- add autorefresh to editor to fix line number placement
- move cdnjs to local
- update support for new themes

###2017.09.17
- add ability to change UPS Monitor Name, User and Password
###2017.06.17a
- add support for 6.4 themes
###2017.06.04
- add net-snmp package
###2017.05.27
- add autodetection for UPS
- fix ip mask
###2017.05.26
- add master/slave options
- fix runtime display format
###2017.05.24
- add dropdown options for battery and timers
- add killpower flag condition to shutdown script
###2017.05.22
- fix shutdown scripts
- move default nut conf files
###2017.05.20
- fix manual config  settings
###2017.05.19
- fix reload button
- add start conditions to rc script
###2017.05.17
- add manual mode, reload and config editor to settings page
- reformat settings page, hide unused vars
- add vars, rewrite, combine and move scripts
- add snmp settings from Ambrotos fork - untested
- add UPS summary, UPS details page and dashboard page
- add dynamix plugin api
- remove depreciated code
- restructure and repackage plugin
- rename nut plugin package to difer from nut package

###2015.09.19###
- UPS statistics now auto updates(every two seconds)

###2015.08.24###
- added launch from plugins(saarg)

###2015.08.23###
- added blazer_ser to drivers

###2015.08.23###
- Public Release
- Fix, Restart on upgrades

###2015.08.22###
- Uninstall fixes
- Fix autorestart after upgrade
- Make USB drivers selectable
- Add shutdown on battery levels
- Remove user/password and hardcode them (see plugin help)
- Moved scripts to plugin folder for 6.1 (ln -s rc.nut)

###2015.08.21###
- Initial Release
- Test Version (plg)

Edited by dmacias
  • Like 1
  • Upvote 2

Share this post


Link to post
Share on other sites

Thanks for the modify / update, it is a good news for QNAP/Synology NAS user to share the UPS.

Share this post


Link to post
Share on other sites

Thanks for continuing to maintain this plugin!

 

Just FYI -- I updated and the NUT service never started back up. I had to manually toggle the NUT service off then back on within the plugin settings. Now it appears to be working as expected.

Share this post


Link to post
Share on other sites

deleted the old Plugin and installed new.

now its not working.

have old UPS. the driver I used before is upbhid-ups

no IPs, no user names .

it just worked.

 

 

 

Scanning for UPS...

Scanning USB bus.
Scanning NUT bus (avahi method).
[nutdev1]
driver = "usbhid-ups"
port = "auto"
vendorid = "0D9F"
productid = "0001"
bus = "002"

 

so now what ?

Edited by dadarara

Share this post


Link to post
Share on other sites

 

 

 

deleted the old Plugin and installed new.

now its not working.

have old UPS. the driver I used before is upbhid-ups

no IPs, no user names .

it just worked.

 

 

 

Scanning for UPS...

Scanning USB bus.
Scanning NUT bus (avahi method).
[nutdev1]
driver = "usbhid-ups"
port = "auto"
vendorid = "0D9F"
productid = "0001"
bus = "002"

 

so now what ?

 

Did you try leaving the name as ups and ip as localhost then username monuser and password monpass?

 

Edit. Do you have your previous conf files?

 

 

Share this post


Link to post
Share on other sites

all left as is.

no, dont have conf file.

also tried to make manual config. also didnt work

what should I do with the config editor?

I chose ups.conf  while starting up the plugin.  not clear how it should work really 

in the log I have:  see the change after I chose the manual config. no diff...

BTW, it sounds strange that it tries to address the localhost as this UPS is not connected to network. only USB.

 

ErrorWarningSystemArrayLogin


Sep 21 13:28:15 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:20 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:25 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:30 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:35 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:40 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:45 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:50 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:28:55 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:00 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:05 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:10 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:15 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:20 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:25 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:30 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:35 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:40 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:45 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:50 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:29:55 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:00 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:05 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:10 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:15 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:19 Tower php: /usr/local/emhttp/plugins/nut/scripts/stop
Sep 21 13:30:20 Tower upsmon[21015]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:30:21 Tower upsmon[21015]: Signal 15: exiting
Sep 21 13:30:21 Tower upsmon[21014]: upsmon parent: read
Sep 21 13:30:23 Tower usbhid-ups[20999]: Signal 15: exiting
Sep 21 13:37:09 Tower php: /usr/local/emhttp/plugins/nut/scripts/start
Sep 21 13:37:14 Tower usbhid-ups[11551]: Startup successful
Sep 21 13:37:15 Tower upsmon[11570]: Startup successful
Sep 21 13:37:15 Tower upsmon[11571]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:37:15 Tower upsmon[11571]: Communications with UPS ups@localhost lost
Sep 21 13:37:20 Tower upsmon[11571]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:37:20 Tower upsmon[11571]: UPS ups@localhost is unavailable
Sep 21 13:37:25 Tower upsmon[11571]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:37:30 Tower upsmon[11571]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused
Sep 21 13:37:35 Tower upsmon[11571]: UPS [ups@localhost]: connect failed: Connection failure: Connection refused

 

 

 

 

 

2017-09-21_23-31-57-resized.jpg

Edited by dadarara

Share this post


Link to post
Share on other sites

The localhost is for the monitor. As a slave you would enter an ip. What do your ups.conf and upson.conf have in then? Also with the Start Network UPS Service set to yes. Try running /etc/rc.d/rc.nut stop Then run /etc/rc.d/rc.nut start. See if there's any errors. You also might try uninstalling the plugin and renaming or deleting the config/plugins/nut directory on the flash drive

Share this post


Link to post
Share on other sites
Quote

 

- Turn off ups (needed for auto-poweron)

 

Does it mean that if the system is powered off, the ups goes out of power and shuts down, upon the power being restored the computer will not power on? Or is that nothing will power on the computer if power gets restored during the interval of the UPS being still up and the computer being off already?

Share this post


Link to post
Share on other sites

It means that the ups will shutdown after the computer and then power on again when power is restored triggering the computer to boot (if boot options on the computer are configured for this).

 

If the ups never shuts down then the computer will not detect that power has been restored, so no boot up.

Share this post


Link to post
Share on other sites

Hi Guys,

 

I've got a Cyberpower PR750ELCD UPS which is plugged into my unraid server by USB cable. NUT V2.0 recognises it using the USBHID-UPS mode and displays the status etc correctly. It will function like this correctly, until a few hours later

 

Oct 4 16:21:21 EntityLite upsd[3807]: Can't connect to UPS [ups] (usbhid-ups-ups): No such file or directory
Oct 4 16:21:22 EntityLite upsmon[3811]: Poll UPS [ups@localhost] failed - Driver not connected

 

And then the log fills with the last line until I hit 'reload' on the NUT UPS plugin page and then it reconnects just fine.

 

I've tried swapping USB ports 2.0 and 3.0 I havn't tried a different cable. Any other suggestions?

 

 

Cheers

Share this post


Link to post
Share on other sites
Posted (edited)

When using nut how we disable the internal UPS function of unraid ?  It's turned off but I get spam of Communications with UPS lost messages in log file. NUT communicates just fine.

 

- UPS settings in unraid UPS Status Lost communication   , Start APC UPS daemon: NO

- NUT settings UPS status online

 

Edited by etsi

Share this post


Link to post
Share on other sites
When using nut how we disable the internal UPS function of unraid ?  It's turned off but I get spam of Communications with UPS lost messages in log file. NUT communicates just fine.
 
- UPS settings in unraid UPS Status Lost communication   , Start APC UPS daemon: NO
- NUT settings UPS status online
 
I have Start APC UPS Daemon set to no, UPS cable set to custom, Custom UPS Cable set blank and UPS Type set to dumb. You might try starting and stopping APC UPS too.

Share this post


Link to post
Share on other sites

 

 

 

Hi Guys,

 

Oct 4 16:21:21 EntityLite upsd[3807]: Can't connect to UPS [ups] (usbhid-ups-ups): No such file or directory

The usbhid-ups-ups part doesn't look right. I would check your /boot/config/plugins/nut/ups/ups.conf.

 

You also might try uninstalling the plugin, renaming/deleting the /boot/config/plugins/nut directory and then reinstalling the plugin and trying Autodetect.

 

Edit. I believe the usbhid-ups-ups is ok. I'll look through things a bit more.

Share this post


Link to post
Share on other sites
1 hour ago, dmacias said:
2 hours ago, etsi said:
When using nut how we disable the internal UPS function of unraid ?  It's turned off but I get spam of Communications with UPS lost messages in log file. NUT communicates just fine.
 
- UPS settings in unraid UPS Status Lost communication   , Start APC UPS daemon: NO
- NUT settings UPS status online
 

I have Start APC UPS Daemon set to no, UPS cable set to custom, Custom UPS Cable set blank and UPS Type set to dumb. You might try starting and stopping APC UPS too.

 

Thanks! Using the above settings it worked (apcupsd[31937]: apcupsd shutdown succeeded).

 

Share this post


Link to post
Share on other sites
Posted (edited)

Just Updated to day to your latest 2017.10.08 update and my NUT refused to show up. NUT Settings screen completely blank.

So i manually removed my NUT plugin from my flash and reinstalled. Got the settings page back but now I can't get to run.

The setting screen show the plugin as running even though the setting is off. Tried with different user and password and I have tried running /etc/rc.d/rc.nut stop and then start. it seemed to work but didn't. I have screen shots to try and explain and I have got diagnostics if you need them. the only thing I haven't tried is restarting my server. My UPS is a MGE Nova 1100 AVR and it has worked up until know, and it also gets found when going through auto detect.

 

any help would be greatly appreciated

Screen Shot 2017-10-09 at 09.08.51.png

Screen Shot 2017-10-09 at 09.09.27.png

Screen Shot 2017-10-09 at 09.11.36.png

Screen Shot 2017-10-09 at 09.12.30.png

Edited by BillClinton
update info

Share this post


Link to post
Share on other sites

Try running from the command line

ps aux | grep ups

 

If something is still running run e.g. killall upsmon

 

There's some differences between the nut packages. I think I need to add some more checks to stop the previous version.

  • Like 2

Share this post


Link to post
Share on other sites

Will try soon. AFK for about the next hour. Thanks for the quick reply.


Sent from my iPhone using Tapatalk

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, BillClinton said:

Will try soon. AFK for about the next hour. Thanks for the quick reply.


Sent from my iPhone using Tapatalk

Ok Im getting the same when I upgrade from previous to latest now. I'll fix shortly

 

Edit: It's fixed now. It will copy all the old pids to the new /var/run/nut location.

Edited by dmacias
  • Like 1

Share this post


Link to post
Share on other sites
latest update got it working.
 
thanks so much.
No problem.

Share this post


Link to post
Share on other sites

Hi,

 

I iust updated to last version, but I had to first stop and manually kill the remaining 'upsmon' processes to get it working again.

 

Regards,

 

Share this post


Link to post
Share on other sites

Which latest and what wasn't working? 2017.10.8a should have fixed that problem. The rc.nut script will now killall upsd and upsmon processes if not gracefully shut down. But it should have been fixed by moving the pids to /var/run/nut.

Share this post


Link to post
Share on other sites

Hi,

 

I had the problem after updating to 2017.10.08 I guess I missed the update check for 2017.10.8a.

I just updated to 2017.10.09 which seems to work.  But the update plugin was missing the 'done' button.

Share this post


Link to post
Share on other sites

Ok thanks for the update. I have never figured the missing Done button. It happens on a few of my plugins that start and stop the plugin's services. But the missing button only happens if the service is enabled and started. It's like a process hangs but if you click the X everything has competed. So I don't know.

I have tried setid /etc/rc.d.rc.script &. It works for my ipmi plugin but not for nut.

Share this post


Link to post
Share on other sites



I have never figured the missing Done button.
AFAIK it happens if the install script exists or finished while it's running a php script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Copyright © 2005-2017 Lime Technology, Inc. unRAID® is a registered trademark of Lime Technology, Inc.