nagios/diskstats: status unknown when device not found
This commit is contained in:
parent
f5f7727c5b
commit
70c9730237
1 changed files with 14 additions and 0 deletions
|
@ -71,6 +71,7 @@ fi
|
||||||
while getopts hd:i:I: OPT; do
|
while getopts hd:i:I: OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
'd')
|
'd')
|
||||||
|
DEVICE_FOUND=0
|
||||||
while read \
|
while read \
|
||||||
MAJOR MINOR DEVICE_NAME \
|
MAJOR MINOR DEVICE_NAME \
|
||||||
READS_COMPLETED READS_MERGED SECTORS_READ TIME_SPENT_READING \
|
READS_COMPLETED READS_MERGED SECTORS_READ TIME_SPENT_READING \
|
||||||
|
@ -83,6 +84,7 @@ while getopts hd:i:I: OPT; do
|
||||||
do
|
do
|
||||||
case "$DEVICE_NAME" in
|
case "$DEVICE_NAME" in
|
||||||
$OPTARG)
|
$OPTARG)
|
||||||
|
DEVICE_FOUND=1
|
||||||
# Checking the thresholds
|
# Checking the thresholds
|
||||||
if [ -n "$THRESHOLD_IO_IN_PROGRESS_CRITICAL" ] && [ "$IO_IN_PROGRESS" -gt "$THRESHOLD_IO_IN_PROGRESS_CRITICAL" ]; then
|
if [ -n "$THRESHOLD_IO_IN_PROGRESS_CRITICAL" ] && [ "$IO_IN_PROGRESS" -gt "$THRESHOLD_IO_IN_PROGRESS_CRITICAL" ]; then
|
||||||
OUTPUT_EXIT_STATUS=$STATE_CRITICAL
|
OUTPUT_EXIT_STATUS=$STATE_CRITICAL
|
||||||
|
@ -117,6 +119,16 @@ while getopts hd:i:I: OPT; do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < /proc/diskstats
|
done < /proc/diskstats
|
||||||
|
# Check if the device requested has been found.
|
||||||
|
if [ "$DEVICE_FOUND" -lt 1 ]; then
|
||||||
|
echo "UNKNOWN device '$OPTARG' not found."
|
||||||
|
exit $STATE_UNKNOWN
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
'h')
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
'i')
|
'i')
|
||||||
|
@ -134,6 +146,8 @@ while getopts hd:i:I: OPT; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Should we check if no device has been requested ? Overkill ?
|
||||||
|
|
||||||
# Final ouput
|
# Final ouput
|
||||||
case "$OUTPUT_EXIT_STATUS" in
|
case "$OUTPUT_EXIT_STATUS" in
|
||||||
'0')
|
'0')
|
||||||
|
|
Loading…
Reference in a new issue