惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
J
Java Code Geeks
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
I
InfoQ
D
Docker
F
Fortinet All Blogs
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
月光博客
月光博客
B
Blog
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
罗磊的独立博客
博客园_首页
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
B
Blog RSS Feed
IT之家
IT之家
V
V2EX

Proxmox Support Forum

[SOLVED] - Github Auth for Mirrors-Kernel Repo? [Automation] Mass migration tool for MS Win11/Server Proxmox GUI hang - not response is it possible to reject or quarantine spam based on conditions I set ? The PVENode task list in PVE9 is partially obscured due to the terminal font being too large. About 100% error reporting due to pveproxy.service hooks Kubernetes overlay networking breaks when upgrading from PVE 9.1 to PVE 9.2.3 Zentraler Speicher No space left on device Combine datastore and direct file archival to tape Kernel panic VFS: Unable to mount root fs on unknown-block (0,0) sobald ein 7.x Kernel verwendet wird. How to migrate disk of a VM from one ZFS to another Windows Server 2025 fails to boot after PVE 9.2 / Linux 7.0 Kernel upgrade Cannot Install Proxmox on T610 Poweredge with H700 PERC card sdn Config. gateway not reachable How to safely change domain/FQDN? Welche Filterquote erreicht ihr? NFS Share status unknown on 2 of 5 nodes Can't connect to PVE9 consoles [solved] Can't connect to PVE9 consoles [solved] [SOLVED] - Use secondary network for PVE commands Created cluster, one node storage gone BUG: proxmox mail gateway FROM = null bypass spam filtering Moving existing PBS from VMWare workstation to PVE cluster Does eBGP SDN fabric support external peering? Bug: PDM 1.1 not recognizing valid license status Proxmox GUI hang - not response PVE crashes unexpectedly Proxmox Backup Server 4.2 released! Advice
[TUTORIAL] - Script to dynamicaly control ipmi fans depen...
invalid@exam · 2026-06-24 · via Proxmox Support Forum

I have vibe coded this bash script for inreasing fans speed (auto) on high host cpu usage and dropping to low fans speed when cpu usage is low
enjoy! just run some hungry VM or change HIGH_THRESHOLD=85 like to 45 (becase hyperthreading for example)
you can also remove extra logging for purpose of less SSD wear, anyway it probably cache it in slc or ssd dram cache

nano /usr/local/bin/cpu-automation.sh

Bash:

#!/usr/bin/env bash

# ==============================================================================
# CONFIGURATION
# ==============================================================================
HIGH_THRESHOLD=85   # Trigger high command if CPU is above this %
LOW_THRESHOLD=15    # Trigger low command if CPU falls below this %

STATE_FILE="/tmp/cpu_high_triggered.state"
LOG_FILE="/var/log/cpu-automation.log"

# ==============================================================================
# ACCURATE CPU PERCENTAGE CALCULATION (1-second sample delta)
# ==============================================================================
read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat
prev_total=$((user + nice + system + idle + iowait + irq + softirq + steal))
prev_idle=$((idle + iowait))

sleep 1

read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat
total=$((user + nice + system + idle + iowait + irq + softirq + steal))
idle=$((idle + iowait))

total_delta=$((total - prev_total))
idle_delta=$((idle - prev_idle))
used_delta=$((total_delta - idle_delta))

# Guard against dividing by zero if metrics fail to update
if [ "$total_delta" -le 0 ]; then
    echo "$(date): Error calculating CPU metrics. Skipping run." >> "$LOG_FILE"
    exit 1
fi

CPU_INT=$(( 100 * used_delta / total_delta ))

# ==============================================================================
# AUTOMATION LOGIC
# ==============================================================================
if [ "$CPU_INT" -gt "$HIGH_THRESHOLD" ]; then
    echo "$(date): High CPU detected at ${CPU_INT}%." >> "$LOG_FILE"
 
    # ----------------------------------------------------------------------
    # COMMAND A: RUNS ON HIGH CPU SPIKE
    # Replace the echo line below with your actual high CPU command.
    # ----------------------------------------------------------------------
    echo "Executing High CPU action..." >> "$LOG_FILE"
    # ---- DELL commands for ipmitool for auto fans  DEPENDS ON PLATFORM this is DELL 13 GEN ------
    #ipmitool -I lanplus -H ipaddress -U user -P password raw 0x30 0x30 0x01 0x01
 
    # Flag that the high command ran so the low command is unlocked
    touch "$STATE_FILE"

elif [ "$CPU_INT" -lt "$LOW_THRESHOLD" ]; then
    # Only run if Command A (High CPU) has run previously
    if [ -f "$STATE_FILE" ]; then
        echo "$(date): Low CPU detected at ${CPU_INT}% and High CPU ran previously." >> "$LOG_FILE"
     
        # ------------------------------------------------------------------
        # COMMAND B: RUNS ONLY IF CPU DROPS LOW AFTER A SPIKE
        # Replace the echo line below with your actual low CPU command.
        # ------------------------------------------------------------------
        echo "Executing Low CPU action..." >> "$LOG_FILE"
        #### -- ipmi fans 25 percent DEPENDS ON PLATFORM this is DELL 13 GEN ---
        #ipmitool -I lanplus -H ipaddress -U user -P password raw 0x30 0x30 0x01 0x00
        #ipmitool -I lanplus -H ipaddress -U user -P password raw 0x30 0x30 0x02 0xff 0x19
     
        # Clear the state file to reset the cycle and prevent loops
        rm -f "$STATE_FILE"
    else
        # System is idle, but no previous spike occurred. Do nothing.
        # you can comment next line and put : (colon) on next line
        echo "$(date): Idle at ${CPU_INT}%, skipping action (Waiting for High CPU trigger)." >> "$LOG_FILE"
    fi
else
    # Optional: Log baseline steady-state activity
    echo "$(date): CPU steady at ${CPU_INT}%." >> "$LOG_FILE"
fi

Bash:

crontab -e

* * * * * /usr/local/bin/cpu-automation.sh >/dev/null 2>&1

Last edited: