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

  1. Version: tested with tmos V12.1.6, V14.1.5, V16.1.2
  2. Coding Language: tcl/tmsh

Full Code Snippet

Tmsh script code in txt of zip compressed package

Updated Jan 04, 2024
Version 6.0

Was this article helpful?

2 Comments

  • xuwen's avatar
    xuwen
    Icon for Cumulonimbus rankCumulonimbus

    If pool members are IP, the format is vs-name, vs-destination, status, state
    If pool members are domain names, the format is server-name, status, state

     

  • Can I be a bit more granular, like collecting wideips corresponding to the ip under the pool member