Forum Discussion

gdoyle's avatar
gdoyle
Icon for Cirrostratus rankCirrostratus
Feb 07, 2017

Virtual Server/Pool Member listing.

Hey, y'all.

 

I'm trying to put together a spreadsheet including the following information:

 

Virtual server name, virtual server IP, pool names, pool members, ports, and partition.

 

This is fairly excruciating trying to manually type this information into Excel.

 

Is there any command I can run in the CLI or some export via the GUI that I can use to print out at least some of this information for me?

 

Thanks!

 

6 Replies

  • gdoyle's avatar
    gdoyle
    Icon for Cirrostratus rankCirrostratus

    I was able to use the following command to list the Virtual Servers and pools:

     

    list ltm virtual pool

     

    Is there a way to add the additional information in the output?

     

  • gdoyle's avatar
    gdoyle
    Icon for Cirrostratus rankCirrostratus

    Thanks for that.

     

    Two questions:

     

    1. Can I modify this to list all VS's and not just those with an http profile?
    2. How do I load this/run this on my Big IP?
  • Hi,

    Here is the script to list all of your virtual servers:

    !/bin/bash
    
     List VSs with 'http' profile name
    
    VS=`tmsh -q -c "list ltm virtual " | awk 'BEGIN {RS="\n}"} !/\ none/ {print}'| grep ^ltm | awk '{print $3}'`
    
     Get pool name for each VS
    
    for all in ${VS}
    do
    POOL=`tmsh -q list ltm virtual $all pool  | awk  '/pool/ {print $2}'`
    DESTINATION=`tmsh -q list ltm virtual $all destination  | awk -F'[ :]' '/destination/ {print $6}'`
    
        if [ "$POOL" != "none" ]
        then
         POOLIP=`tmsh list ltm  pool $POOL members| awk -F '[ :]' -v ORS=", " '/^ +[0-9]/   {print $9; count++ }'`
         else
            POOLIP="-"
     fi
    
    printf "%-45s %-20s %-20s %-s\n" "$all" "$DESTINATION" "$POOLIP"
    done
    

    Login with ssh and go to the /tmp directory. Take your favorite editor (vi/nano) open a file named script.sh and past the script in it.

    Save it.

    Make it executable (chmod +x script.sh) run the script ./script.sh

    If you want it to send the list to a file type ./script.sh >>/tmp/list.txt

    Cheers,

    Kees

  • FAO; Kees,

     

    Fantastic Script, thank you for your Post.

     

    How can I Add the VIP Description and excuse my ignorance VIP Pool Name to this output.

     

    Unfortunately, my predecessors have used the Same Names for the Parent VIPs and VIP Pools and in some cases the IP Address.

     

    I have been Looking for a Script that will give me the Following Output in one Table;

     

    VIP Name, VIP Description, VIP Destination, VIP Pool Name, VIP Pool Member/s, VIP Pool Member/s Port Number along with the Nice to Have VIP and VIP Pool Members Status.

     

    I will look forward to your feedback.

     

    Dan DC4Networks.