Collect all partitions all type wideip and its pools members status with tmsh script
Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.
Short Description
Collect all types of wideips and its pools members status(support AS3 wideip) using tmsh script,You can use it to save the final data as CSV
Problem solved by this Code Snippet
When using icontrolrest api to collect all pool members ip and port and status from WideIPs, if there are over 2000 wideIPs, there will often be issues with timeout or high control level CPU. Using tmsh script results in low performance loss and decent speed, with 1800+ wideIPs taking 3 minutes to generate CSV
Utilized tcl compile_json function converts the format of the array in pools into JSON string format, and also performs special processing on the characters in JSON in the CSV file
In the future, using Python, import csv,json, and json. loads() can easily convert the pools in CSV files into list dictionary format, making it convenient for you to convert CSV format into the format you want to store, such as JSON
How to use this Code Snippet
load sys config merge from-terminal
Copy and paste the code, then Press CTRL-D to submit
tmsh run cli script wideip-networkmap.tcl > /var/tmp/gtm-wideip.csv
Code Snippet Meta Information
- Version: tested with tmos V12.1.6, V14.1.5, V16.1.2
- Coding Language: tcl/tmsh
Full Code Snippet
Tmsh script code in txt of zip compressed package