1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-10 04:23:44 +01:00
nagios-plugins/check_dataprotector/check_dp_mountrequest

64 lines
1.8 KiB
Plaintext
Raw Normal View History

2010-03-01 23:09:31 +01:00
#!/bin/sh
2010-09-15 05:56:07 +02:00
#
# 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
2010-03-01 23:09:31 +01:00
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=$?
2010-07-19 17:28:24 +02:00
grep -q "Mount" $TEMPFILE
MOUNTREQUESTS=$?
rm -f $TEMPFILE
2010-03-01 23:09:31 +01:00
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-07-19 17:28:24 +02:00
if [ $MOUNTREQUESTS -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