From b0d133b3931295c12421e56b798e5deb3a83a060 Mon Sep 17 00:00:00 2001 From: rpm-build Date: Thu, 7 Dec 2023 15:00:05 +0800 Subject: [PATCH] fix HealthSMART parameter check --- agents/ocf/HealthSMART.in | 41 ++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/agents/ocf/HealthSMART.in b/agents/ocf/HealthSMART.in index b6edac2..3b15339 100755 --- a/agents/ocf/HealthSMART.in +++ b/agents/ocf/HealthSMART.in @@ -136,29 +136,30 @@ END ####################################################################### check_temperature() { + if [ -n "$1" ]; then + if [ $1 -lt ${lower_red_limit} ] ; then + ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C" + attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + return 1 + fi - if [ $1 -lt ${lower_red_limit} ] ; then - ocf_log info "Drive ${DRIVE} ${DEVICE} too cold: ${1} C" - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" - return 1 - fi - - if [ $1 -gt ${upper_red_limit} ] ; then - ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C" - attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" - return 1 - fi + if [ $1 -gt ${upper_red_limit} ] ; then + ocf_log info "Drive ${DRIVE} ${DEVICE} too hot: ${1} C" + attrd_updater -n "#health-smart" -U "red" -d "${OCF_RESKEY_dampen}" + return 1 + fi - if [ $1 -lt ${lower_yellow_limit} ] ; then - ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C" - attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" - return 1 - fi + if [ $1 -lt ${lower_yellow_limit} ] ; then + ocf_log info "Drive ${DRIVE} ${DEVICE} quite cold: ${1} C" + attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" + return 1 + fi - if [ $1 -gt ${upper_yellow_limit} ] ; then - ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C" - attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" - return 1 + if [ $1 -gt ${upper_yellow_limit} ] ; then + ocf_log info "Drive ${DRIVE} ${DEVICE} quite hot: ${1} C" + attrd_updater -n "#health-smart" -U "yellow" -d "${OCF_RESKEY_dampen}" + return 1 + fi fi } -- 2.33.0