Cyberpower power panel

Dec 24, 2022
60
12
8
How do I move the downloaded .Deb installer for powerpanel to proxmox and install. Want to have the program to alow automatic shutdowns.
 
It's a cyberpower ups. Would like to somehow configure everything to auto shutdown. I saw a thing where someone used NUT on pfsense router and had proxmox pull info from that to alow auto shutdown of all connected devices. That would be nice
 
I have the same question. I saw on another post that a user recommended installing cyber power's Debian linux based power panel software directly on the proxmox host instead of using NUT. I like that idea and would like to do that. However, I am new to proxmox and I am unsure how to install 3rd party software that is not in the repository directly to the proxmox host.

Did you end up finding a solution?
 
it could be an lxc ubun or alpine with the cyberpower soft installed on it. As being even smaller in resource..
 
i figured out how to get it installed.
i went into the proxmox shell and typed:
curl -o cyberpowerpowerpanel.deb https://www.cyberpower.com/tw/en/File/GetFileSampleByType?fileId=SU-18070001-06&fileType=Download%20Center&fileSubType=FileOriginal
to download the installer.
then I did:
dpkg -i cyberpowerpowerpanel.deb
and that installed it.

it is definately working insofar as that I can type
pwrstat -status

and it will display things like battery capacity and runtime.

I am still unsure how to configure it for a graceful shutdown from here but I am working on it and I will get back to you.
 
Ok I configured the graceful shutdown and it worked perfectly. For me personally, this was a much better solution than NUT (although if I end up with a setup in the future with multiple servers connected to the same UPS - or something else requiring different commands being sent to different machines, I can see why I would use NUT in that case.)

After you get the install set up from my post above, here is how you set up graceful shutdowns for power failures (mine is currently set up for a shutdown after 1 minute, but I might change it to 5 minutes by changing the delay from 60 to 300):
pwrstat -pwrfail -delay 60 -active on -cmd /etc/pwrstatd-powerfail.sh -duration 1 -shutdown on

you can also do a shutdown for low battery like this (This is set for when you have less than 5 minutes of battery time remaining but you can adjust that by changing the 300 seconds to something else if you like):
pwrstat -lowbatt -runtime 300 -capacity 35 -active on -cmd /etc/pwrstatd-lowbatt.sh -duration 1 -shutdown on

you can see all the options at:
man pwrstat

i tested the above by unplugging the UPS and after 1 minute, proxmox shutdown.
 
Ok I configured the graceful shutdown and it worked perfectly. For me personally, this was a much better solution than NUT (although if I end up with a setup in the future with multiple servers connected to the same UPS - or something else requiring different commands being sent to different machines, I can see why I would use NUT in that case.)

After you get the install set up from my post above, here is how you set up graceful shutdowns for power failures (mine is currently set up for a shutdown after 1 minute, but I might change it to 5 minutes by changing the delay from 60 to 300):
pwrstat -pwrfail -delay 60 -active on -cmd /etc/pwrstatd-powerfail.sh -duration 1 -shutdown on

you can also do a shutdown for low battery like this (This is set for when you have less than 5 minutes of battery time remaining but you can adjust that by changing the 300 seconds to something else if you like):
pwrstat -lowbatt -runtime 300 -capacity 35 -active on -cmd /etc/pwrstatd-lowbatt.sh -duration 1 -shutdown on

you can see all the options at:
man pwrstat

i tested the above by unplugging the UPS and after 1 minute, proxmox shutdown.
Thanks for this! SO much easier than nut server. Thank you
 
you might want to mark this thread as a tutorial!
nicely done... though i have 3 servers and need to figure out NUT with my cyberpower with RM card :)
 
if its not to late i just use my pi3 as a nut server and then setup nut client on the proxmox hosts... Very straight forward setup..
 
  • Like
Reactions: scyto
Thanks so much @NOiSEA for sharing, this certainly saved me a lot of hassle. For anyone who wants to also set up email alerts, this is what worked for me:

1. Install ssmtp or your desired smtp service. For ssmtp configure
Code:
/etc/ssmtp/ssmtp.conf

Example for gmail:

Code:
AuthUser=user@gmail.com
AuthPass=GmailPassword #obtain from ”Applications Password” on your google account
FromLineOverride=YES
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES

2. Test to ensure the mail command works

Code:
echo "this is for testing" | mail -s "$(echo -e "test\nFrom: UPS Alert <yourdesiredsenderaddress@email.com>\nContent-Type: text/html\n")" recipient@email.com

3. Edit the email script command at the end of your pwrstatd-email.sh script (in /etc/) to follow the current syntax for Mailutils if it's not like this already:

Code:
echo "${DATA[*]}" | mail \

-s   "$(echo -e "$SUBJECT\nFrom: $FROM\n")" \

     "$TO"

exit 0

(ref: https://github.com/bhavenga/pwrstatd_scripts/blob/master/pwrstatd-email.sh )

I also edited the "TO:" line to have my single email address instead of pulling it from the powerfail/lowbatt scripts $RECEIPT_ADDRESS since I'm only using this at home and have the same recipient address for everything.

4. Ensure in the shell script being used, e.g. pwrstatd-powerfail.sh or pwrstatd-lowbatt.sh, the email variable is set to yes.
 
if you setup smtp via datacenter you can simply ignore the from to address variables in your scripts and setup /etc/pwrstatd-email.sh with the following:

Bash:
IFS=$'\n'

echo "${DATA[*]}" | mail -s "$SUBJECT" root

exit 0
 
Last edited:
i figured out how to get it installed.
i went into the proxmox shell and typed:
curl -o cyberpowerpowerpanel.deb https://www.cyberpower.com/tw/en/File/GetFileSampleByType?fileId=SU-18070001-06&fileType=Download%20Center&fileSubType=FileOriginal
to download the installer.
then I did:
dpkg -i cyberpowerpowerpanel.deb
and that installed it.

it is definately working insofar as that I can type
pwrstat -status

and it will display things like battery capacity and runtime.

I am still unsure how to configure it for a graceful shutdown from here but I am working on it and I will get back to you.

Thank you for this! Tested and working.
 
if you setup smtp via datacenter you can simply ignore the from to address variables in your scripts and setup /etc/pwrstatd-email.sh with the following:

Bash:
IFS=$'\n'

echo "${DATA[*]}" | mail -s "$SUBJECT" root

exit 0

Does this look about right? Should I delete the "TO="$RECEIPT_NAME <$RECEIPT_ADDRESS>""? if so should it be
TO="$google <$test@gmail.com>" or remove the dollar sign?

They look like variables but where are they defined?

#!/bin/bash

#
# This is sample script of the send mail for pwrstatd daemon using.
#

# If you want to change SMTP server, edit following parameters into /etc/mail.rc file.
# set smtp=smtp server address
# set smtp-auth-user=user name
# set smtp-auth-password=user password


SUBJECT="PowerPanel Notification - [$EVENT]"
FROM="PowerPanel Daemon <$SENDER_ADDRESS>"
TO="$RECEIPT_NAME <$RECEIPT_ADDRESS>"
MESSAGE="Warning: The $EVENT event has occurred for a while, system will be shutdown immediately!"

DATE=`date +'%Y/%m/%d %p %H:%M'`
test ${#DATE}

RUNTIME=""

if [ ! -z "$REMAINING_RUNTIME" ]; then
RUNTIME="Remaining Runtime: $REMAINING_RUNTIME Seconds"
fi

DATA=(
"========================================================"
" $SUBJECT"
"========================================================"
""
""
"$MESSAGE"
"Time: $DATE"
""
""
"UPS Model Name: $MODEL_NAME"
"Battery Capacity: $BATTERY_CAPACITY %"
"$RUNTIME"
)

IFS=$'\n'

echo "${DATA[*]}" | mail -s "$SUBJECT" root

exit 0

#IFS=$'\n'
#echo "${DATA[*]}" | mail \
#-r "$FROM" \
#-s "$SUBJECT" \
# "$TO"

#exit 0

Any way to test this? I tried "pwrstat -test" but no email is sent.
 
Does this look about right? Should I delete the "TO="$RECEIPT_NAME <$RECEIPT_ADDRESS>""? if so should it be
TO="$google <$test@gmail.com>" or remove the dollar sign?

They look like variables but where are they defined?



Any way to test this? I tried "pwrstat -test" but no email is sent.
-test only makes a self test of the UPS battery

try unplugging it from main and see then
 
-test only makes a self test of the UPS battery

try unplugging it from main and see then
Just tried, no email. In Datacenter I can send a test Gmail SMTP I created, and it works also when I do a backup I get a email. I have the default type "sendmail" disabled.
Screenshot 2024-08-04 015004.png
 
-test only makes a self test of the UPS battery

try unplugging it from main and see then
Screenshot 2024-08-20 220240.png

Not working, is this correct?

Code:
SUBJECT="PowerPanel Notification - [$EVENT]"
FROM="PowerPanel Daemon <$SENDER_ADDRESS>"
TO="$RECEIPT_NAME <$RECEIPT_ADDRESS>"
MESSAGE="Warning: The $EVENT event has occurred for a while, system will be shutdown immediately!"

DATE=`date +'%Y/%m/%d %p %H:%M'`
test ${#DATE}

RUNTIME=""

if [ ! -z "$REMAINING_RUNTIME" ]; then
        RUNTIME="Remaining Runtime: $REMAINING_RUNTIME Seconds"
fi

DATA=(
"========================================================"
"   $SUBJECT"
"========================================================"
""
""
"$MESSAGE"
"Time: $DATE"
""
""
"UPS Model Name: $MODEL_NAME"
"Battery Capacity: $BATTERY_CAPACITY %"
"$RUNTIME"
)

IFS=$'\n'

echo "${DATA[*]}" | mail -s "$SUBJECT" root

exit 0

#IFS=$'\n'
#echo "${DATA[*]}" | mail \
#-r   "$FROM" \
#-s   "$SUBJECT" \
#     "$TO"

#exit 0


Did some digging found some errors running journalctl _SYSTEMD_UNIT=postfix@-.service

Code:
ug 03 16:18:17 procove postfix[764]: Postfix is using backwards-compatible default settings
Aug 03 16:18:17 procove postfix[764]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Aug 03 16:18:17 procove postfix[764]: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Aug 03 16:18:18 procove postfix/postfix-script[860]: starting the Postfix mail system
Aug 03 16:18:18 procove postfix/master[862]: daemon started -- version 3.7.11, configuration /etc/postfix
Aug 03 17:52:17 procove postfix/pickup[863]: 677178050F: uid=0 from=<root>
Aug 03 17:52:17 procove postfix/cleanup[40682]: 677178050F: message-id=<20240803225217.677178050F@procove.alife.com>
Aug 03 17:52:17 procove postfix/qmgr[864]: 677178050F: from=<root@procove.life.com>, size=889, nrcpt=1 (queue active)
Aug 03 17:52:17 procove postfix/smtp[40684]: connect to gmail-smtp-in.l.google.com[607:f0:43:104::b]:25: Network is unreachable
Aug 03 17:52:47 procove postfix/smtp[40684]: connect to gmail-smtp-in.l.google.com[142.50.15.26]:25: Connection timed out
Aug 03 17:53:17 procove postfix/smtp[40684]: connect to alt1.gmail-smtp-in.l.google.com[142.250.12.26]:25: Connection timed out
Aug 03 17:53:17 procove postfix/smtp[40684]: connect to alt1.gmail-smtp-in.l.google.com[267:f80:401:c56::1b]:25: Network is unreachable
Aug 03 17:53:17 procove postfix/smtp[40684]: connect to alt2.gmail-smtp-in.l.google.com[207:fb0:403:1::1b]:25: Network is unreachable

Some issue with port 25?
 
Last edited:
Ensure in the shell script being used, e.g. pwrstatd-powerfail.sh or pwrstatd-lowbatt.sh, the email variable is set to yes.
WHere do you check this?

Edit:
Found it
nano /etc/pwrstatd-powerfail.sh
 
Last edited:

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!