From cf69481bbd99e9bfdd3fed260c7ec5fad138fd86 Mon Sep 17 00:00:00 2001 From: Tigerblue77 <37409593+tigerblue77@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:26:13 +0000 Subject: [PATCH] Fixed platform check which was not working in LAN mode --- Dell_iDRAC_fan_controller.sh | 24 ++++++++++++------------ functions.sh | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dell_iDRAC_fan_controller.sh b/Dell_iDRAC_fan_controller.sh index a932c9a..fcd5108 100644 --- a/Dell_iDRAC_fan_controller.sh +++ b/Dell_iDRAC_fan_controller.sh @@ -23,18 +23,6 @@ else HEXADECIMAL_FAN_SPEED=$(printf '0x%02x' $FAN_SPEED) 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" - # Check if the iDRAC host is set to 'local' or not then set the IDRAC_LOGIN_STRING accordingly if [[ $IDRAC_HOST == "local" ]] then @@ -50,6 +38,18 @@ else 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 fan speed objective, CPU temperature threshold and check interval echo "Fan speed objective: $DECIMAL_FAN_SPEED%" echo "CPU temperature threshold: $CPU_TEMPERATURE_THRESHOLD°C" diff --git a/functions.sh b/functions.sh index a70bb9c..3404859 100644 --- a/functions.sh +++ b/functions.sh @@ -86,7 +86,7 @@ function gracefull_exit () { # Helps debugging when people are posting their output function get_Dell_server_model () { - IPMI_FRU_content=$(ipmitool fru 2>/dev/null) # FRU stands for "Field Replaceable Unit" + IPMI_FRU_content=$(ipmitool -I $IDRAC_LOGIN_STRING fru 2>/dev/null) # FRU stands for "Field Replaceable Unit" SERVER_MANUFACTURER=$(echo "$IPMI_FRU_content" | grep "Product Manufacturer" | awk -F ': ' '{print $2}') SERVER_MODEL=$(echo "$IPMI_FRU_content" | grep "Product Name" | awk -F ': ' '{print $2}')