Forum Discussion
Arron_1084
Nimbostratus
Jun 04, 2014Stacked monitoring?
Hello all, I'm fairly sure someone on here has done this before and am hoping its fairly easy to implement. I'm trying to use the LTM's monitors as a way to take offline non-functioning web servers. ...
Jun 06, 2014
Hi!
$? would give the status of the last command so you need to test them independently.
tmsh show ltm pool Mypool1_Stg_pool field-fmt | grep -o offline > /dev/null
tmsh show ltm pool Mypool2_Stg_pool field-fmt | grep -o offline > /dev/null
status=$?This would only return the exit code of:
tmsh show ltm pool Mypool2_Stg_pool field-fmt | grep -o offline > /dev/nullExample:
This command works:
[root@PatrikLab:Active] config ls bigip.conf > /dev/null
[root@PatrikLab:Active] config echo $?
0
This command does not work:
[root@PatrikLab:Active] config ls nonexistingfile > /dev/null
ls: nonexistingfile: No such file or directory
[root@PatrikLab:Active] config echo $?
2
Run them together:
[root@PatrikLab:Active] config ls nonexistingfile > /dev/null
ls: nonexistingfile: No such file or directory
[root@PatrikLab:Active] config ls bigip.conf > /dev/null
[root@PatrikLab:Active] config echo $?
0So maybe you'd want to do something like this?
!/bin/sh
pidfile="/var/run/pinger.$1..$2.pid"
if [ -f $pidfile ]
then
kill -9 `cat $pidfile` > /dev/null 2>&1
fi
echo "$$" > $pidfile
node_ip=`echo $1 | sed 's/::ffff://'`
status="UP"
tmsh show ltm pool Mypool1_Stg_pool field-fmt | grep -o offline > /dev/null
if [ $? ]; then
status="DOWN";
fi
tmsh show ltm pool Mypool2_Stg_pool field-fmt | grep -o offline > /dev/null
if [ $? ]; then
$status="DOWN"
fi
echo $status/Patrik
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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