Forum Discussion
Segman_342030
Nimbostratus
May 08, 2018Need help with - External Monitor Using SSH
Hi,
We are trying to monitor specific process on remote server, if it run's then application is up if not then it is down.
For that we developed small script (Shown below).
The point is that whe...
cjunior
Nacreous
May 08, 2018Hi,
I can see you probably forgot to set param to that ssh non-default port (-p $2).
Anyway, what about to try this way:
!/bin/sh
pidfile="/var/run/`basename ${0}`.$1..$2.pid"
if [ -f $pidfile ]
then
kill -9 -`cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
Remove the IPv6/IPv4 compatibility prefix
ip=`echo $1 | sed 's/::ffff://'`
port=$2
ssh -p $port root@$ip "ps -ef |grep ygwmanmx |grep -v grep 2>&1 > /dev/null"
status=$?
if [ $status -eq 0 ]
then
rm -f $pidfile
echo "up"
fi
Test:
&1 > /dev/null'
+ status=0
+ '[' 0 -eq 0 ']'
+ rm -f /var/run/monitor.sh.192.168.74.6..5588.pid
+ echo up
up
Best Regards.
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