Forum Discussion
Any python experts out there? - parsing tmsh list
Hello PSFletchTheTek,
Have you tried with f5-sdk?
https://f5-sdk.readthedocs.io/en/latest/
It's an easy way to collect the config of "tmsh list" in a parsed way.
- Jul 01, 2022
So iwas going to use ansbile to run the tmsh list command and pipe its output into a file via ansible then run some python to parse it.
So i could use the sdk instead if that gives me more useable parameters.
Any suggestions on how to cleanly navigate?
I'm trying to pull together build documentation, so any parameters you can suggest you be awesome!Fletch
- Jul 01, 2022
Annoyingly,
My collegue has just pointed out, i can't use the SDK in our environment as i'm not allowed to install anything on the customers environment. (forgot that part, i got all existed about the SDK)
So i'm back to processing the tmsh list one-line output.
So if anyone can help me with the parsing that would be awesome!
Fletch
- Jul 02, 2022
Well, all the libraries used in the F5 SDK are open source, so, you can replicate the same code to your own repository. If you install it in your home lab, you will see all the files involved. I recommend you to give it a try.
Take into account that the python philosophy is to reuse the already created libraries and only create something when the current existing library doesn't solve what you are searching for. If this already exists, it doesn't make sense to create the same again. Just my POV.
- Jul 04, 2022
I do agree with you whole heartedly.
But the SDK runs off of the REST API from what i can work out.
Unfortunately i need something i can run offline, with minial tools on the custmer environment.
The concept of the SDK from inside works brillantly, but i don't have control the environment i am working in.So running tmsh list > /var/temp/list_output.txt for example and getting one of the sys admins send it to me works very nicely.
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