Ajout version LXC et restructuration complète du projet
🚀 NOUVELLES FONCTIONNALITÉS : - Version LXC complète pour Proxmox avec installation automatisée - Script d'installation LXC avec interface colorée et vérifications - Service systemd avec configuration sécurisée - Script de désinstallation avec sauvegarde de config 📁 RESTRUCTURATION : - Séparation Docker/LXC dans des dossiers dédiés - Documentation spécialisée pour chaque version - Guide d'installation unifié (INSTALL.md) - README principal avec comparaison des versions 🐳 AMÉLIORATIONS DOCKER : - docker-compose.yml optimisé avec healthcheck - Documentation Docker détaillée - Configuration par variables d'environnement clarifiée 📦 FONCTIONNALITÉS LXC : - Installation en une commande - Intégration systemd native - Gestion des permissions et sécurité - Logs intégrés avec journalctl - Configuration via fichier d'environnement 🔧 OUTILS INCLUS : - Scripts d'installation/désinstallation - Healthchecks pour les deux versions - Documentation de dépannage - Comparatif des deux approches 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
167
lxc/Dell_iDRAC_fan_controller.sh
Executable file
167
lxc/Dell_iDRAC_fan_controller.sh
Executable file
@@ -0,0 +1,167 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Enable strict bash mode to stop the script if an uninitialized variable is used, if a command fails, or if a command with a pipe fails
|
||||
# Not working in some setups : https://github.com/tigerblue77/Dell_iDRAC_fan_controller/issues/48
|
||||
# set -euo pipefail
|
||||
|
||||
source functions.sh
|
||||
|
||||
# Trap the signals for container exit and run gracefull_exit function
|
||||
trap 'gracefull_exit' SIGQUIT SIGKILL SIGTERM
|
||||
|
||||
# Prepare, format and define initial variables
|
||||
|
||||
# readonly DELL_FRESH_AIR_COMPLIANCE=45
|
||||
|
||||
# Define the temperature thresholds and corresponding fan speeds
|
||||
TEMP_THRESHOLDS=($CPU_TEMPERATURE_1 $CPU_TEMPERATURE_2 $CPU_TEMPERATURE_3 $CPU_TEMPERATURE_4)
|
||||
FAN_SPEEDS=($FAN_SPEED_1 $FAN_SPEED_2 $FAN_SPEED_3 $FAN_SPEED_4 100) # Correspond aux seuils + vitesse max
|
||||
|
||||
# Check if the iDRAC host is set to 'local' or not then set the IDRAC_LOGIN_STRING accordingly
|
||||
if [[ $IDRAC_HOST == "local" ]]
|
||||
then
|
||||
# Check that the Docker host IPMI device (the iDRAC) has been exposed to the Docker container
|
||||
if [ ! -e "/dev/ipmi0" ] && [ ! -e "/dev/ipmi/0" ] && [ ! -e "/dev/ipmidev/0" ]; then
|
||||
echo "/!\ Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0, check that you added the device to your Docker container or stop using local mode. Exiting." >&2
|
||||
exit 1
|
||||
fi
|
||||
IDRAC_LOGIN_STRING='open'
|
||||
else
|
||||
echo "iDRAC/IPMI username: $IDRAC_USERNAME"
|
||||
echo "iDRAC/IPMI password: $IDRAC_PASSWORD"
|
||||
IDRAC_LOGIN_STRING="lanplus -H $IDRAC_HOST -U $IDRAC_USERNAME -P $IDRAC_PASSWORD"
|
||||
fi
|
||||
|
||||
get_Dell_server_model
|
||||
|
||||
if [[ ! $SERVER_MANUFACTURER == "DELL" ]]
|
||||
then
|
||||
echo "/!\ Your server isn't a Dell product. Exiting." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Log main informations
|
||||
echo "Server model: $SERVER_MANUFACTURER $SERVER_MODEL"
|
||||
echo "iDRAC/IPMI host: $IDRAC_HOST"
|
||||
|
||||
# Log the check interval
|
||||
echo "Check interval: ${CHECK_INTERVAL}s"
|
||||
echo ""
|
||||
|
||||
# Define the interval for printing
|
||||
readonly TABLE_HEADER_PRINT_INTERVAL=10
|
||||
i=$TABLE_HEADER_PRINT_INTERVAL
|
||||
# Set the flag used to check if the active fan control profile has changed
|
||||
IS_DELL_FAN_CONTROL_PROFILE_APPLIED=true
|
||||
|
||||
# Check present sensors
|
||||
IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT=true
|
||||
IS_CPU2_TEMPERATURE_SENSOR_PRESENT=true
|
||||
retrieve_temperatures $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
|
||||
if [ -z "$EXHAUST_TEMPERATURE" ]
|
||||
then
|
||||
echo "No exhaust temperature sensor detected."
|
||||
IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT=false
|
||||
fi
|
||||
if [ -z "$CPU2_TEMPERATURE" ]
|
||||
then
|
||||
echo "No CPU2 temperature sensor detected."
|
||||
IS_CPU2_TEMPERATURE_SENSOR_PRESENT=false
|
||||
fi
|
||||
# Output new line to beautify output if one of the previous conditions have echoed
|
||||
if ! $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT || ! $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
|
||||
then
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
||||
# Start monitoring
|
||||
while true; do
|
||||
# Sleep for the specified interval before taking another reading
|
||||
sleep $CHECK_INTERVAL &
|
||||
SLEEP_PROCESS_PID=$!
|
||||
|
||||
retrieve_temperatures $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
|
||||
|
||||
# Define functions to check if CPU 1 and CPU 2 temperatures are above the threshold
|
||||
function CPU1_OVERHEAT () { [ $CPU1_TEMPERATURE -gt $CPU_TEMPERATURE_THRESHOLD ]; }
|
||||
if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
|
||||
then
|
||||
function CPU2_OVERHEAT () { [ $CPU2_TEMPERATURE -gt $CPU_TEMPERATURE_THRESHOLD ]; }
|
||||
fi
|
||||
|
||||
# Initialize a variable to store the comments displayed when the fan control profile changed
|
||||
COMMENT=" -"
|
||||
# Check if CPU 1 is overheating then apply Dell default dynamic fan control profile if true
|
||||
if CPU1_OVERHEAT
|
||||
then
|
||||
apply_Dell_fan_control_profile
|
||||
|
||||
if ! $IS_DELL_FAN_CONTROL_PROFILE_APPLIED
|
||||
then
|
||||
IS_DELL_FAN_CONTROL_PROFILE_APPLIED=true
|
||||
|
||||
# If CPU 2 temperature sensor is present, check if it is overheating too.
|
||||
# Do not apply Dell default dynamic fan control profile as it has already been applied before
|
||||
if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT && CPU2_OVERHEAT
|
||||
then
|
||||
COMMENT="CPU 1 and CPU 2 temperatures are too high, Dell default dynamic fan control profile applied for safety"
|
||||
else
|
||||
COMMENT="CPU 1 temperature is too high, Dell default dynamic fan control profile applied for safety"
|
||||
fi
|
||||
fi
|
||||
# If CPU 2 temperature sensor is present, check if it is overheating then apply Dell default dynamic fan control profile if true
|
||||
elif $IS_CPU2_TEMPERATURE_SENSOR_PRESENT && CPU2_OVERHEAT
|
||||
then
|
||||
apply_Dell_fan_control_profile
|
||||
|
||||
if ! $IS_DELL_FAN_CONTROL_PROFILE_APPLIED
|
||||
then
|
||||
IS_DELL_FAN_CONTROL_PROFILE_APPLIED=true
|
||||
COMMENT="CPU 2 temperature is too high, Dell default dynamic fan control profile applied for safety"
|
||||
fi
|
||||
else
|
||||
# Adjust fan speed based on temperature thresholds
|
||||
for i in ${!TEMP_THRESHOLDS[@]}; do
|
||||
if [ $CPU1_TEMPERATURE -le ${TEMP_THRESHOLDS[$i]} ]; then
|
||||
set_fan_speed ${FAN_SPEEDS[$i]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Si la température est supérieure à tous les seuils, définir la vitesse maximale
|
||||
if [ $CPU1_TEMPERATURE -gt ${TEMP_THRESHOLDS[-1]} ]; then
|
||||
set_fan_speed ${FAN_SPEEDS[-1]}
|
||||
fi
|
||||
|
||||
|
||||
# Check if user fan control profile is applied then apply it if not
|
||||
if $IS_DELL_FAN_CONTROL_PROFILE_APPLIED
|
||||
then
|
||||
IS_DELL_FAN_CONTROL_PROFILE_APPLIED=false
|
||||
COMMENT="CPU temperature decreased and is now OK (<= $CPU_TEMPERATURE_THRESHOLD°C), user's fan control profile applied."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Enable or disable, depending on the user's choice, third-party PCIe card Dell default cooling response
|
||||
# No comment will be displayed on the change of this parameter since it is not related to the temperature of any device (CPU, GPU, etc...) but only to the settings made by the user when launching this Docker container
|
||||
if $DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE
|
||||
then
|
||||
disable_third_party_PCIe_card_Dell_default_cooling_response
|
||||
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Disabled"
|
||||
else
|
||||
enable_third_party_PCIe_card_Dell_default_cooling_response
|
||||
THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS="Enabled"
|
||||
fi
|
||||
|
||||
# Print temperatures, active fan control profile and comment if any change happened during last time interval
|
||||
if [ $i -eq $TABLE_HEADER_PRINT_INTERVAL ]
|
||||
then
|
||||
echo " ------- Temperatures -------"
|
||||
echo " Date & time Inlet CPU 1 CPU 2 Exhaust Active fan speed profile Third-party PCIe card Dell default cooling response Comment"
|
||||
i=0
|
||||
fi
|
||||
printf "%19s %3d°C %3d°C %3s°C %5s°C %40s %51s %s\n" "$(date +"%d-%m-%Y %T")" $INLET_TEMPERATURE $CPU1_TEMPERATURE "$CPU2_TEMPERATURE" "$EXHAUST_TEMPERATURE" "$CURRENT_FAN_CONTROL_PROFILE" "$THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE_STATUS" "$COMMENT"
|
||||
((i++))
|
||||
wait $SLEEP_PROCESS_PID
|
||||
done
|
||||
Reference in New Issue
Block a user