Forum Discussion

keithhubb's avatar
keithhubb
Icon for Employee rankEmployee
Aug 15, 2014

grepping output of 'b virtual show' version 9.x

Hi, I'm not very good at grep. So I was hoping that someone could help me with a command to grep 'b virtual show' (on version 9.4.8) and output only the VIP name, IP, service port , pool name, pool member IPs and port.

 

Thanks, Keith

 

2 Replies

  • Shun_Yan_118296's avatar
    Shun_Yan_118296
    Historic F5 Account

    VIRTUAL ADDRESS 2.2.2.1 UNIT 1 | ARP enable | (cur, max, limit, tot) = (0, 0, 0, 0) | (pkts,bits) in = (0, 0), out = (0, 0) +-> VIRTUAL test SERVICE http | PVA acceleration none | (cur, max, limit, tot) = (0, 0, 0, 0) | (pkts,bits) in = (0, 0), out = (0, 0) | requests (total) = 0 +-> POOL test LB METHOD round robin MIN/CUR ACTIVE MEMBERS 0/0 | (cur, max, limit, tot) = (0, 0, 0, 0) | (pkts,bits) in = (0, 0), out = (0, 0) +-> POOL MEMBER test/1.1.1.1:http inactive,down | | session disabled priority 1 ratio 1 | | (cur, max, limit, tot) = (0, 0, 0, 0) | | (pkts,bits) in = (0, 0), out = (0, 0) | | requests (total) = 0 +-> POOL MEMBER test/1.1.1.2:http inactive,down | session enabled priority 1 ratio 1 | (cur, max, limit, tot) = (0, 0, 0, 0) | (pkts,bits) in = (0, 0), out = (0, 0) | requests (total) = 0

     

    I used the below command, which can filter out the info you request. I think there is some other simple way, but I don't know how to. lol.

     

    b virtual show | egrep "VIRTUAL>|POOL" | sed -r 's/^[[:space:]]{0,}...[[:space:]]//g' | cut -d " " -f1-6 | sed 's/UNIT$//g' | sed 's/LB.//g' | sed -r 's/[[:alpha:]]{0,2}active.//g' VIRTUAL ADDRESS 2.2.2.1

     

    VIRTUAL test SERVICE http POOL test

     

    POOL MEMBER test/1.1.1.1:http

     

    POOL MEMBER test/1.1.1.2:http

     

  • Shun_Yan_118296's avatar
    Shun_Yan_118296
    Historic F5 Account

    Not in a good format, paste the command again.

     

    b virtual show | egrep "VIRTUAL>|POOL" | sed -r 's/^[[:space:]]{0,}...[[:space:]]//g' | cut -d " " -f1-6 | sed 's/UNIT$//g' | sed 's/LB.//g' | sed -r 's/[[:alpha:]]{0,2}active.//g'

     

    Here is the output

     

    VIRTUAL ADDRESS 2.2.2.1

     

    VIRTUAL test SERVICE http

     

    POOL test

     

    POOL MEMBER test/1.1.1.1:http

     

    POOL MEMBER test/1.1.1.2:http