Perl Ltm Config To Xml/Excel (version 3.1)
Problem this snippet solves:
This code is an improvement of "Perl Ltm Config To Xml (version 2)" published on previous DevCentral (https://devcentral.f5.com/s/articles/perl-ltm-config-to-xml-version-2-1009) queries the components of a virtual servers configuration and prints it out in an XML format. Is recursive through partitions and prints the following data:
VS_name
VS_IP: IP and port
RD (route domain)
VS_state: status (ex. green) and state (ex. enabled)
Profiles: name, type, context. If SSL profile aditional info: certificate, chain, key, cipher list
Persistence
iRules: order and name
Pool_name
LB-method: method, minimum active members
Member: name, IP, port, ratio, priority, status and state
Monitors: name, interval, timeout. If HTTP/HTTPS monitors additional info: Send and Receive strings
SNAT_name
SNAT_members
Has a new option "-s" or "-simplified" which outputs multiple values like the profile list or pool members into a unique XML field. Purpose of simplified mode is to be able to have one Virtual Server per row on Excel, with lists showing on a single cell.
This code has been tested on BIG-IP version 12.1 and 14.1.
How to use this snippet:
Default mode:
./LTM-to-XML.pl bigip uid pwd > result.xml
Example for simplified mode and removal of partition information:
./LTM-to-XML.pl -s 127.0.0.1 uid pwd | sed "s/\/.*app\///g" | sed "s/\/Common\///g" > result.xml
The XML can be dragged and dropped on MS Excel and opened as an XML table.
Code :
(see ZIP file)
Tested this on version:
12.1, 14.1
- yona_liuNimbostratus
Hi Miguel, thanks for publishing. It's very useful.
While working on version 13.1, rules can't be print in xml. Any idea for this??
And is it possible to get SNAT type Automap and print it ? - Miguel_RosaNimbostratus
Could you check if is because the monitor uses a string with some special characters like '&' or '<' or '>'?
I have updated the code to convert all below:
ampersand: & to &
greater-than: > to >
less-than: < to <
apostrophe: ' to '
quote: " to "
- StevenSharpeNimbostratus
Any ideas why I would get an error when trying to import into Excel saying '<' is not a valid character? I'm getting this where it is returning information around the monitors of a pool.