mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-12-23 01:23:55 +01:00
43 lines
967 B
Bash
Executable File
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
|