Forum Discussion

s_selvey's avatar
s_selvey
Icon for Nimbostratus rankNimbostratus
Aug 13, 2019
Solved

Checking what iRules are associated to multiple virtual servers

I need to understand what iRules are configured under each virtual server in a certain partition on my LTM and then extract the iRule configuration. Is there a quicker way to do this rather than manually checking each virtual server?

  • Hello.

    Try this ->

    tmsh -q -c "cd / ; list ltm virtual recursive one-line" | grep rule

    KR,

    Dario.

4 Replies

  • not really, but it can be a bit easier from the command line and using a good text editor and maybe a bit of regex if you're feeling adventurous.

  • Hello.

    Try this ->

    tmsh -q -c "cd / ; list ltm virtual recursive one-line" | grep rule

    KR,

    Dario.

  • harhan's avatar
    harhan
    Icon for Nimbostratus rankNimbostratus

    I wanted to expand a bit on the answer, as this question comes up once in a while. The one-line argument is a bit hard to read if you want to scan over the rules by hand. I expanded the above expression with sed in stead.

    It will list all virtual servers, regardless if they use irules or not.

    tmsh -q -c "cd / ; list ltm virtual recursive" | sed -n -e '/ltm virtual/p' -e '/    rules/,/}/p'

    The second sed expression scans the lines from rules to } outputting something similar to:

    ltm virtual Common/VS_Test {
    ltm virtual Common/VS_FrontEnd {
        rules {
            Common/iRule_FrontEnd
        }

     Edit: slight change in sed expression

  • Thanks Dario, this works perfectly. Managed to get "list ltm virtual | grep irule", but didn't know how to get the previous lines output!