For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

shabuboy's avatar
shabuboy
Icon for Altostratus rankAltostratus
Apr 18, 2023
Solved

CLI command to look search for a node on all partition

 

Hello

I use this command to query for the config once I know the virtual name.

----------------------------------------------------------------------------

tmsh show ltm <virtual_name> detail | egrep "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | Ltm::ClientSSL Profile" | grep -v "Destination IP Bypasses" | sed 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g'

----------------------------------------------------------------------------



However, need a couple of different things now:

- Search on all partitions

- Search by the pool member IP

I have close to 400 pool members, each on a different partition, each one in a different pool, and need to find out the virtual name, virtual IP, pool, and pool member for all.

Playing with the following command to see if it might be possible:
tmsh -c 'cd /; show ltm virtual detail recursive' | grep -E '172.30.90.1%|172.30.90.75%'

 

Any ideas of an easy way to accomplish it?

 

  • Thanks Enes_Afsin_Al.
    Your script works great. Sample output:
    /rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serviceMain,/rsync_load_balancer_vhn0wt_ste_prd/172.30.13.91%709:ssh,/rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serverpool,172.30.13.85%709 172.30.13.87%709 172.30.13.88%709 172.30.13.89%709

    In the end, had two options, yours plus: 

    Command-1:
    tmsh -c 'cd /; show ltm virtual detail recursive' | egrep "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | Ltm::ClientSSL Profile" | grep -v "Destination IP Bypasses" | sed 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g' >> /var/tmp/virtual.out

    Command 2:
    egrep -B 3 '172.30.13.85%|172.30.13.87%|172.30.13.88%|172.30.13.89%' virtual.out

    Example output:
    Virtual Server: rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serviceMain
    Destination: 172.30.13.91%709:22
    Pool: rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serverpool
    Pool Member: Common/172.30.13.85%709:22
    Pool Member: Common/172.30.13.87%709:22
    Pool Member: Common/172.30.13.88%709:22
    Pool Member: Common/172.30.13.89%709:22

     

    Both outputs can be written to a file with the " > filename.csv " or " filename.txt "

     

     

2 Replies

  • Hi shabuboy,

    I hope the script in the article will be helpful. The running time of the script will be longer.
    I recommend running it on standby device.

    https://my.f5.com/manage/s/article/K72255145

    You can use grep command to filter by node ip address.

    ./excel.sh | grep 1.2.3.4

    Also, you can use Network Map just to view.

  • Thanks Enes_Afsin_Al.
    Your script works great. Sample output:
    /rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serviceMain,/rsync_load_balancer_vhn0wt_ste_prd/172.30.13.91%709:ssh,/rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serverpool,172.30.13.85%709 172.30.13.87%709 172.30.13.88%709 172.30.13.89%709

    In the end, had two options, yours plus: 

    Command-1:
    tmsh -c 'cd /; show ltm virtual detail recursive' | egrep "Virtual Server: | Destination | Ltm::Pool: | Ltm::Pool Member: | Ltm::ClientSSL Profile" | grep -v "Destination IP Bypasses" | sed 's/Ltm:://g;s/|//g;s/Destination\s*/Destination/g' >> /var/tmp/virtual.out

    Command 2:
    egrep -B 3 '172.30.13.85%|172.30.13.87%|172.30.13.88%|172.30.13.89%' virtual.out

    Example output:
    Virtual Server: rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serviceMain
    Destination: 172.30.13.91%709:22
    Pool: rsync_load_balancer_vhn0wt_ste_prd/rsync_load_balancer_vhn0wt_ste_prd/serverpool
    Pool Member: Common/172.30.13.85%709:22
    Pool Member: Common/172.30.13.87%709:22
    Pool Member: Common/172.30.13.88%709:22
    Pool Member: Common/172.30.13.89%709:22

     

    Both outputs can be written to a file with the " > filename.csv " or " filename.txt "