NUT configuration (understanding and replicating)

Hi Folks
This isnt a strictly nethserver question but im coming to you because you seem to have made NUT work for network connection to my APC Smart-UPS 1500 ([NS6.8] NUT and APC Network Management Card). I have configured a nethserver to conect to the UPS via TCP and it appears to know all about the unit (on the dashboard tab) so Im assuming success.

My objective is to (supercede) have an identical capability for my Proxmox server and Ive struggled to repeat the install in this environment. Having managed to get nut on Nethserver working (which is a VM guest on the proxmox host) , I have decided to try and use the “working config” from Nethserver as follows (this is everything from the /etc/ups directory - if i have missed anything please let me know!). All of this config has been copied over to an Ubuntu 18 guest which i am using to test (rather than screw around with the proxmox host until I have a better understanding!):

[root@nethserver ups]# cat nut.conf|grep -v “#”
MODE=netserver

[root@nethserver ups]# cat ups.conf|grep -v “#”
pollinterval = 10
[UPS]
driver = snmp-ups
port = 192.168.14.220

[root@nethserver ups]# cat upsd.conf|grep -v “#”
LISTEN 0.0.0.0

[root@nethserver ups]# cat upsd.users|grep -v “#”
[upsmon]
password = <password of “apc” user UPS>
upsmon master

[root@nethserver ups]# cat upsmon.conf|grep -v “#”
MINSUPPLIES 1
SHUTDOWNCMD “/sbin/shutdown -h +0”
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
MONITOR UPS@127.0.0.1 1 upsmon apc master

[root@nethserver ups]# cat upssched.conf|grep -v “#”
CMDSCRIPT /usr/bin/upssched-cmd

Initial analysis as follws:
NETHSERVER GUEST (working)

[root@nethserver ups]# systemctl -l status nut-driver
● nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/usr/lib/systemd/system/nut-driver.service; static; vendor preset: disabled)
Active: active (running) since Sat 2020-01-11 13:07:26 GMT; 22h ago
Main PID: 30221 (snmp-ups)
Tasks: 1
CGroup: /system.slice/nut-driver.service
└─30221 /usr/sbin/snmp-ups -a UPS

Jan 11 13:07:25 nethserver systemd[1]: Starting Network UPS Tools - power device driver controller…
Jan 11 13:07:25 nethserver upsdrvctl[30112]: No matching MIB found for sysOID ‘.1.3.6.1.4.1.318.1.3.27’!
Jan 11 13:07:25 nethserver upsdrvctl[30112]: Please report it to NUT developers, with an ‘upsc’ output for your device.
Jan 11 13:07:25 nethserver upsdrvctl[30112]: Going back to the classic MIB detection method.
Jan 11 13:07:25 nethserver upsdrvctl[30112]: Detected Smart-UPS 1500 on host (mib: apcc 1.2)
Jan 11 13:07:25 nethserver upsdrvctl[30112]: [UPS] Warning: excessive poll failures, limiting error reporting (OID = .1.3.6.1.4.1.318.1.1.1.9.2.3.1.5.1.1.3)
Jan 11 13:07:26 nethserver upsdrvctl[30112]: [UPS] Warning: excessive poll failures, limiting error reporting (OID = .1.3.6.1.4.1.318.1.1.1.9.3.3.1.6.1.1.1)
Jan 11 13:07:26 nethserver snmp-ups[30221]: Startup successful
Jan 11 13:07:26 nethserver upsdrvctl[30112]: Network UPS Tools - UPS driver controller 2.7.4
Jan 11 13:07:26 nethserver systemd[1]: Started Network UPS Tools - power device driver controller.
[root@nethserver ups]#

UBUNTU GUEST
(not working!)
me@ubuntu:~$ systemctl -l status nut-driver
● nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/lib/systemd/system/nut-driver.service; static; vendor preset
Active: failed (Result: exit-code) since Sun 2020-01-12 00:15:11 UTC; 11h ago
Process: 1065 ExecStart=/sbin/upsdrvctl start (code=exited, status=1/FAILURE)

Jan 12 00:15:11 ubuntu systemd[1]: Starting Network UPS Tools - power device dr
Jan 12 00:15:11 ubuntu upsdrvctl[1065]: Can’t start /lib/nut/snmp-ups: No such
Jan 12 00:15:11 ubuntu upsdrvctl[1065]: Network UPS Tools - UPS driver controll
Jan 12 00:15:11 ubuntu systemd[1]: nut-driver.service: Control process exited,
Jan 12 00:15:11 ubuntu systemd[1]: nut-driver.service: Failed with result 'exit
Jan 12 00:15:11 ubuntu systemd[1]: Failed to start Network UPS Tools - power de
lines 1-11/11 (END)

At first inspection it looks like there is a driver issue - any insight into what additional config is required to replicate the amazing nethserver functionality is appreciated! I notice the instruction i referenced stated using the USB driver - is this the default whereby the system searches for the best driver?.. any assistance appreciated on this confusing topic!
Cheers
ALex

one thing just occured to me that the ubuntu guest probably didnt have snmp running and the driver being “snmp-usb” was a bit of a clue that this service is probably required… ive installed it - apt-get install snmpd - and rebooted the system but still getting the “Can’t start /lib/nut/snmp-ups” message… more work to do i figure!

have you installed nut-snmp package on Ubuntu?

im pretty sure i havent - i will do that right away though Marc!

thank you Marc - that works - always good to have something that works as a starting point on the learning journey

me@ubuntu:~$ systemctl -l status nut-driver
● nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/lib/systemd/system/nut-driver.service; static; vendor preset
Active: active (running) since Sun 2020-01-12 13:12:11 UTC; 1min 1s ago
Process: 1112 ExecStart=/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)
Main PID: 1457 (snmp-ups)
Tasks: 1 (limit: 4647)
CGroup: /system.slice/nut-driver.service
└─1457 /lib/nut/snmp-ups -a UPS

Jan 12 13:12:09 ubuntu systemd[1]: Starting Network UPS Tools - power device dr
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: No matching MIB found for sysOID '.1.3.
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: Please report it to NUT developers, wit
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: Going back to the classic MIB detection
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: Detected Smart-UPS 1500 on host 192.168
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: [UPS] Warning: excessive poll failures,
Jan 12 13:12:10 ubuntu upsdrvctl[1112]: [UPS] Warning: excessive poll failures,
Jan 12 13:12:11 ubuntu snmp-ups[1457]: Startup successful
Jan 12 13:12:11 ubuntu upsdrvctl[1112]: Network UPS Tools - UPS driver controll
Jan 12 13:12:11 ubuntu systemd[1]: Started Network UPS Tools - power device dri
lines 1-19/19 (END)

a final question please - when the nethserver connects to the APC UPS unit (assume out of the box config) is it being requested for a password or is this an open (readonly) connection… in which case the password i am creating in the nut config is for other nut clients/slaves to connect to the server. Im just trying to get my head round the highlevel architecture in play here because for instance the upsmon is configured to listen to the local host and not the UPS IP (this caused me issues when trying to configure nut before hacking the nethserver config)

We are really doing the same for each PVE we install for each of our customers; we install NUT directly on the hypervisor, and added a script to shutdown the host in case of missing power for a prolonged period of time. You have to configure NUT by hand, but in the end it shouldn’t be that difficult.

Yes, correct. Your case is definitely much more “lucky”, since you have an APC Network Card which can speak with any number of hosts. Think instead the case in which your UPS can be connected only via USB: you cannot have multiple hosts receiving UPS notifications, but only a single host receives UPS notifications. NUT can work as a “server” and then provide notifications also to other systems in the same network, so you may poweroff any system (which supports NUT, of course; even ESXi IIRC have a vib supporting that) that are served by the UPS.

thanks for feedback Emiliano - would you be willing to share your nut configs and shell scripts from a generic pve - this would save me a load of legwork… thanks in advance, Alex

Hi
I could provide you with some standardized configs for NUT for Proxmox and others.
I use for most of my clients Proxmox as a basis, and Nethserver running inside Proxmox.
I have one client running the NUT Server on Proxmox, all others use a Raspberry PI as NUT Server, the idea being allowing a quick replacement of Proxmox HW in case of problems. The Proxmox are mostly all in Cluster-Config for HA and Failover purposes.
Raspberry and Proxmox are both Debian based, so the same configs and commands work…
I also use Zabbix Monitoring on the NethServer, and NUT is monitored using SNMP (Expanded SNMP).
Andy

thanks Andy
I would be very greatful for anything you can share… ive just installed snmpd and nut-snmp on proxmox server and used the config from nethserver … its done something but its not working yet so ive failed on the quick dirty attempt! (it worked from an ubuntu server so there must be something proxmox in the way!)
thanks in advance for any asistance, cheers, alex

root@pve11:/etc/nut# systemctl -l status nut-driver
● nut-driver.service - Network UPS Tools - power device driver controller
Loaded: loaded (/lib/systemd/system/nut-driver.service; static; vendor preset: enabled)
Active: failed (Result: timeout) since Thu 2020-01-16 00:07:18 GMT; 4min 12s ago
Process: 1429 ExecStart=/sbin/upsdrvctl start (code=killed, signal=TERM)
Tasks: 0 (limit: 9830)
Memory: 2.6M
CPU: 55ms
CGroup: /system.slice/nut-driver.service

Jan 16 00:06:53 pve11 upsdrvctl[1429]: Cannot adopt OID in UCD-SNMP-MIB: laNames ::= { laEntry 2 }
Jan 16 00:06:53 pve11 upsdrvctl[1429]: Cannot adopt OID in UCD-SNMP-MIB: laIndex ::= { laEntry 1 }
Jan 16 00:07:18 pve11 systemd[1]: nut-driver.service: Start operation timed out. Terminating.
Jan 16 00:07:18 pve11 systemd[1]: Failed to start Network UPS Tools - power device driver controller.
Jan 16 00:07:18 pve11 systemd[1]: nut-driver.service: Unit entered failed state.
Jan 16 00:07:18 pve11 systemd[1]: nut-driver.service: Failed with result ‘timeout’.
Jan 16 00:08:07 pve11 upsdrvctl[1429]: No supported device detected
Jan 16 00:08:07 pve11 upsdrvctl[1429]: Network UPS Tools - Generic SNMP UPS driver 0.97 (2.7.4)
Jan 16 00:09:11 pve11 upsdrvctl[1429]: No supported device detected
Jan 16 00:09:11 pve11 upsdrvctl[1429]: Network UPS Tools - Generic SNMP UPS driver 0.97 (2.7.4)

Hi

These are the files I use for a Raspberry, they will work on a Proxmox 1:1.
Replace the existing files under /etc/nut and restart nut (client and server)

hosts.conf (Used for NUT-CGI):

MONITOR ups@localhost “Riello UPS”

nut.conf

MODE=netserver

ups.conf

maxretry = 3

[ups]
driver = riello_usb
port = auto
desc = “Riello UPS”

upsd.conf

LISTEN 127.0.0.1 3493
LISTEN 192.168.175.171 3493

(Use your IP!)

upsd.users

[admin]
password = YourPassword
actions = SET
instcmds = ALL

[upsmon_local]
password = secret
upsmon master
[upsmon_remote]
password = secret
upsmon slave

upsmon.conf

MONITOR ups@localhost 1 upsmon_local secret master

upsset.conf (Needed for NUT-CGI)

uncomment the last section as stated in the text…

Test the UPS with following command:
upsc ups@localhost

This should get you a working NUT server.
The precoded passwords will work out of the box for NethServer and Synology as NUT-Clients.
Synology uses NUT, but the user and password are hardcoded into the OS. So you need to adapt the nut server, like here.
You can add / modify users / passwords / hosts and ups as needed…

Reillo provides a good usb driver, they work well with open source…
Otherwise the standard USB driver will work well with most USBs…

These are my notes specifically for Proxmox:

————————————————————
NUT in Proxmox (As Server)
————————————————————

apt-get install nut-client nut-server usbutils

systemctl status nut-monitor.service

systemctl enable nut-monitor.service

systemctl start nut-monitor.service

nano /etc/nut/nut.conf
MODE=netserver

nano /etc/nut/upsmon.conf
MONITOR ups@192.168.175.62 1 monuser secret slave

systemctl enable nut-monitor.service

upsc ups@localhost

————————————————————

Note about security:
NUT Port should NEVER be accessible from outside the network, don’t open that port on the firewall!
If in a school or hotel like environment, the networks (subnets) for servers should be separated from users.

NUT-CGI can be installed on Proxmox, Raspberry or Nethserver. I prefer it on NethServer, as that server is usually accessible from the Internet, is secured and robust. As the NUT from NethServer connects to the Proxmox NUT, both have the data needed, so you can place NUT-CGI where you want (on whatserver is suitable)…

Hope this helps…

Andy

Andy thats really appreciated - ill take a look today and hopefully get things up and running!

And if you want the whole thing monitored, install Zabbix (See NethServer forum Post / Modules).

Thats part of a Screen specifically for Zabbix UPS, data retrieved with SNMP (Extended)…

Can supply those too, if you need / want them…

Andy

1 Like

Hi Andy thats an impressive output! Id definately be interested in Zabbix - i think I had a go at building a Zabbix VM a little while ago, at least im guessing i did because i have a VM called ZAB1 !.. i recall i never managed to get it to boot… probably a simple mistake but ill take any guidance on this subject because it looks very useful. Thanks again for any assistance, cheers, alex

Hi

MrMarkuz made a module for Nethserver, see here:

https://wiki.nethserver.org/doku.php?id=zabbix
and here:


(Scroll about to the the first third, that’s where it starts to get really interesting…)

Zabbix has a big repo of “modules” or Plug-Ins for monitoring, there are plenty there. I didn’t find one which worked the way I wanted, and wasn’t keen of having russian displays, so I made my own template to use NUT with SNMP-Extended monitoring.
This get’s interesting, especially if you have proxmox running, say on a HP Server with HW-RAID.
Proxmox doesn’t come with say LMSensors or HW-RAID monitoring (Provided by HP, Dell or whatever servers you’re running). LM Sensors will give you nice Temp Info. These info can be used to give you nice graphs, which can help solve problems…
Example: Air-Con defective? CPUs of all Servers and NAS gets warmer and warmer, without much more load…

Install Zabbix, get it up and running on NethServer, and I can provide help on monitoring your UPSes with Zabbix and SNMP.

Note:
The docu on the page at the part “NethServer Zabbix” is missing the repo in the install command, this would be correct:
yum --enablerepo=mrmarkuz install nethserver-zabbix
This command will not find the file:
yum -y install nethserver-zabbix…

Another Client with Proxmox, NethServer, Macs, X-Ray, Dicom-PACS and Zabbix!

See the end of this post for more infos about that network:
https://wiki.nethserver.org/doku.php?id=guacamole

Andy

1 Like

Hi Andy ive failed again with zabbix. 1) spun up an nethserver VM. 2) following instructions and ran yum -y install nethserver-zabbix seemingly successfully 3) tried to access the url https://newIP/zabbix

accessing that url fails - im working with a base build of nethserver so i dont know if there some dependencies that need installing also?

Hi

The install command you used did not work for me, as the Repo wasn’t found…

This would work:
yum --enablerepo=mrmarkuz install nethserver-zabbix

Did you follow the instructions from the NethServer modules page including the Repo?
The repo needs to be activated first.
Zabbix will install on a plain vanilla NethServer, http (Webserver) needs to be installed, also an account provider helps. Otherwise no other stuff should be nessarily…

Zabbix should show up under Apps in the standard Dashboard (Port 980) and can be opened from there, as well as using the direct link…

Note:
My last installation was just before the 7.7 upgrade to Nethserver. It works with NethServer 7.6.x, but I haven’t tested installing it on latest 7.7 yet. Maybe somethings broken. Installing a 7.6 NethServer and Zabbix works, and also works after upgrading to 7.7…

My 2 cents…

Andy

PS: Where are you located?
Myself, I’m in central Switzerland at the moment…

Hi Andy
Im located in UK - most winters i spend a good chunk of time in Switzerland (north east of lake Geneva in the mountains but seem to be snowed under with work instead this year!)

I meant to say that I ran the following

yum -y install https://mrmarkuz.goip.de/mirror/mrmarkuz/7/noarch/nethserver-mrmarkuz-0.0.1-3.ns7.noarch.rpm

Then you are able to install/update packages easily:

yum --enablerepo=mrmarkuz install

I just now additionally ran the following command also

yum -y install nethserver-zabbix

and it complained… At face value the zabbix install instructions looked very simple - i.e. just install mrmarkuz’s zabbix module… and for that reason i didnt go into the more lengthy method… im guessing that is required based on errors below??

[root@p10zab2 ~]# yum -y install nethserver-zabbix
Loaded plugins: changelog, fastestmirror, nethserver_events
Loading mirror speeds from cached hostfile

  • ce-base: mirror.sov.uk.goscomb.net
  • ce-extras: mirror.sov.uk.goscomb.net
  • ce-sclo-rh: mirror.sov.uk.goscomb.net
  • ce-sclo-sclo: mirror.sov.uk.goscomb.net
  • ce-updates: mirror.sov.uk.goscomb.net
  • epel: www.mirrorservice.org
  • nethforge: mirror.framassa.org
  • nethserver-base: mirror.framassa.org
  • nethserver-updates: mirror.framassa.org
    Resolving Dependencies
    –> Running transaction check
    —> Package nethserver-zabbix.noarch 0:0.0.1-6.ns7 will be installed
    –> Processing Dependency: zabbix-web-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-server-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-agent for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: php-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: nethserver-postgresql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: nethserver-net-snmp for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: net-snmp-utils for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Running transaction check
    —> Package net-snmp-utils.x86_64 1:5.7.2-43.el7 will be installed
    –> Processing Dependency: net-snmp-libs = 1:5.7.2-43.el7 for package: 1:net-snmp-utils-5.7.2-43.el7.x86_64
    –> Processing Dependency: libnetsnmp.so.31()(64bit) for package: 1:net-snmp-utils-5.7.2-43.el7.x86_64
    —> Package nethserver-net-snmp.noarch 0:1.1.0-1.ns7 will be installed
    –> Processing Dependency: net-snmp for package: nethserver-net-snmp-1.1.0-1.ns7.noarch
    —> Package nethserver-postgresql.noarch 0:1.1.0-1.ns7 will be installed
    –> Processing Dependency: postgresql-server for package: nethserver-postgresql-1.1.0-1.ns7.noarch
    —> Package nethserver-zabbix.noarch 0:0.0.1-6.ns7 will be installed
    –> Processing Dependency: zabbix-web-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-server-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-agent for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    —> Package php-pgsql.x86_64 0:5.4.16-46.1.el7_7 will be installed
    –> Processing Dependency: php-pdo(x86-64) = 5.4.16-46.1.el7_7 for package: php-pgsql-5.4.16-46.1.el7_7.x86_64
    –> Processing Dependency: libpq.so.5()(64bit) for package: php-pgsql-5.4.16-46.1.el7_7.x86_64
    –> Running transaction check
    —> Package net-snmp.x86_64 1:5.7.2-43.el7 will be installed
    –> Processing Dependency: net-snmp-agent-libs = 1:5.7.2-43.el7 for package: 1:net-snmp-5.7.2-43.el7.x86_64
    –> Processing Dependency: libsensors.so.4()(64bit) for package: 1:net-snmp-5.7.2-43.el7.x86_64
    –> Processing Dependency: libnetsnmptrapd.so.31()(64bit) for package: 1:net-snmp-5.7.2-43.el7.x86_64
    –> Processing Dependency: libnetsnmpmibs.so.31()(64bit) for package: 1:net-snmp-5.7.2-43.el7.x86_64
    –> Processing Dependency: libnetsnmpagent.so.31()(64bit) for package: 1:net-snmp-5.7.2-43.el7.x86_64
    —> Package net-snmp-libs.x86_64 1:5.7.2-43.el7 will be installed
    —> Package nethserver-zabbix.noarch 0:0.0.1-6.ns7 will be installed
    –> Processing Dependency: zabbix-web-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-server-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-agent for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    —> Package php-pdo.x86_64 0:5.4.16-46.1.el7_7 will be installed
    —> Package postgresql-libs.x86_64 0:9.2.24-1.el7_5 will be installed
    —> Package postgresql-server.x86_64 0:9.2.24-1.el7_5 will be installed
    –> Processing Dependency: postgresql(x86-64) = 9.2.24-1.el7_5 for package: postgresql-server-9.2.24-1.el7_5.x86_64
    –> Running transaction check
    —> Package lm_sensors-libs.x86_64 0:3.4.0-8.20160601gitf9185e5.el7 will be installed
    —> Package net-snmp-agent-libs.x86_64 1:5.7.2-43.el7 will be installed
    —> Package nethserver-zabbix.noarch 0:0.0.1-6.ns7 will be installed
    –> Processing Dependency: zabbix-web-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-server-pgsql for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    –> Processing Dependency: zabbix-agent for package: nethserver-zabbix-0.0.1-6.ns7.noarch
    —> Package postgresql.x86_64 0:9.2.24-1.el7_5 will be installed
    –> Finished Dependency Resolution
    Error: Package: nethserver-zabbix-0.0.1-6.ns7.noarch (mrmarkuz)
    Requires: zabbix-server-pgsql
    Error: Package: nethserver-zabbix-0.0.1-6.ns7.noarch (mrmarkuz)
    Requires: zabbix-web-pgsql
    Error: Package: nethserver-zabbix-0.0.1-6.ns7.noarch (mrmarkuz)
    Requires: zabbix-agent
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest
    [root@p10zab2 ~]#

Hi

A friend of mine ran into that problem too. Seems MrMarkus needs to update his Repo/Module/Version…
This is an issue since the 7.7 upgrade. It will be solved, but tha can take a few days.

An easier way at the moment would be to install the older Version of Nethserver (Last 7.6 DVD/ISO), there all works - and continues to work after upgrading to the latest and greatest!

As I recall, your NethServer setup is fresh, you don’t have anything to lose, but gain new experience and knowledge.

All other stuff mentionned will work as stated on both versions.

My 2 cents
Andy

thanks Andy, yep i can live with reinstalling especially as you and Markuz have done all the leg work for me!.. im looking forward to firing it up later!