Forum Discussion

SamCo's avatar
SamCo
Icon for Cirrus rankCirrus
Mar 04, 2022
Solved

List all VS and associated (or not) Dos profile

Hello All,

I am currently looking for a way to list on our BigIp all the VS and the associated DoS Profile, and if there no DoS profile, I favor Rest API if possible.

I already see I could make a first call to /mgmt/tm/security/dos/profile to find a list of all dos profile, but it's not referencing the VS using it.

On the VS side, I can retrieve it in the profile list with /mgmt/tm/ltm/virtual/profile, but it's not I need to cross check with the dos profile list to find which profile is a dos profile.

Is there a way to retrieve these information with a minimal number of request ? I have hundreds of virtual server, if I need to query virtual one  by one the search will be very long

Cheers,

Samuel

  • Hi SamCo,

    You should be able to obtain a full list of the virtual servers, and a full list of the DoS profiles fairly easily, then in a programming language iterate over each VIP and the list of DoS profiles to check if there are any matches.

    So basically in some python pseudocode:

    Get /mgmt/tm/ltm/virtual as virtuals
    Get /mgmt/tm/security/dos/profile as dosprofiles
    
    for vip in virtuals:
        # start by setting some variable to false, if there is no dos profile match it will stay false
        match = False
        for profile in dosprofiles:
            if profile['name'] in vip['profiles']:
                # found a profile match, set some variable to true
                match = True
        # return the requested data
            

    You may also find it helpful to use the "expandSubcollections" flag, which can reduce the number of calls needed, but does increase the size of the response. More info is here: https://community.f5.com/t5/technical-articles/demystifying-icontrol-rest-part-3-how-to-pass-query-parameters/ta-p/286957 

    Hope this helps.

2 Replies

  • Hi SamCo,

    You should be able to obtain a full list of the virtual servers, and a full list of the DoS profiles fairly easily, then in a programming language iterate over each VIP and the list of DoS profiles to check if there are any matches.

    So basically in some python pseudocode:

    Get /mgmt/tm/ltm/virtual as virtuals
    Get /mgmt/tm/security/dos/profile as dosprofiles
    
    for vip in virtuals:
        # start by setting some variable to false, if there is no dos profile match it will stay false
        match = False
        for profile in dosprofiles:
            if profile['name'] in vip['profiles']:
                # found a profile match, set some variable to true
                match = True
        # return the requested data
            

    You may also find it helpful to use the "expandSubcollections" flag, which can reduce the number of calls needed, but does increase the size of the response. More info is here: https://community.f5.com/t5/technical-articles/demystifying-icontrol-rest-part-3-how-to-pass-query-parameters/ta-p/286957 

    Hope this helps.

    • SamCo's avatar
      SamCo
      Icon for Cirrus rankCirrus

      Many Thanks ! ExpandSubcollection will really help.

      I am not very familiar with python, and make my call with php.

      Cheers,

      Sam