Difference between revisions of "F5 sdk"

From UVOO Tech Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
- https://github.com/f5devcentral/f5-sdk-python
 
- https://github.com/f5devcentral/f5-sdk-python
 
- Discontinued - https://github.com/F5Networks/f5-common-python
 
- Discontinued - https://github.com/F5Networks/f5-common-python
 +
- https://github.com/e-XpertSolutions/f5-rest-client
 +
 +
# Go
 +
- https://community.f5.com/t5/codeshare/go-library-to-manage-big-ip-icontrol-rest-api/ta-p/290967
  
 
# More
 
# More

Revision as of 22:57, 6 August 2023

SDK

Go

More

https://community.f5.com/t5/technical-forum/python-f5-sdk-401-unexpected-error-f5-authorization-required/td-p/167675

https://community.f5.com/t5/technical-forum/get-list-of-monitors-through-sdk/td-p/120088

https://community.f5.com/t5/technical-articles/tinkering-with-the-bigrest-python-sdk-part-2/ta-p/285190

Monitors

https://community.f5.com/t5/technical-forum/using-the-python-sdk-for-monitors/td-p/231801

Stats

https://community.f5.com/t5/technical-forum/how-do-i-get-pool-stats-using-f5-sdk/td-p/86748

Code Examples

from f5.bigip import ManagementRoot
from f5.utils.responses.handlers import Stats

#Authentication
mgmt = ManagementRoot("***", "***", "***")

#Print tmos version
file = open('Availability.txt', 'w')
TMOS = "TMOS version - " + mgmt.tmos_version
print(TMOS)
file.write(TMOS + '\n')

#Get a collection of all Virtual Servers, pools
all_vips = mgmt.tm.ltm.virtuals.get_collection()
all_pools = mgmt.tm.ltm.pools.get_collection()

#Loop over all virtual servers and fetch name and availability
for vip in all_vips:
    vip_stats = Stats(vip.stats.load())
    State = vip_stats.stat.status_availabilityState['description']
    file.write(vip.name + " - " + State + '\n')

#Loop over all pools
for pool in all_pools:
    pool_stats = Stats(pool.stats.load())
    State = pool_stats.stat.status_availabilityState['description']
    file.write(pool.name + " - " + State + '\n')
    #Loop over all pool members
    for member in pool.members_s.get_collection():
        member_stats = Stats(member.stats.load())
        State = member_stats.stat.status_availabilityState['description']
        file.write(member.name + " - " + State + '\n')