Forum Discussion

fpieressa's avatar
fpieressa
Icon for Altostratus rankAltostratus
Jul 04, 2014

Query ASM Policies with iControl in version 11.5

Hi! I can't find how to query which ASM Policies has associated a Virtual Server using iControl in version 11.5.

 

With version 11.3 I use to use the method LocalLB::VirtualServer->get_httpclass_profile, but is not available anymore...

 

How can I query now which ASM Policies has a VS associated?

 

Thanks!

 

2 Replies

  • Connor's avatar
    Connor
    Icon for Nimbostratus rankNimbostratus
    Did you figure this out? I am running into the same problem. Thanks!
  • The response value of "virtualServers" is what you're looking for. Unfortunately, this field/value can not be obtained for all policies in a single call, but a separate request per policy is required. You will have to use Python/Perl/Bash to iterate.

    Getting the "where used" Virtual Servers per one particular ASM policy

    API Call:

    curl -sk -u 'admin:admin' https://localhost/mgmt/tm/asm/policies/9RXyqZ_cn1PF8Dt5gRQFCQ/

    Somewhere in the output, you will get:

    "virtualServers":["/Common/vs_myvirtualserver,/Common/vs_myvirtualserver2"]
    . If the value is empty as below, the ASM policy is not linked to any Virtual Servers

    "virtualServers":[""]

    The last part of gibberish (22 digits) in the API call is a unique policy ID reference. To get a list of those IDs, you will have to make another request beforehand:

    curl -sk -u 'admin:admin' https://localhost/mgmt/tm/asm/policies/

    Since there will be a ton of irrelevant output, you will need to use your own scripts or 3rd party tools to parse the output so it can be used in a meaningful way.