Forum Discussion
CPU, memory, disk usage and http profile using the BIG-IP Python SDK
I've been busy with the Python SDK for a couple of weeks now. While I managed to get a lot of information out of it, I'm struggling with a couple of API endpoints. Does anyone have an idea where I can find the statistics for CPU, Memory, Disk as well as the http profile? REST endpoints: mgmt/tm/sys/hostInfo (for CPU and memory) mgmt/tm/sys/disk/logical-disk (for disks) mgmt/tm/ltm/profile/http/stats (for http profile)
Thanks! Mike
I added the question on the Github page as that seems like a better location for such a query. it can be followed here: https://github.com/F5Networks/f5-common-python/issues/1436
- Mickelukas_3582Nimbostratus
I added the question on the Github page as that seems like a better location for such a query. it can be followed here: https://github.com/F5Networks/f5-common-python/issues/1436
- Satoshi_Toyosa1Ret. Employee
As shown in the Github Issue 1436, the feature became available from SDK version 3.0.15.
To check the current version on your box, run
pip show f5-sdk
To upgrade to the latest, run
pip install --upgrade f5-sdk
A sample code for host_info:
from f5.bigip import ManagementRoot mgmt = ManagementRoot('xx.xx.xx.xx', 'admin', 'passwd') host = mgmt.tm.sys.host_info.load() def recurse(dictionary, level): for key, value in dictionary.iteritems(): if isinstance(value, dict): print('{}{}:'.format(' '*level, key)) recurse(value, level+1) else: print('{} {} : {}'.format(' '*level, key, value)) recurse(host.raw, 0)
- Satoshi_Toyosa1Ret. Employee
A sample code:
from f5.bigip import ManagementRoot mgmt = ManagementRoot('192.168.184.30', 'admin', 'admin') logicalDisk = mgmt.tm.sys.disk.logical_disks.get_collection() diskKeys = ['mode', 'size', 'vgFree', 'vgInUse', 'vgReserved'] for ld in logicalDisk: print('--- list sys disk logical-disk {} all-properties ---'.format(ld.__dict__['name'])) for k in diskKeys: print('{:<15} {}'.format(k, ld.__dict__[k]))
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com