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_mountrequest
Páll Guðjón Sigurðsson 86363180f0 perf data added
2010-04-02 20:42:52 +00:00

40 lines
935 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=$?
if [ $RESULT -eq 0 ]; then
echo "OK - No running sessions | $PERFDATA"
exit 0
fi
grep -q "Mount" $TEMPFILE
RESULT=$?
if [ $RESULT -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