Forum Discussion

Chris_Olson_172's avatar
Chris_Olson_172
Icon for Nimbostratus rankNimbostratus
Jan 07, 2016

List virtual by IP from command line

I have read multiple posts on this but can't get it to work. It should (and probably is) very simple. I need to search virtuals by IP address and then display all the properties for the virtuals found with that address.

All I can come up with is the below. It lists only the single line and not the rest of the properties. I've tried multiple iterations using "all or "all properties" but can't get the full properites. I'd love to figure this out but don't have 1/2 a day to keep hacking at it. Any help is appreciated.

tmsh list ltm virtual all | grep "destination 123.456.789.10"

destination 123.456.789.10:http
destination 123.456.789.10:https

4 Replies

  • That's because grep only grabs the line that the text is found on, and TMSH responds with properties on multiple lines by default. You can have it respond on one line though. Try this:

     list ltm virtual all-properties one-line | grep "destination x.x.x.x"
    
  • Still missing something....

     

    tmsh list ltm virtual all-properties one-line | grep "destination x.x.x.x"

    Syntax Error: unexpected argument "one-line"

     

  • Afraid not. I get the message: "The requested virtual server (one-line) was not found" even if I put a valid virtual in the command. tmsh list ltm virtual one-line 01020036:3: The requested virtual server (one-line) was not found. ~ tmsh list ltm virtual www.example.com one-line 01020036:3: The requested virtual server (one-line) was not found.