Proxmox and UPS best practice

mircolino

New Member
Feb 9, 2023
25
8
3
I just completed a single node PVE installation on a Intel NUC with a few VM and LXC (pfsense, home assistant, unifi controller, samba share, Win11) and everything is working really well.
The Intel NUC is powered by a UPS with SNMP interface and I now would like to properly shut-down and restart PVE on loss of power.
What is the recommended best practice here?

1. Install NUT server in a LXC container and install NUT client directly on PVE
2. Install both NUT server and client directly on PVE
3. Other/better way?
 
I think the most important part here is that your UPS works correctly, so it's best if you just tested what works best for you.

Personally however, I would choose the second option that you listed, since it seems to be the most straightforward one. I myself only have experience with apcpupsd, which is just a daemon that's installed and configured on the host directly.

Side note: This is more in the realm of configuration management, but regardless of what you decide for, you could incorporate something like Ansible or a similar tool in order to ensure your configuration is deployed in a reproducible manner, if you really want. Might be a little overkill for a single node though. I personally always keep a copy of any configuration files I add or edit, just in case something goes wrong.
 
  • Like
Reactions: mircolino
Max, thank you for the reply. I was a bit hesitant to try apcpupsd because It seems like it hasn't been updated in a very long time and it's been developed mostry for APC UPS and mine unfortunately is a FSP.
But since you mention it, I'll give it a try.
 
Last edited:
After a bit of trial and error, I got apcpupsd to work with my FSP UPS. Thank you @Max Carrara.

Code:
root@dino:~# apt install apcupsd
root@dino:~# mv /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.org.conf
root@dino:~# nano /etc/apcupsd/apcupsd.conf

## apcupsd.conf v1.1 ##

UPSNAME fsp
UPSCABLE ether
UPSTYPE snmp
DEVICE <hostname>:161::public
UPSCLASS standalone
UPSMODE disable

root@dino:~# systemctl restart apcupsd
root@dino:~# systemctl status apcupsd
* apcupsd.service - UPS power management daemon
     Loaded: loaded (/lib/systemd/system/apcupsd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-02-25 23:40:48 UTC; 4s ago
       Docs: man:apcupsd(8)
    Process: 658 ExecStartPre=/lib/apcupsd/prestart (code=exited, status=0/SUCCESS)
    Process: 662 ExecStart=/sbin/apcupsd (code=exited, status=0/SUCCESS)
   Main PID: 663 (apcupsd)
      Tasks: 3 (limit: 76651)
     Memory: 660.0K
        CPU: 7ms
     CGroup: /system.slice/apcupsd.service
             `-663 /sbin/apcupsd

Feb 25 23:40:48 dino systemd[1]: Stopping UPS power management daemon...
Feb 25 23:40:48 dino apcupsd[644]: apcupsd shutdown succeeded
Feb 25 23:40:48 dino systemd[1]: apcupsd.service: Succeeded.
Feb 25 23:40:48 dino apcupsd[663]: apcupsd 3.14.14 (31 May 2016) debian startup succeeded
Feb 25 23:40:48 dino systemd[1]: Stopped UPS power management daemon.
Feb 25 23:40:48 dino systemd[1]: Starting UPS power management daemon...
Feb 25 23:40:48 dino systemd[1]: apcupsd.service: Can't open PID file /run/apcupsd.pid (yet?) after>
Feb 25 23:40:48 dino systemd[1]: Started UPS power management daemon.
Feb 25 23:40:48 dino apcupsd[663]: NIS server startup succeeded

root@dino:~# apcaccess
APC      : 001,034,0789
DATE     : 2023-02-25 23:40:48 +0000
HOSTNAME : dino
VERSION  : 3.14.14 (31 May 2016) debian
UPSNAME  : SNMP web pro
CABLE    : Ethernet Link
DRIVER   : SNMP UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2023-02-25 23:40:48 +0000
MODEL    : WPHVR1K0
STATUS   : ONLINE
LINEV    : 220.0 Volts
LOADPCT  : 19.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 57.0 Minutes
MBATTCHG : 10 Percent
MINTIMEL : 5 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 229.0 Volts
DLOWBATT : 0 Minutes
ITEMP    : 27.0 C
ALARMDEL : No alarm
BATTV    : 27.3 Volts
LINEFREQ : 50.0 Hz
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : OK
STATFLAG : 0x05000008
NOMOUTV  : 230 Volts
NOMINV   : 230 Volts
NOMPOWER : 900 Watts
FIRMWARE : VERFW:01273.08
END APC  : 2023-02-25 23:41:19 +0000

Broadcast message from root@dino (closet) (Sun Feb 26 08:19:26 2023):

Power failure on UPS SNMP web pro. Running on batteries.

Broadcast message from root@dino (closet) (Sun Feb 26 08:19:42 2023):

Power has returned on UPS SNMP web pro...
 
Last edited:
  • Like
Reactions: no-usernames-left
I have a problem with configuration of NUT. NUT server is a Synology DS918+. Proxmox host is the NUT client. I have problem with configuration to shutdown proxmox and send emails. The connection between DS918+ and Proxmox Host works fine. I can see in the syslog "on battery". But Proxmox doesn't shutdown.

I'm a newbie in Proxmox and command line interface ;). Can you help at configuration the .conf datas?

Thanks a lot.

Have a nice week .

Ronny

I found a solution by myself.
 
Last edited:
I have a problem with configuration of NUT. NUT server is a Synology DS918+. Proxmox host is the NUT client. I have problem with configuration to shutdown proxmox and send emails. The connection between DS918+ and Proxmox Host works fine. I can see in the syslog "on battery". But Proxmox doesn't shutdown.

I'm a newbie in Proxmox and command line interface ;). Can you help at configuration the .conf datas?

Thanks a lot.

Have a nice week .

Ronny

I found a solution by myself.
Can You give advice?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!