diff --git a/check_qnap_health/check_qnap_health b/check_qnap_health/check_qnap_health index 980ef63..48baa64 100644 --- a/check_qnap_health/check_qnap_health +++ b/check_qnap_health/check_qnap_health @@ -52,7 +52,7 @@ usage() { echo " -x|--privprotocol - privacy protocol (DES|AES)" echo " -X|--privpassphrase - privacy protocol pass phrase" 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 "volstatus & lunstatus checks all vols/luns and vols/lun space; powerstatus checks power supply" echo "<#> is 1-8 for hd, 1-5 for vol" @@ -305,10 +305,9 @@ function _get_exp() { *) echo "ERROR: unknown unit '$1'" ;; esac } - # Check if QNAP is online 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"; exit $EXIT_UNKNOWN; fi @@ -461,6 +460,39 @@ elif [ "$strPart" == "temp" ]; then exit $EXIT_OK 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--------------------------------------------------------------------------------------------------------------------------------------- elif [[ "$strPart" == hdtemp ]]; then