1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 18:33:45 +01:00
nagios-plugins/check_dataprotector/trunk/check_dp_pool
Páll Guðjón Sigurðsson 7e0aef04d5 check_dataprotector added
2010-03-01 22:09:31 +00:00

41 lines
777 B
Bash
Executable File

#!/bin/sh
POOL="$1"
WARNING=5
CRITICAL=2
if [ "$POOL" = "" ]; then
echo "Unknown - No Media pool specified"
exit 3
fi
OUTPUT=$(/opt/omni/bin/omnimm -list_pool "$POOL")
RESULT=$?
if [ $RESULT -eq 3 ]; then
echo "Unknown - Media pool '$POOL' was not found"
exit 3
fi
if [ $RESULT -ne 0 ]; then
echo "Unknown - exit code from omnimm=$RESULT, output: $OUTPUT"
exit 3
fi
FREE_MEDIA=$(echo "$OUTPUT" | tail -n +4 | wc -l)
PERFDATA="'$POOL'=$FREE_MEDIA"
if [ $FREE_MEDIA -lt $CRITICAL ]; then
echo "Critical: $FREE_MEDIA available media in pool $POOL | $PERFDATA"
exit 2
fi
if [ $FREE_MEDIA -lt $WARNING ]; then
echo "Warning: $FREE_MEDIA available media in pool $POOL | $PERFDATA"
exit 1
fi
echo "OK: $FREE_MEDIA available media in pool $POOL | $PERFDATA"
exit 0