Forum Discussion

AmolAllewar_262's avatar
AmolAllewar_262
Icon for Nimbostratus rankNimbostratus
May 09, 2016

Hi ,I want to export VIP and pool details in excel or csv . Can anybody help me regarding this . I am new in F5 world .

Hi ,I want to export VIP and pool and pool menbers details in excel or csv . Can anybody help me regarding this . I am new in F5 world .

 

Regards

 

Amol S. Allewar

 

  • See this post for a very similar question. The suggestion was to start by looking at the output of "tmsh list ltm virtual".

    I put together a quick bash script for you for this purpose.

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

    The output is like this. The vs2 virtual doesn't have a pool or pool members.

    vs name, destination, pool, pool members
    myvs,0.0.0.0:any,mypool,192.168.1.1 192.168.1.2
    vs2,192.168.1.23:http,,
    

    You may need to change some things but that should get you a head start.

    • omar_padilla's avatar
      omar_padilla
      Icon for Altocumulus rankAltocumulus

      Thank you this is very helpfull, but how can i add the source ip? when i try to modify something i only get errors or nothing at all.

      Thank you for you help.

      • niirraaj's avatar
        niirraaj
        Icon for Nimbostratus rankNimbostratus

        I have modified the script and its working for me

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

  • F5 BigIP LTM configuration is not what you would normally manage in an Excel spreadsheet. Formatting would probably be a major overhead.

    If you insist, you can get started by the following two commands:

     Print out all LTM Virtual Server configurations, one row per VS
    tmsh list ltm virtual one-line
     Print out all LTM Pool configurations, one row per Pool
    tmsh list ltm pool one-line
    

    When done, you can paste the outputs to your Excel spreadsheet and split the values to multiple columns (use 'space' as field separator). You will still have to manually format what's left to make it human-usable documentation.

    Regards,

    • AmolAllewar_262's avatar
      AmolAllewar_262
      Icon for Nimbostratus rankNimbostratus
      Thanks . My LTM is configured in multiple partition . When i enter this command i am not getting any output . Version : 11.4.1 . Please suggest .
  • F5 BigIP LTM configuration is not what you would normally manage in an Excel spreadsheet. Formatting would probably be a major overhead.

    If you insist, you can get started by the following two commands:

     Print out all LTM Virtual Server configurations, one row per VS
    tmsh list ltm virtual one-line
     Print out all LTM Pool configurations, one row per Pool
    tmsh list ltm pool one-line
    

    When done, you can paste the outputs to your Excel spreadsheet and split the values to multiple columns (use 'space' as field separator). You will still have to manually format what's left to make it human-usable documentation.

    Regards,

    • AmolAllewar_262's avatar
      AmolAllewar_262
      Icon for Nimbostratus rankNimbostratus
      Thanks . My LTM is configured in multiple partition . When i enter this command i am not getting any output . Version : 11.4.1 . Please suggest .
      • niirraaj's avatar
        niirraaj
        Icon for Nimbostratus rankNimbostratus

        Though the question is very old I am answering it for someone who still looking for the answer.

        1. From traffic management shell navigate to your partition                                                       admin@(lab-lb1)(cfg-sync In Sync)(Active)(/Common)(tmos)# cd /Partition1
        2. Here you can use the commands given by Hannes_Rapp 
               admin@(lab-lb1)(cfg-sync In Sync)(Active)(/Partition1)(tmos)# list ltm virtual one-line
               admin@(lab-lb1)(cfg-sync In Sync)(Active)(/Partition1)(tmos)#list ltm pool one-line
  • Hey guys,

    I stumbled upon this thread by the article https://my.f5.com/manage/s/article/K72255145. Together with my go to dev ops guy I refined the script a little bit. Especially he added regexp to filter the IP addresses. I added the columns for WAF policies. Because there are two ways to implement WAF policies there are two columns for this. If you don't need this just comment the strings out of the script.

    Hope this helps.

    echo BIG-IP,vs name,destination,pool,pool members,WAF_profiles,WAF_policies
    VIRTUALS=$(tmsh -q -c "cd / ; list /ltm virtual  recursive" | grep "ltm virtual" | awk -F' ' '{print "/"$3}')
    for VS in $VIRTUALS;
    do
        HOST=$(tmsh list sys global-settings hostname | grep hostname | cut -d" " -f6)
        echo -n $HOST,
        echo -n $VS,
        DEST=$(tmsh list ltm virtual $VS | grep destination | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
        echo -n $DEST,
        POOL=$(tmsh list ltm virtual $VS | grep pool | cut -d" " -f6)
        echo -n $POOL,
        if [ -n "$POOL" ];
        then
        MBRS=$(tmsh list ltm pool "$POOL" | grep address | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}')
        echo -n $MBRS,
        fi
        WAF_profiles=$(tmsh list ltm virtual $VS | grep -A 1 profiles | grep ASM | cut -d" " -f9)
        echo -n $WAF_profiles,
        WAF_policies=$(tmsh list ltm virtual $VS | grep -A 1 policies | grep asm | cut -d" " -f9)
        echo -n $WAF_policies
        echo
    done