f5-common-python
f5-common-python copied to clipboard
RFE: Ability to reset statistics
Issue #293 added support for pulling virtual server / pool / etc statistics but it appears that support for resetting statistics was not included. I'd like to request the addition of this functionality.
It may make sense to add a "delete" function which resets the statistics (e.g., virtual.stats.delete()
).
@jbnance hello , the way you reset stats is by issuing reset command via TMSH, from what I recall we can do this by adding ability to send command payloads to stats endpoints. I need to look at it at some point
@wojtek0806 FYI, the way this is done via rest is (for example, a pool):
POST /mgmt/tm/ltm/pool {"command": "reset-stats", "name": "testpool"}
Effectively we'll need to enable exec_cmd on collections as well.
this should be a simple addition of the CommandExecutionMixin to the collections of interest for stats. Any objections @wojtek0806 to selecting the obvious objects this would apply and starting there?
you can enable that on all of the stats endpoints here: https://github.com/F5Networks/f5-common-python/blob/6a612fcd801507f8d91f0d8e22d670379249bbf3/f5/bigip/resource.py#L1232
Modify this class to inherit from command mixin:
https://github.com/F5Networks/f5-common-python/blob/development/f5/bigip/mixins.py
Or do this per endpoint if it is less messy