[Plugin] NUT v2 - Network UPS Tools


dmacias

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

###2020.03.17

- gfjardim added footer and dashboard plus many other tweaks

###2019.02.03

- update all icons to fa icons

- fix editor font in black theme

###2019.01.24

- update settings icon to fa font

###2018.11.25

- add autov to css and js

- build nut package from usblib-1.0 branch

- remove support link from readme

###2018.05.09

- fix Autodetect

- fix null port error

###2018.04.29

- fix rc script interfering with cupsd

- fix Run time in red only when on battery thanks@realies

- compile nut-2.7.4.20180429 libusb 1.0+0.1 branch for 6.5 added patch for wait and retry

###2018.01.16

- tweak notification event and subject

###2018.01.14

- fix nut power showing 0

###2018.01.09

- update nut package to 2.7.4 2017.11.29 commit fd7189d

- revert Eaton use-case since it is included in nut package

- add ups va and watt capacity inputs for ups that do not present real power nominal

###2018.01.06

- add Eaton use-case to improve load accuracy thanks@realies

###2018.01.03

- fix load for ups with ups.power.nominal vs ups.realpower.nominal

###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 5
  • Upvote 2
Link to comment

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
Link to comment

 

 

 

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?

 

 

Link to comment

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
Link to comment

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

Link to comment
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?

Link to comment
  • 2 weeks later...

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

Link to comment

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
Link to comment
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.
Link to comment

 

 

 

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.

Link to comment
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).

 

Link to comment

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
Link to comment
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
Link to comment

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.

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.