Forum Discussion
Daniel_Ao_10370
Nimbostratus
Jan 29, 2018Arguments in External Monitor
I have created a script to monitor Windows service state through WMI. Below is the script.
!/bin/sh
IP= echo ${1} | sed 's/::ffff://'
PORT=${2}
PIDFILE="/var/run/ basename ${0} .${IP}_${PORT}....
Daniel_Ao_10370
Nimbostratus
Jan 29, 2018!/bin/sh
IP=
echo ${1} | sed 's/::ffff://'
PORT=${2}
PIDFILE="/var/run/basename ${0}
.${IP}_${PORT}.pid"
kill of the last instance of this monitor if hung and log current pid
if [ -f $PIDFILE ] then echo "EAV exceeded runtime needed to kill ${IP}:${PORT}" | logger -p local0.error kill -9
cat $PIDFILE
> /dev/null 2>&1
fi
echo "$$" > $PIDFILE
rm -f $PIDFILE
wmic -U $3/$4%$5 //$IP "select State from Win32_Service where Name=$6" | grep -i ".*|Running" 2>&1
mark node UP if expected response was received
if [ $? -eq 0 ] then echo "UP" fi exit
text
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects