Are you looking to setup your own UPS server for notifications and monitoring or shutdown / starting other servers then this simple tutorial is for you.
Installation of required softwares
Nginx web server apt install nginx
PHP apt install php-fpm php-sqlite3
Wakeonlan apt install wakeonlan
APCUPSD apt install apcupsd
Customization of files
Extract and upload all the files from the zip file in their appropriate directories and chmod all the bash (.sh) files to 755. Also chmod /etc/cron.daily/proxmox-daily-boot file to 755. Where ever you see # Your additional notification API goes here replace that line with your own call for other notifications like sending an email, just add your desired text message
Replace rpi.example.com to the hostname or IP address of your UPS server
Replace proxmox.example.com to the hostname or IP address of your proxmox server, if you have one
Replace MAC_ADDR="D1:AE:52:C9:D3:C2" to the MAC address of your server for Wake On LAN
Adding a new Proxmox user to shutdown the server: Go to Datacenter > Groups > Create > Shutdown. Then go to Users > Add > Username: shutdown, Realm: Proxmox VE authentication server, add other details, Group > shutdown. Go to Roles > Create > Name: shutdown > Privileges Sys.PowerMgmt. Now go to Permissions link > Add > Path /, Group Shutdown, Role Shutdown then Add. Go to API Tokens > Add > User Shutdown > Privilige Separation = Uncheck, Copy token ID and Secret. Now edit the file /root/onbattery-proxmox.sh and change the token values on line 13 and change the node name in the url https://proxmox.example.com:8006/api2/json/nodes/<yournodenamehere>/status
The disk size in the the bottom of UPS status might not work when you first upload the index.php file and view it in your web browser, to fix this edit the file /var/www/html/index.php and edit three lines and replace the root disk with the name of your disk, the name of my SD card is /dev/mmcblk0p2, you can get yours by running the command df for your UPS server.
To change the delay of shutting down the Proxmox or other servers change the sleep value of "sleep 180" in onbattery-proxmox.sh, When the onbattery event is triggered the scripts wait for 3 minutes before shutting down the Proxmos server.
Explanation of bash script /root/offbattery-proxmox.sh : networkup 25 proxmox.example.com number 25 means re-try 25 times with a delay of sleep 900 15 minutes for about 6 hours and when the battery charge is at least 25% and UPS is online [ "$batterystatus" -ge 25 ] && [ $upsstatus == "ONLINE" ] then start the Proxmox server
Screenshot
Let me know if you have any comments or if there is any error in this guide.