Commit 1d78d226 authored by w.verleger's avatar w.verleger

Add new file

parent 14f423b9
Pipeline #51 failed with stages
in 27 seconds
#!/bin/bash
#
# File name : check_xslocks
#
# Created by : Wilken Verleger <info@proio.com>
# Created date : 20.08.2019
# Version : 1.0
# Licence : GPL - http://www.fsf.org/licenses/gpl.txt
#
# Information : Checks index page of XenServer for string set by check_xslocaldisk
#
# How to use : ./check_xslocks <hostname/ip>
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program 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.
#
####################################################################
XSHOST=${1}
# check if wget is installed and save path
if [ -z $(which wget) ]
then
echo "UNKNOWN - wget missing on system"
exit 3
else
wget=$(which wget)
fi
# check if XSHOST is empty
if [[ -z ${XSHOST} ]]
then
echo "UNKNOWN - no host to check against given. Usage ./check_xsdisk <hostname/ip>"
exit 3
else
MSG=$(${wget} -q -O - ${XSHOST} | grep locks | awk -v FS="(<locks> |</locks>)" '{print $2}' )
ALERTSTATUS=$(${wget} -q -O - ${XSHOST} | grep locks | awk '{print $2}' )
if [[ $ALERTSTATUS == "OK" ]]
then
echo "$MSG"
exit 0
elif [[ $ALERTSTATUS == "WARNING" ]]
then
echo "$MSG"
exit 1
elif [[ $ALERTSTATUS == "CRITICAL" ]]
then
echo "$MSG"
exit 2
else
echo "UNKNOWN - did check script run once on xenserver?"
exit 3
fi
fi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment