Forum Discussion

Danicoolbug's avatar
Danicoolbug
Icon for Nimbostratus rankNimbostratus
May 26, 2021

How to execute show command for multiple vips in F5 ltm?

i have a show command to get details of a single vip. I have a list of 30 vip names in a single F5 device, i would like to know if there is any script that i can run the show command for 30 vips? ...
  • jaikumar_f5's avatar
    May 26, 2021

    Hi  

    Can you please take a look at this codeshare,

    https://devcentral.f5.com/s/articles/Export-Virtual-Server-Configuration-in-CSV-tmsh-cli-script?page=1

    Or you can go with simple bash script.

    #!/bin/bash
    echo "Virtual Server, State, Status" > /var/tmp/virtuals-output.csv
    for vs in `cat /var/tmp/vs-input.txt`
    do
    virtual_state=`tmsh show ltm virtual $vs all-properties | grep "Availability" | awk '{print $3}'`
    virtual_status=`tmsh show ltm virtual $vs all-properties | grep "State" | awk '{print $3}'`
    echo "$vs,$virtual_state,$virtual_status" >> /var/tmp/virtuals-output.csv
    done