PVE Basics Tutorial (Part 4) — Install UPS, SMART Tools and iperf


Install UPS

Since I am using the APC BK650, I will use this method. If you’re using other devices, this tutorial may not be applicable.  

Install apcupsd

apt install apcupsd -y

Modify Configuration

vim /etc/apcupsd/apcupsd.conf

Several areas must be modified:

1.Change UPSNAME to

UPSNAME XXX (choose any name)

2.Set TIMEOUT to 5, which means the system will begin shutting down the virtual machine after switching to UPS power for 5 seconds, then shut down the host. 0 means disable this. This must be set.

TIMEOUT 2

3.Output UPS status to logs every 5 seconds

STATTIME 5

4.Enable logging, log file will be /var/log/apcupsd.status

LOGSTATS on

5.Cable type is usb

UPSCABLE usb

6.USB interface, automatically detected

UPSTYPE usb

7.Make sure to comment out this line, or USB will not be automatically detected

# DEVICE /dev/ttyS0

8.Delay 6 seconds after power loss before recognizing as battery usage, to prevent errors caused by short-term power outages

ONBATTERYDELAY 6

9.Shut down the host when battery level is below 5%, recommend changing to 95, as UPS battery aging may not withstand much drain. Waiting until 5% remains to shut down is too late.

BATTERYLEVEL 95

10.Shut down the host when estimated remaining battery time is less than 3 minutes, suggest setting to 60

MINUTES 60

Then set the service to start on boot:

Start apcupsd

systemctl start apcupsd

Check apcupsd process status

systemctl status apcupsd

Enable at boot

systemctl enable apcupsd

Restart apcupsd after modifying the configuration

systemctl restart apcupsd

Check UPS status

apcaccess

systemctl status apcupsd

Install SMART Tools

Used for viewing disk information under PVE.

apt-get install smartmontools hddtemp -y

First, check which disks are present:

hddtemp /dev/sd?

Then view SMART information:

smartctl -s on -a /dev/sda

To view only necessary details:

smartctl -A /dev/sda

Install iperf  

Used for testing network speed and troubleshooting driver issues. Download link: https://iperf.fr/iperf-download.php#macos

For Linux, you can install directly:

apt-get install iperf3 -y

For OpenWRT installation:

opkg update

opkg install iperf

Usage:

Server:

iperf3 -s

Client:

iperf3 -c 192.168.50.111 -t 60


Leave a Reply

Your email address will not be published. Required fields are marked *