From 9fbcd12a493853a3b549072d5966d0c7167635cd Mon Sep 17 00:00:00 2001 From: Sean Cline Date: Sun, 10 Nov 2024 20:27:43 +0100 Subject: [PATCH 1/7] Adding options for 14gen Dell servers via env var --- Dockerfile | 1 + README.md | 1 + functions.sh | 36 ++++++++++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5a1572..4c01adc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/a ENV IDRAC_HOST local # ENV IDRAC_USERNAME root # ENV IDRAC_PASSWORD calvin +ENV 14_GEN false ENV FAN_SPEED 5 ENV CPU_TEMPERATURE_THRESHOLD 50 ENV CHECK_INTERVAL 60 diff --git a/README.md b/README.md index e4f00d0..edfe99b 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ All parameters are optional as they have default values (including default iDRAC - `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. - `KEEP_THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE_STATE_ON_EXIT` parameter is a boolean that allows to keep the third-party PCIe card Dell default cooling response state upon exit. **Default** value is false, so that it resets the third-party PCIe card Dell default cooling response to Dell default. +- `14_GEN` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false.

(back to top)

diff --git a/functions.sh b/functions.sh index a0922ab..49551bc 100644 --- a/functions.sh +++ b/functions.sh @@ -38,10 +38,24 @@ function retrieve_temperatures () { # Parse CPU data local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}') - CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}') + if $14_GEN + then + # 14 Gen server or newer + CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') + else + # 13 Gen server or older + CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}') + fi if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT then - CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') + if $14_GEN + then + # 14 Gen server or newer + CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $4;}') + else + # 13 Gen server or older + CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') + fi else CPU2_TEMPERATURE="-" fi @@ -60,12 +74,26 @@ function retrieve_temperatures () { 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 + if $14_GEN + then + # 14 Gen server or newer + continue + else + # 13 Gen server or older + ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null + fi } 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 + if $14_GEN + then + # 14 Gen server or newer + continue + else + # 13 Gen server or older + ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null + fi } # Returns : From ec364b009b195e347909f0cb0fe4b77b29cd3619 Mon Sep 17 00:00:00 2001 From: Sean Cline Date: Sun, 10 Nov 2024 20:28:10 +0100 Subject: [PATCH 2/7] Cant start env variable with numbers --- Dockerfile | 2 +- README.md | 2 +- functions.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4c01adc..dcbcf92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/a ENV IDRAC_HOST local # ENV IDRAC_USERNAME root # ENV IDRAC_PASSWORD calvin -ENV 14_GEN false +ENV DELL_14_GEN false ENV FAN_SPEED 5 ENV CPU_TEMPERATURE_THRESHOLD 50 ENV CHECK_INTERVAL 60 diff --git a/README.md b/README.md index edfe99b..2d4b385 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ All parameters are optional as they have default values (including default iDRAC - `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. - `KEEP_THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE_STATE_ON_EXIT` parameter is a boolean that allows to keep the third-party PCIe card Dell default cooling response state upon exit. **Default** value is false, so that it resets the third-party PCIe card Dell default cooling response to Dell default. -- `14_GEN` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false. +- `DELL_14_GEN` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false.

(back to top)

diff --git a/functions.sh b/functions.sh index 49551bc..01e07d2 100644 --- a/functions.sh +++ b/functions.sh @@ -38,7 +38,7 @@ function retrieve_temperatures () { # Parse CPU data local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}') - if $14_GEN + if $DELL_14_GEN then # 14 Gen server or newer CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') @@ -48,7 +48,7 @@ function retrieve_temperatures () { fi if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT then - if $14_GEN + if $DELL_14_GEN then # 14 Gen server or newer CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $4;}') @@ -74,7 +74,7 @@ function retrieve_temperatures () { 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 - if $14_GEN + if $DELL_14_GEN then # 14 Gen server or newer continue @@ -86,7 +86,7 @@ function enable_third_party_PCIe_card_Dell_default_cooling_response () { 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 - if $14_GEN + if $DELL_14_GEN then # 14 Gen server or newer continue From 88548f5a37eda902d4024d73db5722c4949cf355 Mon Sep 17 00:00:00 2001 From: Sean Cline Date: Sun, 10 Nov 2024 20:28:10 +0100 Subject: [PATCH 3/7] Fixing some if not true statements --- functions.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/functions.sh b/functions.sh index 01e07d2..463e3b9 100644 --- a/functions.sh +++ b/functions.sh @@ -74,11 +74,7 @@ function retrieve_temperatures () { 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 - if $DELL_14_GEN - then - # 14 Gen server or newer - continue - else + if ! $DELL_14_GEN # 13 Gen server or older ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null fi @@ -86,11 +82,8 @@ function enable_third_party_PCIe_card_Dell_default_cooling_response () { 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 - if $DELL_14_GEN + if ! $DELL_14_GEN then - # 14 Gen server or newer - continue - else # 13 Gen server or older ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null fi From fa385ab8e82a89c05569764323982ef5fb9f64a3 Mon Sep 17 00:00:00 2001 From: Sean Cline Date: Sun, 10 Nov 2024 20:28:10 +0100 Subject: [PATCH 4/7] Missing `fi` --- functions.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/functions.sh b/functions.sh index 463e3b9..78306d1 100644 --- a/functions.sh +++ b/functions.sh @@ -75,6 +75,7 @@ function retrieve_temperatures () { 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 if ! $DELL_14_GEN + then # 13 Gen server or older ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null fi From 86155f19cf84ff6cb770132b6d5bc7112fe3969b Mon Sep 17 00:00:00 2001 From: Tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:28:27 +0100 Subject: [PATCH 5/7] Renamed variable --- Dockerfile | 2 +- README.md | 2 +- functions.sh | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index dcbcf92..97d53c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/a ENV IDRAC_HOST local # ENV IDRAC_USERNAME root # ENV IDRAC_PASSWORD calvin -ENV DELL_14_GEN false +ENV DELL_POWEREDGE_GEN_14_OR_NEWER false ENV FAN_SPEED 5 ENV CPU_TEMPERATURE_THRESHOLD 50 ENV CHECK_INTERVAL 60 diff --git a/README.md b/README.md index 2d4b385..6b7f871 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,7 @@ All parameters are optional as they have default values (including default iDRAC - `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. - `KEEP_THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE_STATE_ON_EXIT` parameter is a boolean that allows to keep the third-party PCIe card Dell default cooling response state upon exit. **Default** value is false, so that it resets the third-party PCIe card Dell default cooling response to Dell default. -- `DELL_14_GEN` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false. +- `DELL_POWEREDGE_GEN_14_OR_NEWER` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false.

(back to top)

diff --git a/functions.sh b/functions.sh index 78306d1..7d5922e 100644 --- a/functions.sh +++ b/functions.sh @@ -38,7 +38,7 @@ function retrieve_temperatures () { # Parse CPU data local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}') - if $DELL_14_GEN + if $DELL_POWEREDGE_GEN_14_OR_NEWER then # 14 Gen server or newer CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') @@ -48,7 +48,7 @@ function retrieve_temperatures () { fi if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT then - if $DELL_14_GEN + if $DELL_POWEREDGE_GEN_14_OR_NEWER then # 14 Gen server or newer CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $4;}') @@ -74,7 +74,7 @@ function retrieve_temperatures () { 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 - if ! $DELL_14_GEN + if ! $DELL_POWEREDGE_GEN_14_OR_NEWER then # 13 Gen server or older ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null @@ -83,7 +83,7 @@ function enable_third_party_PCIe_card_Dell_default_cooling_response () { 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 - if ! $DELL_14_GEN + if ! $DELL_POWEREDGE_GEN_14_OR_NEWER then # 13 Gen server or older ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null From a8c12a62c987c8fa51d314480d19931502df6af5 Mon Sep 17 00:00:00 2001 From: Tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:28:44 +0100 Subject: [PATCH 6/7] Added automatic Gen 14 + check --- Dell_iDRAC_fan_controller.sh | 8 ++++++++ Dockerfile | 1 - README.md | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dell_iDRAC_fan_controller.sh b/Dell_iDRAC_fan_controller.sh index bdad2a4..ee82949 100644 --- a/Dell_iDRAC_fan_controller.sh +++ b/Dell_iDRAC_fan_controller.sh @@ -46,6 +46,14 @@ then exit 1 fi +# If server model is Gen 14 (*40) or newer +if [[ $SERVER_MODEL =~ .*[RT][[:space:]]?[0-9][4-9]0.* ]] +then + DELL_POWEREDGE_GEN_14_OR_NEWER=true +else + DELL_POWEREDGE_GEN_14_OR_NEWER=false +fi + # Log main informations echo "Server model: $SERVER_MANUFACTURER $SERVER_MODEL" echo "iDRAC/IPMI host: $IDRAC_HOST" diff --git a/Dockerfile b/Dockerfile index 97d53c4..a5a1572 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,6 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "/a ENV IDRAC_HOST local # ENV IDRAC_USERNAME root # ENV IDRAC_PASSWORD calvin -ENV DELL_POWEREDGE_GEN_14_OR_NEWER false ENV FAN_SPEED 5 ENV CPU_TEMPERATURE_THRESHOLD 50 ENV CHECK_INTERVAL 60 diff --git a/README.md b/README.md index 6b7f871..e4f00d0 100644 --- a/README.md +++ b/README.md @@ -162,7 +162,6 @@ All parameters are optional as they have default values (including default iDRAC - `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. - `KEEP_THIRD_PARTY_PCIE_CARD_COOLING_RESPONSE_STATE_ON_EXIT` parameter is a boolean that allows to keep the third-party PCIe card Dell default cooling response state upon exit. **Default** value is false, so that it resets the third-party PCIe card Dell default cooling response to Dell default. -- `DELL_POWEREDGE_GEN_14_OR_NEWER` parameter that disabled 3rd party PCI calls and outputs CPU temperatures correctly for 14th Gen Dell servers, ex Dell r640, 740 series. Must have idrac 3.30.30.30 or older. **Default** value is false.

(back to top)

From 2a5a8a03fcf06c7af9955845aa67b7c51cf95564 Mon Sep 17 00:00:00 2001 From: Tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:28:44 +0100 Subject: [PATCH 7/7] Reduced tests occurence to improve performances --- Dell_iDRAC_fan_controller.sh | 24 ++++++++++++++++-------- functions.sh | 32 ++++++-------------------------- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/Dell_iDRAC_fan_controller.sh b/Dell_iDRAC_fan_controller.sh index ee82949..e95a264 100644 --- a/Dell_iDRAC_fan_controller.sh +++ b/Dell_iDRAC_fan_controller.sh @@ -50,8 +50,12 @@ fi if [[ $SERVER_MODEL =~ .*[RT][[:space:]]?[0-9][4-9]0.* ]] then DELL_POWEREDGE_GEN_14_OR_NEWER=true + CPU1_TEMPERATURE_INDEX=2 + CPU2_TEMPERATURE_INDEX=4 else DELL_POWEREDGE_GEN_14_OR_NEWER=false + CPU1_TEMPERATURE_INDEX=1 + CPU2_TEMPERATURE_INDEX=2 fi # Log main informations @@ -146,15 +150,19 @@ while true; do 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 + # If server model is Gen 14 (*40) or newer + if ! $DELL_POWEREDGE_GEN_14_OR_NEWER 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" + # 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 fi # Print temperatures, active fan control profile and comment if any change happened during last time interval diff --git a/functions.sh b/functions.sh index 7d5922e..1ab29ed 100644 --- a/functions.sh +++ b/functions.sh @@ -38,24 +38,10 @@ function retrieve_temperatures () { # Parse CPU data local CPU_DATA=$(echo "$DATA" | grep "3\." | grep -Po '\d{2}') - if $DELL_POWEREDGE_GEN_14_OR_NEWER - then - # 14 Gen server or newer - CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') - else - # 13 Gen server or older - CPU1_TEMPERATURE=$(echo $CPU_DATA | awk '{print $1;}') - fi + CPU1_TEMPERATURE=$(echo $CPU_DATA | awk "{print \$$CPU1_TEMPERATURE_INDEX;}") if $IS_CPU2_TEMPERATURE_SENSOR_PRESENT then - if $DELL_POWEREDGE_GEN_14_OR_NEWER - then - # 14 Gen server or newer - CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $4;}') - else - # 13 Gen server or older - CPU2_TEMPERATURE=$(echo $CPU_DATA | awk '{print $2;}') - fi + CPU2_TEMPERATURE=$(echo $CPU_DATA | awk "{print \$$CPU2_TEMPERATURE_INDEX;}") else CPU2_TEMPERATURE="-" fi @@ -72,22 +58,16 @@ function retrieve_temperatures () { fi } +# /!\ Use this function only for Gen 13 and older generation servers /!\ 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 - if ! $DELL_POWEREDGE_GEN_14_OR_NEWER - then - # 13 Gen server or older - ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null - fi + ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x00 0x00 0x00 > /dev/null } +# /!\ Use this function only for Gen 13 and older generation servers /!\ 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 - if ! $DELL_POWEREDGE_GEN_14_OR_NEWER - then - # 13 Gen server or older - ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null - fi + ipmitool -I $IDRAC_LOGIN_STRING raw 0x30 0xce 0x00 0x16 0x05 0x00 0x00 0x00 0x05 0x00 0x01 0x00 0x00 > /dev/null } # Returns :