1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-16 23:43:47 +01:00
nagios-plugins/check_dataprotector/check_dp_mountrequest
2012-03-12 16:03:21 +00:00

64 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
#
# Copyright 2010, Pall Sigurdsson <palli@opensource.is>
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This script is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# About this script
#
# This script monitors active sessions of HP Dataprotector
# Warns if there are any active mount requests. Additionally
# displays some perfdata of total active sessions and queueud sessions
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