Forum Discussion
Gary_31854
Mar 27, 2014Nimbostratus
I was unable to attach the full script to this thread. I put it up on pastebin --> http://pastebin.com/PMwFXs5z .
The backticks and missing variables are defined. It does work when executed from the CLI. Here is the piece of code again with the preformatted code view.
Full path variables to commands used in the script
CURL='/usr/bin/curl'
GREP='/bin/grep'
TMSH='/usr/bin/tmsh'
LOGGER='/bin/logger'
IP addresses of the VCS members
VCS1='10.12.1.11'
VCS2='10.12.1.12'
Debug flag
DEBUG=1
TMSH list the content of snat definition snat_ids_primary, and look for
the VCS IP addresses to store them in the $PRI variable. If the VCS are
not in the primary SNAT, $PRI should be empty.
PRI=`$TMSH list ltm snat snat_ids_primary | $GREP -E "$VCS1|$VCS2"`
if [ "$DEBUG" -eq 1 ]; then echo "IDS_SNAT: Result of Primary SNAT check -> $PRI" | $LOGGER -p local0.debug; fi