Compare commits

..

57 Commits

Author SHA1 Message Date
Tigerblue77
dcf41e0cdc
Update README.md 2023-03-05 21:17:13 +01:00
Tigerblue77
0a5430d65e Fixed a typo in "threshold" word 2023-03-05 14:08:27 +00:00
Tigerblue77
916d454c6d Improved .dockerignore 2023-03-04 18:46:05 +00:00
Tigerblue77
9e968bd982 Added .devcontainer.json 2023-03-04 18:44:37 +00:00
Tigerblue77
c49676b14f Minor improvement of GitHub CI 2023-03-04 18:42:21 +00:00
Tigerblue77
182f0cc890 Removed bash strict mode that was stopping the container on some setups 2023-03-01 08:33:01 +00:00
Tigerblue77
1ed2309c5b
Merge pull request #45 from soxguy/feature/fix_increment
Bug in loop counter
2023-02-19 16:04:23 +01:00
Adam Wheat
4141f049fa This increment fails because of
set -euo pipefail.  Using ((++i))
evaluates after the increment and works
2023-02-19 09:41:12 -05:00
Tigerblue77
f8cfad314e Minor improvment suggested by ChatGPT <3 2023-02-17 20:09:02 +00:00
Tigerblue77
f03b57725e
Update README.md 2023-02-06 16:21:00 +01:00
Tigerblue77
c9a0953252
Merge pull request #40 from tigerblue77/24-support-the-absence-of-cpu2-and-exhaust-temperature-sensors
Added conditions in case of second CPU or exhaust sensor absence
2023-02-04 23:26:23 +01:00
Tigerblue77
5b37fbb30a
Update README.md 2023-02-04 21:34:30 +01:00
Tigerblue77
492552368c Added conditions in case of second CPU or exhaust sensor absence 2023-02-04 14:19:20 +00:00
Tigerblue77
8369277107
Merge pull request #41 from tigerblue77/5-the-container-fails-silently-when-used-with-local-idrac-without-specifying-the-ipmi-device
Added IPMI device presence check in local mode
2023-02-04 15:17:24 +01:00
Tigerblue77
c30bbad7fe Added IPMI device presence check in local mode 2023-02-04 14:14:20 +00:00
Tigerblue77
9f320e5e0e
Add comments for clarity + minor improvements (#39)
* Added comments for clarity.

* Updated comments

* Update Dell_iDRAC_fan_controller.sh

* Added more comments

* Improved PR

---------

Co-authored-by: Ryan Bush <20880666+rpbush@users.noreply.github.com>
2023-02-04 13:09:27 +01:00
Tigerblue77
a3f070f1b4
Update README.md 2023-02-03 10:43:01 +01:00
Tigerblue77
42e8431898
Merge pull request #37 from tigerblue77/32-update-repository-actions-to-deploy-this-docker-image-on-ghcr-github-containers-registry-in-addition-to-the-docker-hub
Improved docker-image.yml to also deploy Docker image to ghcr.io
2023-02-03 09:56:35 +01:00
Tigerblue77
4afcd35b3a Improved docker-image.yml to also deploy Docker image to ghcr.io 2023-02-03 08:54:20 +00:00
Tigerblue77
acd1043fed
Update README.md 2023-02-02 21:27:39 +01:00
Tigerblue77
9e12fdc225
Merge pull request #35 from tigerblue77/23-add-the-ability-to-disable-the-third-party-pcie-card-default-cooling
Added option to disable third-party PCIe card default cooling response
2023-02-02 20:25:26 +01:00
Louis
f1c47b0a69
Added option to disable third-party PCIe card default cooling response (#33) 2023-02-02 20:22:02 +01:00
Tigerblue77
7ecfa09f99 Update docker-image.yml 2023-02-02 15:49:23 +00:00
Tigerblue77
83c56c30bf
Added "troubleshooting" section to README.md 2023-02-02 16:30:53 +01:00
Tigerblue77
f46a90cfe4 Minor improvments 2023-02-01 22:07:15 +01:00
Tigerblue77
857a3b3fbc
Update README.md 2023-01-16 16:27:19 +01:00
Tigerblue77
7c74e7870e Adding the prerequisite to use IPMI over LAN to README file 2023-01-01 14:43:03 +01:00
Tigerblue77
c1145cb37b Fixed and improved README file 2022-08-28 15:00:41 +02:00
Tigerblue77
19574dacee Added comment 2022-07-10 16:31:51 +02:00
Tigerblue77
45b2af3e92 Docker MAINTENER instruction is deprecated in favor of LABEL 2022-07-10 15:04:15 +02:00
Tigerblue77
f90bb85b8f
Update README.md 2022-04-24 17:51:17 +02:00
Tigerblue77
16010ee176
Merge pull request #22 from tigerblue77/21-move-the-sleep-to-the-beginning-of-the-execution-loop-to-ensure-a-more-regular-and-punctual-execution
Move the sleep to the beginning of the execution loop to ensure a more regular and punctual execution
2022-04-14 15:21:10 +02:00
tigerblue77
e7458fca33 Move the sleep to the beginning of the execution loop to ensure a more regular and punctual execution 2022-04-14 15:20:09 +02:00
Tigerblue77
027db15e9b
Merge pull request #20 from tigerblue77/19-throw-away-ipmitool-commands-output-to-avoid-new-line-in-docker-logs
Throw away ipmitool command's output to avoid new line in Docker logs
2022-04-14 15:18:08 +02:00
tigerblue77
9cd6d37b6e Throw away ipmitool command's output to avoid new line in Docker logs 2022-04-14 15:17:13 +02:00
tigerblue77
ee5568cc99 Little fix in Dockerfile 2022-04-14 15:11:51 +02:00
Tigerblue77
ebbca91846
Update docker-image.yml 2022-04-13 15:44:11 +02:00
Tigerblue77
c391492768
Update docker-image.yml 2022-04-13 15:42:44 +02:00
Tigerblue77
87eb51a22a
Update docker-image.yml 2022-04-13 15:41:49 +02:00
Tigerblue77
0c5c201004
Update docker-image.yml 2022-04-13 15:26:22 +02:00
Tigerblue77
16d17fa6a9
Update docker-image.yml 2022-04-13 15:20:02 +02:00
Tigerblue77
74ac974e4e
Update docker-image.yml 2022-04-13 15:18:26 +02:00
Tigerblue77
6b775c4d03
Update README.md 2022-04-13 15:14:47 +02:00
Tigerblue77
3ff391a444
Delete update.sh 2022-04-13 15:13:52 +02:00
Tigerblue77
89390c0221
Delete publish.sh 2022-04-13 15:13:39 +02:00
Tigerblue77
bd273f7e39
Update README.md 2022-04-13 15:12:41 +02:00
Tigerblue77
3421ced8d1
Update docker-image.yml 2022-04-13 14:39:06 +02:00
Tigerblue77
7b0b894823
Update README.md 2022-04-13 14:00:48 +02:00
Tigerblue77
d7509d19d7
Update README.md 2022-04-13 13:58:22 +02:00
Tigerblue77
84c4741a9d
Merge pull request #17 from tigerblue77/10-the-controller-should-rollback-to-default-dynamic-fan-control-when-stoppedexited-in-order-to-protect-the-server-from-overheat
Added gracefull exit function with trap of SIGQUIT, SIGTERM and SIGKILL
2022-04-13 13:55:41 +02:00
tigerblue77
ce84e2cbed Added gracefull exit function with trap of SIGQUIT, SIGTERM and SIGKILL 2022-04-13 13:53:37 +02:00
Tigerblue77
3db2083f1f
Create docker-image.yml 2022-04-13 12:54:25 +02:00
Tigerblue77
424cbbe0e2
Merge pull request #16 from tigerblue77/13-improve-console-output
Docker logs display modified in table form to be more intuitive and synthetic
2022-04-13 12:53:28 +02:00
tigerblue77
fb9f175092 Docker logs display modified in table form to be more intuitive and synthetic 2022-04-13 12:50:35 +02:00
Tigerblue77
0233dbf964
Merge pull request #15 from tigerblue77/14-remove-usage-of-crontab
Remove usage of crontab
2022-04-12 19:03:39 +02:00
tigerblue77
37c1089fc5 Remove usage of CRONTAB 2022-04-12 18:55:39 +02:00
Tigerblue77
6d6753b38e
Merge pull request #12 from tigerblue77/9-the-controller-should-not-monitor-inlet-temperature-but-cpus-temperatures
Monitoring CPUs temperature instead of inlet temperature
2022-04-12 16:16:35 +02:00
11 changed files with 450 additions and 133 deletions

View File

@ -0,0 +1,12 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"mhutchie.git-graph"
]
}
}
}

View File

@ -1,2 +1,3 @@
publish.sh .github
.devcontainer
README.md README.md

View File

@ -0,0 +1,57 @@
name: Docker image CI
on:
push:
branches: [ master ]
paths-ignore:
- '**/README.md'
jobs:
build:
name: Build and publish Docker image to Docker Hub and GitHub Containers Repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Remove "_Docker" suffix from GitHub repository name to use it as image name
uses: mad9000/actions-find-and-replace-string@3
id: docker_image_name
with:
source: ${{ github.repository }}
find: '_Docker'
replace: ''
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ steps.docker_image_name.outputs.value }}
ghcr.io/${{ steps.docker_image_name.outputs.value }}
tags: type=raw,value=latest
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and publish Docker image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -0,0 +1,237 @@
#!/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
# Define global functions
# This function applies Dell's default dynamic fan control profile
function apply_Dell_fan_control_profile () {
# Use ipmitool to send the raw command to set fan control to Dell default
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0x30 0x01 0x01 > /dev/null
CURRENT_FAN_CONTROL_PROFILE="Dell default dynamic fan control profile"
}
# This function applies a user-specified static fan control profile
function apply_user_fan_control_profile () {
# Use ipmitool to send the raw command to set fan control to user-specified value
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0x30 0x01 0x00 > /dev/null
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0x30 0x02 0xff $HEXADECIMAL_FAN_SPEED > /dev/null
CURRENT_FAN_CONTROL_PROFILE="User static fan control profile ($DECIMAL_FAN_SPEED%)"
}
# Retrieve temperature sensors data using ipmitool
# Usage : retrieve_temperatures $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
function retrieve_temperatures () {
if (( $# != 2 ))
then
printf "Illegal number of parameters.\nUsage: retrieve_temperatures \$IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT \$IS_CPU2_TEMPERATURE_SENSOR_PRESENT" >&2
return 1
fi
local IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT=$1
local IS_CPU2_TEMPERATURE_SENSOR_PRESENT=$2
local DATA=$(ipmitool -I $IDRAC_LOGIN_STRING sdr type temperature | grep degrees)
# Parse CPU data
local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}')
CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}')
if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT
then
CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}')
else
CPU2_TEMPERATURE="-"
fi
# Parse inlet temperature data
INLET_TEMPERATURE=$(echo "$DATA" | grep Inlet | grep -Po '\d{2}' | tail -1)
# If exhaust temperature sensor is present, parse its temperature data
if $IS_EXHAUST_TEMPERATURE_SENSOR_PRESENT
then
EXHAUST_TEMPERATURE=$(echo "$DATA" | grep Exhaust | grep -Po '\d{2}' | tail -1)
else
EXHAUST_TEMPERATURE="-"
fi
}
function enable_third_party_PCIe_card_Dell_default_cooling_response () {
# We could check the current cooling response before applying but it's not very useful so let's skip the test and apply directly
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null
}
function disable_third_party_PCIe_card_Dell_default_cooling_response () {
# We could check the current cooling response before applying but it's not very useful so let's skip the test and apply directly
ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null
}
# Returns :
# - 0 if third-party PCIe card Dell default cooling response is currently DISABLED
# - 1 if third-party PCIe card Dell default cooling response is currently ENABLED
# - 2 if the current status returned by ipmitool command output is unexpected
# function is_third_party_PCIe_card_Dell_default_cooling_response_disabled() {
# THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE=$(ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x01 0x16 0x05 0x00 0x00 0x00)
# if [ "$THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE" == "16 05 00 00 00 05 00 01 00 00" ]; then
# return 0
# elif [ "$THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE" == "16 05 00 00 00 05 00 00 00 00" ]; then
# return 1
# else
# echo "Unexpected output: $THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE" >&2
# return 2
# fi
# }
# Prepare traps in case of container exit
function gracefull_exit () {
apply_Dell_fan_control_profile
enable_third_party_PCIe_card_Dell_default_cooling_response
echo "/!\ WARNING /!\ Container stopped, Dell default dynamic fan control profile applied for safety."
exit 0
}
# 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
# Check if FAN_SPEED variable is in hexadecimal format. If not, convert it to hexadecimal
if [[ $FAN_SPEED == 0x* ]]
then
DECIMAL_FAN_SPEED=$(printf '%d' $FAN_SPEED)
HEXADECIMAL_FAN_SPEED=$FAN_SPEED
else
DECIMAL_FAN_SPEED=$FAN_SPEED
HEXADECIMAL_FAN_SPEED=$(printf '0x%02x' $FAN_SPEED)
fi
# Log main informations given to the container
echo "iDRAC/IPMI host: $IDRAC_HOST"
# 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
# Log the fan speed objective, CPU temperature threshold and check interval
echo "Fan speed objective: $DECIMAL_FAN_SPEED%"
echo "CPU temperature threshold: $CPU_TEMPERATURE_THRESHOLD°C"
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
apply_user_fan_control_profile
# 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

View File

@ -1,31 +1,23 @@
FROM ubuntu:latest FROM ubuntu:latest
LABEL org.opencontainers.image.authors="tigerblue77"
RUN apt-get update RUN apt-get update
RUN apt-get install ipmitool cron -y RUN apt-get install ipmitool -y
COPY crontab /etc/cron.d/dell_idrac_fan_control ADD Dell_iDRAC_fan_controller.sh /Dell_iDRAC_fan_controller.sh
RUN chmod 0777 /etc/cron.d/dell_idrac_fan_control RUN chmod 0777 /Dell_iDRAC_fan_controller.sh
RUN touch /var/log/cron.log
ADD check_temp.sh /opt/check_temp.sh
ADD startup.sh /startup.sh
RUN chmod 0777 /opt/check_temp.sh
RUN chmod 0777 /startup.sh
RUN /usr/bin/crontab /etc/cron.d/dell_idrac_fan_control
# you should override these default values when running. See README.md # you should override these default values when running. See README.md
#ENV IDRAC_HOST 192.168.1.100 #ENV IDRAC_HOST 192.168.1.100
ENV IDRAC_HOST local ENV IDRAC_HOST local
#ENV IDRAC_USER root #ENV IDRAC_USERNAME root
#ENV IDRAC_PASSWORD calvin #ENV IDRAC_PASSWORD calvin
ENV FAN_SPEED 5 ENV FAN_SPEED 5
ENV CPU_TEMPERATURE_TRESHOLD 50 ENV CPU_TEMPERATURE_THRESHOLD 50
ENV CHECK_INTERVAL 60
ENV DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE false
CMD /startup.sh && /opt/check_temp.sh && cron && tail -f /var/log/cron.log CMD ["/Dell_iDRAC_fan_controller.sh"]

159
README.md
View File

@ -1,22 +1,78 @@
# IDRAC Fan Controller Docker Image <div id="top"></div>
- `IDRAC_HOST` parameter can be set to "local" or to your distant iDRAC's IP address. Default value is "local". > **Warning** If you update to the latest version, be sure to replace "CPU_TEMPERATURE_TRESHOLD" environment variable with "CPU_TEMPERATURE_T<ins>H</ins>RESHOLD" which was a typo
- `IDRAC_USERNAME` parameter is only necessary if you're adressing a distant iDRAC. Default value is "root".
- `IDRAC_PASSWORD` parameter is only necessary if you're adressing a distant iDRAC. Default value is "calvin".
- `FAN_SPEED` parameter can be set as a decimal (from 0 to 100%) or hexadecimal value (from 0x00 to 0x64) you want to set the fans to. Default value is 5(%).
- `CPU_TEMPERATURE_TRESHOLD` parameter is the T°junction (junction temperature) threshold beyond which the Dell fan mode defined in your BIOS will become active again (to protect the server hardware against overheat). Default value is 50(°C).
To use: # Dell iDRAC fan controller Docker image
Download Docker image from :
- [Docker Hub](https://hub.docker.com/r/tigerblue77/dell_idrac_fan_controller)
- [GitHub Containers Repository](https://github.com/tigerblue77/Dell_iDRAC_fan_controller_Docker/pkgs/container/dell_idrac_fan_controller)
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li><a href="#container-console-log-example">Container console log example</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#parameters">Parameters</a></li>
<li><a href="#troubleshooting">Troubleshooting</a></li>
<li><a href="#contributing">Contributing</a></li>
</ol>
</details>
## Container console log example
![image](https://user-images.githubusercontent.com/37409593/216442212-d2ad7ff7-0d6f-443f-b8ac-c67b5f613b83.png)
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- PREREQUISITES -->
## Prerequisites
### iDRAC version
This Docker container only works on Dell PowerEdge servers that support IPMI commands, i.e. < iDRAC 9 firmware 3.30.30.30.
### To access iDRAC over LAN (not needed in "local" mode) :
1. Log into your iDRAC web console
![001](https://user-images.githubusercontent.com/37409593/210168273-7d760e47-143e-4a6e-aca7-45b483024139.png)
2. In the left side menu, expand "iDRAC settings", click "Network" then click "IPMI Settings" link at the top of the web page.
![002](https://user-images.githubusercontent.com/37409593/210168249-994f29cc-ac9e-4667-84f7-07f6d9a87522.png)
3. Check the "Enable IPMI over LAN" checkbox then click "Apply" button.
![003](https://user-images.githubusercontent.com/37409593/210168248-a68982c4-9fe7-40e7-8b2c-b3f06fbfee62.png)
4. Test access to IPMI over LAN running the following commands :
```bash
apt -y install ipmitool
ipmitool -I lanplus \
-H <iDRAC IP address> \
-U <iDRAC username> \
-P <iDRAC password> \
sdr elist all
```
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- USAGE -->
## Usage
1. with local iDRAC: 1. with local iDRAC:
```bash ```bash
docker run -d \ docker run -d \
--name Dell_iDRAC_fan_controller \ --name Dell_iDRAC_fan_controller \
--restart unless-stopped \ --restart=unless-stopped \
-e FAN_SPEED=<dec or hex fan speed> \ -e IDRAC_HOST=local \
-e CPU_TEMPERATURE_TRESHOLD=<dec temp treshold> \ -e FAN_SPEED=<decimal or hexadecimal fan speed> \
alombardo4/idrac-fan-control:latest -e CPU_TEMPERATURE_THRESHOLD=<decimal temperature threshold> \
-e CHECK_INTERVAL=<seconds between each check> \
-e DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false> \
--device=/dev/ipmi0:/dev/ipmi0:rw \
tigerblue77/dell_idrac_fan_controller:latest
``` ```
2. with LAN iDRAC: 2. with LAN iDRAC:
@ -24,13 +80,15 @@ docker run -d \
```bash ```bash
docker run -d \ docker run -d \
--name Dell_iDRAC_fan_controller \ --name Dell_iDRAC_fan_controller \
--restart unless-stopped \ --restart=unless-stopped \
-e IDRAC_HOST=<iDRAC host IP> \ -e IDRAC_HOST=<iDRAC IP address> \
-e IDRAC_USERNAME=<iDRAC username> \ -e IDRAC_USERNAME=<iDRAC username> \
-e IDRAC_PASSWORD=<iDRAC password> \ -e IDRAC_PASSWORD=<iDRAC password> \
-e FAN_SPEED=<dec or hex fan speed> \ -e FAN_SPEED=<decimal or hexadecimal fan speed> \
-e CPU_TEMPERATURE_TRESHOLD=<dec temp treshold> \ -e CPU_TEMPERATURE_THRESHOLD=<decimal temperature threshold> \
alombardo4/idrac-fan-control:latest -e CHECK_INTERVAL=<seconds between each check> \
-e DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false> \
tigerblue77/dell_idrac_fan_controller:latest
``` ```
`docker-compose.yml` examples: `docker-compose.yml` examples:
@ -42,15 +100,17 @@ version: '3'
services: services:
Dell_iDRAC_fan_controller: Dell_iDRAC_fan_controller:
image: alombardo4/idrac-fan-control image: tigerblue77/dell_idrac_fan_controller:latest
container_name: Dell_iDRAC_fan_controller container_name: Dell_iDRAC_fan_controller
restart: unless-stopped restart: unless-stopped
environment: environment:
- IDRAC_HOST=local # can be omitted as it is the default value - IDRAC_HOST=local
- FAN_SPEED=0x05 # set to the decimal or hexadecimal value you want to set the fans to (from 0 to 100%) - FAN_SPEED=<decimal or hexadecimal fan speed>
- CPU_TEMPERATURE_TRESHOLD=<dec temp treshold> - CPU_TEMPERATURE_THRESHOLD=<decimal temperature threshold>
- CHECK_INTERVAL=<seconds between each check>
- DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false>
devices: devices:
- /dev/ipmi0:/dev/ipmi0 - /dev/ipmi0:/dev/ipmi0:rw
``` ```
2. to use with LAN iDRAC: 2. to use with LAN iDRAC:
@ -60,13 +120,58 @@ version: '3'
services: services:
Dell_iDRAC_fan_controller: Dell_iDRAC_fan_controller:
image: alombardo4/idrac-fan-control image: tigerblue77/dell_idrac_fan_controller:latest
container_name: Dell_iDRAC_fan_controller container_name: Dell_iDRAC_fan_controller
restart: unless-stopped restart: unless-stopped
environment: environment:
- IDRAC_HOST=192.168.1.100 # override to the IP address of your IDRAC - IDRAC_HOST=<iDRAC IP address>
- IDRAC_USERNAME=root # set to your IPMI username - IDRAC_USERNAME=<iDRAC username>
- IDRAC_PASSWORD=calvin # set to your IPMI password - IDRAC_PASSWORD=<iDRAC password>
- FAN_SPEED=0x05 # set to the decimal or hexadecimal value you want to set the fans to (from 0 to 100%) - FAN_SPEED=<decimal or hexadecimal fan speed>
- CPU_TEMPERATURE_TRESHOLD=<dec temp treshold> - CPU_TEMPERATURE_THRESHOLD=<decimal temperature threshold>
- CHECK_INTERVAL=<seconds between each check>
- DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE=<true or false>
``` ```
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- PARAMETERS -->
## Parameters
All parameters are optional as they have default values (including default iDRAC username and password).
- `IDRAC_HOST` parameter can be set to "local" or to your distant iDRAC's IP address. **Default** value is "local".
- `IDRAC_USERNAME` parameter is only necessary if you're adressing a distant iDRAC. **Default** value is "root".
- `IDRAC_PASSWORD` parameter is only necessary if you're adressing a distant iDRAC. **Default** value is "calvin".
- `FAN_SPEED` parameter can be set as a decimal (from 0 to 100%) or hexadecimaladecimal value (from 0x00 to 0x64) you want to set the fans to. **Default** value is 5(%).
- `CPU_TEMPERATURE_THRESHOLD` parameter is the T°junction (junction temperature) threshold beyond which the Dell fan mode defined in your BIOS will become active again (to protect the server hardware against overheat). **Default** value is 50(°C).
- `CHECK_INTERVAL` parameter is the time (in seconds) between each temperature check and potential profile change. **Default** value is 60(s).
- `DISABLE_THIRD_PARTY_PCIE_CARD_DELL_DEFAULT_COOLING_RESPONSE` parameter is a boolean that allows to disable third-party PCIe card Dell default cooling response. **Default** value is false.
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- TROUBLESHOOTING -->
## Troubleshooting
If your server frequently switches back to the default Dell fan mode:
1. Check `Tcase` (case temperature) of your CPU on Intel Ark website and then set `CPU_TEMPERATURE_THRESHOLD` to a slightly lower value. Example with my CPUs ([Intel Xeon E5-2630L v2](https://www.intel.com/content/www/us/en/products/sku/75791/intel-xeon-processor-e52630l-v2-15m-cache-2-40-ghz/specifications.html)) : Tcase = 63°C, I set `CPU_TEMPERATURE_THRESHOLD` to 60(°C).
2. If it's already good, adapt your `FAN_SPEED` value to increase the airflow and thus further decrease the temperature of your CPU(s)
3. If neither increasing the fan speed nor increasing the threshold solves your problem, then it may be time to replace your thermal paste
<p align="right">(<a href="#top">back to top</a>)</p>
<!-- CONTRIBUTING -->
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
<p align="right">(<a href="#top">back to top</a>)</p>

View File

@ -1,56 +0,0 @@
#!/bin/bash
IPMI_HOST=`cat /idrac_host.txt`
IPMI_USERNAME=`cat /idrac_username.txt`
IPMI_PASSWORD=`cat /idrac_password.txt`
DECIMAL_FAN_SPEED=`cat /decimal_fan_speed.txt`
HEXADECIMAL_FAN_SPEED=`cat /hexadecimal_fan_speed.txt`
CPU_TEMPERATURE_TRESHOLD=`cat /cpu_temperature_treshold.txt`
readonly DELL_FRESH_AIR_COMPLIANCE=45
if [[ $IPMI_HOST == "local" ]]
then
LOGIN_STRING='open'
else
LOGIN_STRING="lanplus -H $IPMI_HOST -U $IPMI_USERNAME -P $IPMI_PASSWORD"
fi
DATA=$(ipmitool -I $LOGIN_STRING sdr type temperature | grep degrees)
INLET_TEMPERATURE=$(echo "$DATA" | grep Inlet | grep -Po '\d{2}' | tail -1)
EXHAUST_TEMPERATURE=$(echo "$DATA" | grep Exhaust | grep -Po '\d{2}' | tail -1)
CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}')
CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}')
CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}')
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo "------------------------------------"
echo "Current"
echo "- inlet temperature is $INLET_TEMPERATURE°C"
echo "- CPU 1 temperature is $CPU1_TEMPERATURE°C"
echo "- CPU 2 temperature is $CPU2_TEMPERATURE°C"
echo "- Exhaust temperature is $EXHAUST_TEMPERATURE°C"
CPU1_OVERHEAT () { [ $CPU1_TEMPERATURE -gt $CPU_TEMPERATURE_TRESHOLD ]; }
CPU2_OVERHEAT () { [ $CPU2_TEMPERATURE -gt $CPU_TEMPERATURE_TRESHOLD ]; }
if CPU1_OVERHEAT
then
if CPU2_OVERHEAT
then
printf "CPU 1 and CPU 2 temperatures are ${RED}too high${NC}. Activating default dynamic fan control."
else
printf "CPU 1 temperature is ${RED}too high${NC}. Activating default dynamic fan control."
fi
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x01
elif CPU2_OVERHEAT
then
printf "CPU 2 temperature is ${RED}too high${NC}. Activating default dynamic fan control."
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x01
else
printf "CPUs temperatures are ${GREEN}OK${NC}. Using manual fan control with ${DECIMAL_FAN_SPEED}%% fan speed."
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x01 0x00
ipmitool -I $LOGIN_STRING raw 0x30 0x30 0x02 0xff $HEXADECIMAL_FAN_SPEED
fi

View File

@ -1 +0,0 @@
* * * * * /bin/bash -c "/opt/check_temp.sh &> /var/log/cron.log"

View File

@ -1,2 +0,0 @@
docker build . -t alombardo4/idrac-fan-control:latest && \
docker push alombardo4/idrac-fan-control

View File

@ -1,27 +0,0 @@
#!/bin/bash
echo $IDRAC_HOST >> /idrac_host.txt
echo $IDRAC_USERNAME >> /idrac_username.txt
echo $IDRAC_PASSWORD >> /idrac_password.txt
if [[ $FAN_SPEED == 0x* ]]
then
DECIMAL_FAN_SPEED=$(printf '%d' $FAN_SPEED)
HEXADECIMAL_FAN_SPEED=$FAN_SPEED
else
DECIMAL_FAN_SPEED=$FAN_SPEED
HEXADECIMAL_FAN_SPEED=$(printf '0x%02x' $FAN_SPEED)
fi
echo $DECIMAL_FAN_SPEED >> /decimal_fan_speed.txt
echo $HEXADECIMAL_FAN_SPEED >> /hexadecimal_fan_speed.txt
echo $CPU_TEMPERATURE_TRESHOLD >> /cpu_temperature_treshold.txt
echo "Idrac/IPMI host: `cat /idrac_host.txt`"
if [[ $IDRAC_HOST != "local" ]]
then
echo "Idrac/IPMI user: `cat /idrac_username.txt`"
echo "Idrac/IPMI password: `cat /idrac_password.txt`"
fi
echo "Fan speed objective: `cat /decimal_fan_speed.txt`%"
echo "CPU temperature treshold: `cat /cpu_temperature_treshold.txt`°C"

View File

@ -1 +0,0 @@
docker build -t alombardo4/idrac6-fan-control:1.0.2 . && docker push alombardo4/idrac6-fan-control:1.0.2