diff --git a/functions.sh b/functions.sh index ae1c1af..a25cbaa 100644 --- a/functions.sh +++ b/functions.sh @@ -237,6 +237,11 @@ function graceful_exit() { function get_Dell_server_model() { IPMI_FRU_content=$(ipmitool -I $IDRAC_LOGIN_STRING fru 2>/dev/null) # FRU stands for "Field Replaceable Unit" + if [ $? -ne 0 ]; then + echo "Failed to retrieve iDRAC data, please check IP and credentials." >&2 + return + fi + 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}')