1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-23 02:43:45 +01:00
nagios-plugins/check_dataprotector/trunk/check_dp_pool

41 lines
777 B
Plaintext
Raw Normal View History

2010-03-01 23:09:31 +01:00
#!/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