Forum Discussion

rcwizard_324111's avatar
rcwizard_324111
Icon for Nimbostratus rankNimbostratus
Jun 22, 2017

How to export F5 VS data, Pool members, and Member Addresses into a documentable format

I have found a script that works really well and will extract most of the data I am looking for, but I am unable to retrieve the member names in each of the pools. Does anyone have any suggestions? This is the script I am using at the moment:

VIRTUALS=$(tmsh list ltm virtual | grep "ltm virtual" | cut -d" " -f3)
for VS in $VIRTUALS;
do
  DEST=$(tmsh list ltm virtual $VS | grep destination | cut -d" " -f6)
  POOL=$(tmsh list ltm virtual $VS | grep pool | cut -d" " -f6)
  if [ -n "$POOL" ];
  then
    MBRS=$(tmsh list ltm pool "$POOL" | grep address | cut -d" " -f14)
    echo -n $MBRS
  fi
  echo
done
`


I also found this command (but I am not sure how to modify this to work since I am fairly new to scripting)

``tmsh list ltm virtual {pool destination} | awk '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm "$0" {members} | awk '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}'`