1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 10:23:46 +01:00
nagios-plugins/check_dataprotector/trunk/check_dp_mountrequest
Páll Guðjón Sigurðsson c5c02a0b73 cleanup added
2010-07-19 15:28:24 +00:00

43 lines
967 B
Bash
Executable File

#!/bin/sh
TEMPFILE=`mktemp`
omnistat=/opt/omni/bin/omnistat
if [ ! -x $omnistat ]; then
echo "UNKNOWN - Cant find $omnistat"
exit 3
fi
$omnistat > $TEMPFILE
RESULT=$?
# Collect some performance data
RUNNING_SESSIONS=`grep ^2 $TEMPFILE | wc -l`
QUEUED_SESSIONS=`grep Queuing $TEMPFILE | wc -l`
MOUNT_REQUESTS=`grep Mount $TEMPFILE | wc -l`
PERFDATA="'active sessions'=$RUNNING_SESSIONS 'queued'=$QUEUED_SESSIONS 'mount requests'=$MOUNT_REQUESTS"
grep -q "No currently running sessions." $TEMPFILE
RESULT=$?
grep -q "Mount" $TEMPFILE
MOUNTREQUESTS=$?
rm -f $TEMPFILE
if [ $RESULT -eq 0 ]; then
echo "OK - No running sessions | $PERFDATA"
exit 0
fi
if [ $MOUNTREQUESTS -eq 0 ]; then
echo "Warning, $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA"
exit 1
fi
#cat $TEMPFILE
echo "OK - $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA"
exit 0