A Catch from the Codeshare: Connection Lists
On the side of the road in northern Missouri just north of Mark Twain’s stomping grounds, there is a slice of hillside removed just to the side of the highway. In Arkansas, there’s a nondescript field tucked away in a state park. Short of word of mouth and this thing they call the internet, you wouldn’t be any the wiser that buried or surfaced in these two locations are an amazing variety of geodes and diamonds, respectively. In this article series I will explore recent and well-aged gems from the codeshare, highlighting inventive solutions contributed by you, the community. Please join me on this great adventure as we oscillate on the Mohs’ scale of codeshare geekery.
Connection Lists via iControl REST
Community member and fellow St. Louisan Jason Cohen snuck this baby in during the dark offices time between Christmas and New Years. It deserves to see the light of day! We get a lot of questions on the site on how to get connection data out of the BIG-IP. This is tricky, as using the management interface to download connection data where that data set might be very very large can compromise system resources. Thankfully, Jason wisely includes a filter requirement in this script. After the initial requirement you can add as many filter properties as you like and the values to those properties you wish to match. You can also specify the output to be raw, json, or excel, which is very handy indeed. Here’s an example run on my laptop’s BIG-IP with the raw format:
FLD-ML-RAHM:downloads rahm$ python cl.py -r -f protocol=tcp admin@172.16.44.15 Password: Sys::Connections 172.16.15.6:47200 208.87.139.148:443 172.16.15.6:47200 208.87.139.148:443 tcp 22 (tmm: 1) none 192.168.102.1:63857 192.168.102.62:80 192.168.103.6:63857 192.168.103.50:80 tcp 5 (tmm: 1) none 192.168.102.1:63828 192.168.102.62:80 192.168.103.6:63828 192.168.103.50:80 tcp 7 (tmm: 0) none 192.168.102.1:63855 192.168.102.62:80 192.168.103.6:63855 192.168.103.50:80 tcp 5 (tmm: 1) none 192.168.102.1:63837 192.168.102.62:80 192.168.103.6:63837 192.168.103.50:80 tcp 6 (tmm: 1) none 192.168.102.1:63851 192.168.102.62:80 192.168.103.6:63851 192.168.103.50:80 tcp 6 (tmm: 1) none Total records returned: 6
This script is written in python and supported in 2.x and 3.x branches. Developed against BIG-IP version 11.6. I did have an issue with the json and excel export on my 12.0 image, so I’ll debug that later and provide a patch, however the raw works great.
Thank you Jason for this excellent catch from the codeshare!