Forum Discussion
Joel_Breton
Nimbostratus
9 years agoUsing the Python SDK for monitors
I'm starting to use the python SDK and I can't figure out how to access the monitor objects on the BIGIP. Here's my code for displaying the nodes from f5.bigip import ManagementRoot
mgmt = M...
Ed_Summers
Nimbostratus
9 years ago(YMMV depending on version. I'm using version 12.1.2.)
'monitor' is another collection with the various monitor types underneath it. If you just get the collection from 'monitor' you'll have a list of reference links to the sub-collections underneath it. One way of getting an actual list of monitors is to get the collection of the specific monitor type:
>>> https_monitors = mgmt.tm.ltm.monitor.https_s.get_collection()
>>> for mon in https_monitors:
... print(mon.name)
...
Reminder that since the monitor objects are collections, they'll end in 's', or '_s' if the resource already ends in 's'. Example: to get https monitors, use 'https_s'. To get http monitors, use 'https'.
Apologies if I've butchered SDK terminology on collections/sub-collections. I'm still getting used to the environment myself.