Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDD Temperature Check checks empty drive slots and exits with "unknown" #16

Open
Byolock opened this issue Sep 30, 2021 · 4 comments
Open

Comments

@Byolock
Copy link

Byolock commented Sep 30, 2021

Although the hdstatus check sucessfully detects occupied hdd slots :
grafik
the hdd temperature check is checking every slot and then exits with unknow instead of ok :
grafik

@amolettaufi
Copy link

I think there should be a check of used HDs before get the temperature of each one.
LINE 506

@amolettaufi
Copy link

At line 505, I add the check if HDs are mounted before check temperature of each one.


hdnum="$(_snmpgetval .1.3.6.1.4.1.24681.1.2.10.0)"
for (( c=1; c<=$hdnum; c++ ))
do
MOUNTEDHD="$(_snmpgetval "1.3.6.1.4.1.24681.1.2.11.1.4.$c" | sed -E 's/"([0-9.]+) ?C./\1/')"
if [[ $MOUNTEDHD -ge 0 ]]; then
TEMPHD="$(_snmpgetval "1.3.6.1.4.1.24681.1.2.11.1.3.$c" | sed -E 's/"([0-9.]+) ?C.
/\1/')"
if [[ ! $TEMPHD =~ ^-?[0-9]+$ ]]; then
if [ -n "$UnknownStr" ]; then
UnknownStr="${UnknownStr},HDD${c}"
else
UnknownStr="UNKNOWN: HD${c}"
fi
continue
fi
if [ $TEMPHD -ge $strCritical ]; then
if [ -n "$CriticalStr" ]; then
CriticalStr="${CriticalStr}, HDD${c}: ${TEMPHD}°C"
else
CriticalStr="CRITICAL: HDD${c}: ${TEMPHD}°C"
fi
elif [ $TEMPHD -ge $strWarning -a $TEMPHD -lt $strCritical ]; then
if [ -n "$WarningStr" ]; then
WarningStr="${WarningStr}, HDD${c}: ${TEMPHD}°C"
else
WarningStr="WARNING: HDD${c}: ${TEMPHD}°C"
fi
fi
if [ -n "$PERFOUTPUT" ]; then
PERFOUTPUT="${PERFOUTPUT} HDD${c}_temperature=${TEMPHD};$strWarning;$strCritical;;"
else
PERFOUTPUT="HDD${c}_temperature=${TEMPHD};$strWarning;$strCritical;;"
fi
fi
done


@Byolock
Copy link
Author

Byolock commented Nov 22, 2021

@amolettaufi Seems like i'm doing the edit wrong, after editing I don't get any performance data anymore and no warning or critical if the harddrives get to hot. Could you create a fork, make your edit and then create a pull request? Alternatively could you post all the code between
# HD# Temperature--------------------------------------------------------------------------------------------
and
# HD Status----------------------------------------------------------------------------------------------------
so I can check what i did wrong?

@amolettaufi
Copy link

I attach the modified script (remove the TXT extention before use)
Ciao.

qnap_health.txt

@amolettaufi Seems like i'm doing the edit wrong, after editing I don't get any performance data anymore and no warning or critical if the harddrives get to hot. Could you create a fork, make your edit and then create a pull request? Alternatively could you post all the code between # HD# Temperature-------------------------------------------------------------------------------------------- and # HD Status---------------------------------------------------------------------------------------------------- so I can check what i did wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants