1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-12-23 01:23:55 +01:00
nagios-plugins/check_dataprotector/trunk/check_dp_mountrequest

40 lines
935 B
Plaintext
Raw Normal View History

2010-03-01 23:09:31 +01:00
#!/bin/sh
2010-04-02 22:42:52 +02:00
TEMPFILE=`mktemp`
omnistat=/opt/omni/bin/omnistat
2010-03-01 23:09:31 +01:00
2010-04-02 22:42:52 +02:00
if [ ! -x $omnistat ]; then
echo "UNKNOWN - Cant find $omnistat"
exit 3
fi
$omnistat > $TEMPFILE
2010-03-01 23:09:31 +01:00
RESULT=$?
2010-04-02 22:42:52 +02:00
# 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
2010-03-01 23:09:31 +01:00
RESULT=$?
if [ $RESULT -eq 0 ]; then
2010-04-02 22:42:52 +02:00
echo "OK - No running sessions | $PERFDATA"
2010-03-01 23:09:31 +01:00
exit 0
fi
2010-04-02 22:42:52 +02:00
grep -q "Mount" $TEMPFILE
2010-03-01 23:09:31 +01:00
RESULT=$?
if [ $RESULT -eq 0 ]; then
2010-04-02 22:42:52 +02:00
echo "Warning, $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA"
2010-03-01 23:09:31 +01:00
exit 1
fi
2010-04-02 22:42:52 +02:00
#cat $TEMPFILE
echo "OK - $MOUNT_REQUESTS mount requests. $RUNNING_SESSIONS active sessions. $QUEUED_SESSIONS queued. | $PERFDATA"
2010-03-01 23:09:31 +01:00
exit 0