Update check_qnap_health

This commit is contained in:
Jan Wagner 2020-10-23 13:34:34 +02:00
parent 8376586d3f
commit b052a862d5

View file

@ -52,7 +52,7 @@ usage() {
echo " -x|--privprotocol - privacy protocol (DES|AES)" echo " -x|--privprotocol - privacy protocol (DES|AES)"
echo " -X|--privpassphrase - privacy protocol pass phrase" echo " -X|--privpassphrase - privacy protocol pass phrase"
echo echo
echo "Parts are: status, sysinfo, systemuptime, temp, cpu, cputemp, freeram, powerstatus, fans, diskused, hdstatus, hdtemp, lunstatus (for iSCSI luns), volstatus (Raid Volume Status)" echo "Parts are: status, sysinfo, systemuptime, temp, cpu, cputemp, freeram, iops, latency, powerstatus, fans, diskused, hdstatus, hdtemp, lunstatus (for iSCSI luns), volstatus (Raid Volume Status)"
echo echo
echo "volstatus & lunstatus checks all vols/luns and vols/lun space; powerstatus checks power supply" echo "volstatus & lunstatus checks all vols/luns and vols/lun space; powerstatus checks power supply"
echo "<#> is 1-8 for hd, 1-5 for vol" echo "<#> is 1-8 for hd, 1-5 for vol"
@ -305,10 +305,9 @@ function _get_exp() {
*) echo "ERROR: unknown unit '$1'" ;; *) echo "ERROR: unknown unit '$1'" ;;
esac esac
} }
# Check if QNAP is online # Check if QNAP is online
TEST="$(_snmpstatus -t $timeout -r 0 2>&1)" TEST="$(_snmpstatus -t $timeout -r 0 2>&1)"
if [ "$TEST" == "Timeout: No Response from $strHostname" ]; then if [ "$TEST" == "Timeout: No Response from $strHostname:$strPort" ]; then
echo "UNKOWN: SNMP to $strHostname is not available or wrong community string"; echo "UNKOWN: SNMP to $strHostname is not available or wrong community string";
exit $EXIT_UNKNOWN; exit $EXIT_UNKNOWN;
fi fi
@ -461,6 +460,39 @@ elif [ "$strPart" == "temp" ]; then
exit $EXIT_OK exit $EXIT_OK
fi fi
# Disk IOPS ----------------------------------------------------------------------------------------------------------------------------------------------
elif [ "$strpart" == "iops" ]; then
IOPS=$(_snmpgetval 1.3.6.1.4.1.24681.1.4.1.11.5.6.2.1.3.1 | sed -E 's/"|\s%//g')
OUTPUT="IOPS="$IOPS"|IOPS="$IOPS";$strWarning;$strCritical;0;100"
if (( $(echo "$IOPS > $strCritical" | bc -l) )); then
echo "CRITICAL: $OUTPUT"
exit $EXIT_CRITICAL
elif (( $(echo "$IOPS > $strWarning" | bc -l) )); then
echo "WARNING: $OUTPUT"
exit $EXIT_WARNING
else
echo "OK: $OUTPUT"
exit $EXIT_OK
fi
# Disk Latency ----------------------------------------------------------------------------------------------------------------------------------------------
elif [ "$strpart" == "latency" ]; then
LATENCY=$(_snmpgetval 1.3.6.1.4.1.24681.1.4.1.11.5.6.2.1.4.1 | sed -E 's/"|\s%//g')
OUTPUT="Latency="$LATENCY"|Latency="$LATENCY";$strWarning;$strCritical;0;100"
if (( $(echo "$LATENCY > $strCritical" | bc -l) )); then
echo "CRITICAL: $OUTPUT"
exit $EXIT_CRITICAL
elif (( $(echo "$LATENCY > $strWarning" | bc -l) )); then
echo "WARNING: $OUTPUT"
exit $EXIT_WARNING
else
echo "OK: $OUTPUT"
exit $EXIT_OK
fi
# HD# Temperature--------------------------------------------------------------------------------------------------------------------------------------- # HD# Temperature---------------------------------------------------------------------------------------------------------------------------------------
elif [[ "$strPart" == hdtemp ]]; then elif [[ "$strPart" == hdtemp ]]; then