Forum Discussion
2 Replies
Sort By
- Ed_SummersNimbostratus
This is available from the virtual service's statistics. Accessing statistics may have changed since I last used it, but I use a stats handler that was added per one of my questions a while back.
Here's some sample code to at least get you a value. You may find a better way to get it but this should at least get you a result. The stat you want is status_availabilityState.
from f5.bigip import ManagementRoot from f5.utils.responses.handlers import Stats from pprint import pprint mgmt = ManagementRoot(host_ip, username, password, token=True) my_virtual = mgmt.tm.ltm.virtuals.virtual.load(partition='Common', name='my_virtual') my_pool = mgmt.tm.ltm.pools.pool.load(partition='Common', name='my_pool') v_stats = Stats(my_virtual.stats.load()) p_stats = Stats(my_pool.stats.load()) pprint(v_stats.stat) pprint(p_stats.stat) print(v_stats.stat.status_availabilityState) print(p_stats.stat.status_availabilityState)
Of course make necessary changes for your environment (host_ip, user, password, etc..).
- HygorNimbostratus
Maybe the curl examples bellow may help you
- curl -sku admin:
- curl -sku admin:
- curl -sku admin:
And you can see the availability checking the status.availabilityState entry:
- 'status.availabilityState': { description: 'offline' }
- 'status.availabilityState': { description: 'available' }
- 'status.availabilityState': { description: 'unknown' }