In case of a power failure Proxmox VE will not shutdown when the battery is getting to low.
Simple because there is nothing installed on the server to tell that Proxmox VE should make a clean shutdown for the VM's and then shutdown the server properly.
With apcupsd this can be done.
It is also reachable by browser so you can see the remaining battery and more.
Nearly every APC UPS should work with apcupsd.
Tested with:
Proxmox 3.4
Proxmox 7.2-3
APC SC420 ( serial interface connected to COM1 on the server )
APC SC450 ( serial interface connected to COM1 on the server )
APC SC420 ( serial interface connected to COM1 on the server )
APC SC450 ( serial interface connected to COM1 on the server )
BlueWalker PowerWalker VFI 1000 TG ( connected to USB on the server )
MGE Evolution 1550 ( connected to USB on the server )
Installation:
Prep your VM's so Proxmox can shut them down cleanly.
You can find out how to do this in the Proxmox First Server installation guide. - Open the Proxmox "Shell"
Update your package repositories.
type: apt-get update
skip this step when using Proxmox 7.2-3! Webserver function is not working, so no need to install apache2.
Now it's time to install the webserver to be used to check the status of the battery and so on in the browser.
type: apt-get install apache2
Time to install apcupsd and neccesary packages
type: apt-get install apcupsd apcupsd-doc apcupsd-cgi
One installed configure some settings in the config file.
In the config file everything is well explained.
type: nano /etc/apcupsd/apcupsd.conf
Following are the settings i modified or should be checked. You should change according to your situation.
UPSNAME APC-SC402
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (this is COM1 on my server)
ONBATTERYDELAY 6
BATTERYLEVEL 25 (when batterylevel hits 25% your proxmox server will shutdown)
MINUTES 10 (or when 10 minutes battery time is remaining)
TIMEOUT 0
SELFTEST 336 ON
Press "CTRL+X" to exit.
Press "Y" to save.
Now activate the just edited configuration file
type: nano /etc/default/apcupsd
Change the "ISCONFIGURED" to yes
ISCONFURED=yes
Press "CTRL+X" to exit.
Press "Y" to save.
Start the APCUPS deamon
type: /etc/init.d/apcupsd start
Now open your browser and go to the following link:
http://your-proxmox-ip/cgi-bin/apcupsd/multimon.cgi
With apcaccess status you can check the UPS on the commandline
Nothing to explain anymore, you should know by now if it works ;)
Different config files for UPS Models:
APC SC402 / SC450 (Serial Connection)
=========================================================================
UPSNAME APC-SC402
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (this is COM1 on my server)
=====================================================================
BlueWalker PowerWalker VFI 1000 TG (USB Connection)
=====================================================================
UPSNAME VFI-1000-TG
UPSCABLE usb
UPSTYPE usb
DEVICE
=====================================================================
MGE Evolution 1550 (USB Connection)
=====================================================================
UPSNAME MGE-1550
UPSCABLE usb
UPSTYPE usb
DEVICE
=====================================================================
Installation:
Prep your VM's so Proxmox can shut them down cleanly.
You can find out how to do this in the Proxmox First Server installation guide. - Open the Proxmox "Shell"
Update your package repositories.
type: apt-get update
skip this step when using Proxmox 7.2-3! Webserver function is not working, so no need to install apache2.
Now it's time to install the webserver to be used to check the status of the battery and so on in the browser.
type: apt-get install apache2
Time to install apcupsd and neccesary packages
type: apt-get install apcupsd apcupsd-doc apcupsd-cgi
One installed configure some settings in the config file.
In the config file everything is well explained.
type: nano /etc/apcupsd/apcupsd.conf
Following are the settings i modified or should be checked. You should change according to your situation.
UPSNAME APC-SC402
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (this is COM1 on my server)
ONBATTERYDELAY 6
BATTERYLEVEL 25 (when batterylevel hits 25% your proxmox server will shutdown)
MINUTES 10 (or when 10 minutes battery time is remaining)
TIMEOUT 0
SELFTEST 336 ON
Press "CTRL+X" to exit.
Press "Y" to save.
Now activate the just edited configuration file
type: nano /etc/default/apcupsd
Change the "ISCONFIGURED" to yes
ISCONFURED=yes
Press "CTRL+X" to exit.
Press "Y" to save.
Start the APCUPS deamon
type: /etc/init.d/apcupsd start
Now open your browser and go to the following link:
http://your-proxmox-ip/cgi-bin/apcupsd/multimon.cgi
With apcaccess status you can check the UPS on the commandline
Nothing to explain anymore, you should know by now if it works ;)
Different config files for UPS Models:
APC SC402 / SC450 (Serial Connection)
=========================================================================
UPSNAME APC-SC402
UPSCABLE smart
UPSTYPE apcsmart
DEVICE /dev/ttyS0 (this is COM1 on my server)
=====================================================================
BlueWalker PowerWalker VFI 1000 TG (USB Connection)
=====================================================================
UPSNAME VFI-1000-TG
UPSCABLE usb
UPSTYPE usb
DEVICE
=====================================================================
MGE Evolution 1550 (USB Connection)
=====================================================================
UPSNAME MGE-1550
UPSCABLE usb
UPSTYPE usb
DEVICE
=====================================================================
11 comments:
I have been testing apcupsd a lot lately it seems on a few platforms. Prior to proxmox I used primarily redhat releases, and in RedHat/Centos releases apcupsd comes preconfigured to HALT the system, not simply power it off. This actually helped with a few things:
1. Leaving it in the halted state runs the UPS power down faster.
2. The machine physically turns off when there is no more power.
3. The systems remembers being in the last known state of "powered on", before failure.
4. So... when power is reapplied it starts automatically with no human intervention.
I am not going to say there are not other complications to this problem. For instance different BIOS releases may have different capabilities. In my most recent BIOS, it has an option to remember state, stay off, or turn on... when when power is reapplied. I think the best setting for a very simple proxmox installation is 'Power On'.
If you don't test all of these issues you can't expect your system to turn on automatically after a power failure event, even if the system does shutdown 'gracefully'. So this brings me back to the default Proxmox installation of Debian. In Debian releases the 'doshutdown' sequence in the script used to power the machine down: /etc/apcupsd/accontrol, does not provide the -H flag to /sbin/shutdown. The -H flag is the option used to HALT the system without removing power (ie. powering off the device). Without the -H option your machine powers off completely, and your UPS might not actually run out of power by the time the power comes back on. It is likely desirable that you add the -H option to this line(111):
${SHUTDOWN} -h -H now "apcupsd UPS ${2} initiated shutdown"
When you do this, and set your BIOS APC setting to automatically power on when power is applied, you can better guarantee your server will power backup after a power loss event. If you have your server in a remote location, with limited expenses/resources involved like I do, you will be able to better appreciate your UPS, by actually running through a test and confirming you have it setup in the required fashion.
Hi Dave,
Thanks for your feedback.
I will have a look at your message and test this.
As soon as i tested it i will put it in the post.
Again thanks!
Yes, it's running directly on the host.
Benefit is that you don't have to run a extra vm for your APCUPSd.
But when you configure the vm the right way so i won't be shutdown before the other vm's i don't see any drawback to that either.
Basicly it's what you would prefer ;)
And what about starting when power comes back?
In the BIOS of your Server you can set what the server shoudl do when the power comes back.
I have Proxmox 6.0-4 and tried this as shown above, but I am not sure if it is working properly. The webpage does not load.
This is my output in Shell:
root@proxmox:~# apcaccess status
APC : 001,017,0422
DATE : 2019-12-03 10:16:04 -0500
HOSTNAME : proxmox
VERSION : 3.14.14 (31 May 2016) debian
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2019-12-02 16:42:30 -0500
STATUS : COMMLOST
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
STATFLAG : 0x05000100
END APC : 2019-12-03 11:23:50 -0500
Does this status above look correct? I find it strange that the Status is "COMMLOST" and the MBATTCHG is 5 Percent.
Thoughts?
Any advice on how to get the webpage running?
nano /etc/apcupsd/apcupsd.conf
comment out this line:
DEVICE /dev/ttyS0
to
#DEVICE /dev/ttyS0
Do not set a device, just leave it out. At least that works here.
source: https://forums.freebsd.org/threads/apcupsd-problems.53825/
I have the same Problem
Reboot the machine. I had the same problem untill i decided to reboot my proxmox. now it is working.
Thanks for this post. now my APC unit is setup.
APC : 001,036,0858
DATE : 2020-06-23 17:10:39 -0400
HOSTNAME : ********
VERSION : 3.14.14 (31 May 2016) debian
UPSNAME : APCpro1500
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2020-06-23 17:08:55 -0400
MODEL : Back-UPS RS 1500G
STATUS : ONLINE
LINEV : 121.0 Volts
LOADPCT : 21.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 30.1 Minutes
MBATTCHG : 50 Percent
MINTIMEL : 10 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 88.0 Volts
HITRANS : 147.0 Volts
ALARMDEL : 30 Seconds
BATTV : 26.9 Volts
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 4B2004P08209
BATTDATE : 2020-01-22
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 865 Watts
FIRMWARE : 865.L9 .D USB FW:L9
END APC : 2020-06-23 17:10:49 -0400
Sorry for the late response.
To make it more clear when you connect your UPS (APC or whatever brand) with USB then don't use /dev/ttyS0, In the tutorial ttys0 is a serial port (in my case it was COM1).
Leave Device blank as descriped in the second example config at the bottem (the MGE config) or comment out the DEVICE line.
Thanks.
Post a Comment