Forum Discussion
export F5 ltm virtual servers and pool members to excel or csv
I have been hunting for something to help with doing this as I'm not a great with programming. Is there any scripts or api that can be easily used to gain this info?
you can use the tmsh script
e.g. to export the whole LTM configuration you can use
tmsh list ltm
if you need only virtual servers, you can type
tmsh list ltm virtual
Gabriel
- keenon_49862Nimbostratus
I'm looking for something in a csv without having to group them up
- Still there's iControl API ( https://clouddocs.f5.com/api/icontrol-soap/HomePage.html ) if you're looking for an API. But I wouldn't expect a simple button export..
- Jay_41673Nimbostratus
v11.6 one liner, no button :)
tmsh list ltm virtual {pool destination} | awk '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm "$0" {members} | awk '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}' > virtuals.csv
- ulpe_279563Nimbostratus
Thanks for this! The command works really well, apart from an error message and some VSes missing from export: "The requested Pool (/Common/none) was not found."
Also, would it be possible to add an iRule column to the .csv output?
Try BigIP Report?
https://devcentral.f5.com/codeshare/bigip-report
One day I'll add CSV export functionality. Surprising amount of people that has asked for it.
/Patrik
- VenkatarNimbostratus
Thanks a lot Jay for the command. It is really great. Can you please add Node members IP and status.
- PatricAltostratus
Is it possible to have this done with REST API call instead?
- Ricky_77387Nimbostratus
Hi all,
tmsh list ltm virtual {pool destination} | awk '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm "$0" {members} | awk '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}' > virtuals.csv
Jay code is perfect! It able to export the virtual server and pool for destination. Can the code be modified to allow for virtual server outbound using snat pool?
I have virtual servers used to perform the address translation, and due to an early bug with the LTM, we had to create VS for inbound NAT and outbound NAT, thus we were hoping to generate the view all the in and out bound NAT configurations done.
- WildWeaselCirrus
works really good if you were smart and didn't use Partitions. Ug!
Trying to make this awesome script work with Partitions.
- ManikuntaldNimbostratus
- ruikoh2Nimbostratus
This code is perfect if you have pools on all your virtual servers. Is there a way to tweak this in such a way that it would go next line when it doesn't see a pool for the virtual server?
- nurbinabrNimbostratus
Apologize for my lack of knowledge, where should I excecute this command, on the CLI of an SSH session? I am pretty new in the technology.
- SivaYenduriCirrus
Hello Guys,
I tried this command in v12.1,5 but didn't work. I replaced "awk" with "grep". It is executing the command without any error but not creating the output file. Can someone help?
hostname(tmos)# list ltm virtual {pool destination} | grep '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm "$0" {members} | grep '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}' > /var/tmp/virtuals.csv
Display all 133 items? (y/n) y
hostname(/Common)(tmos)#
- Ahmed_Mostafa_KNimbostratus
Hi all
I update the following script (Script to create csv file have VS name, VS IP, Pool name, Pool Members name => until they using iApps to create the VS and I think also will work with partition), could you please send your feedback.
tmsh list ltm virtual recursive {pool destination} | awk '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm recursive "$0" {members} | awk '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}' > virtuals-f5-LTM.csv
- f51Cirrostratus
Hi, I tried above script in v13 but I didn't any file with .csv
tmsh list ltm virtual {pool destination} | awk '/virtual/{printf "%s,",$3}/destination/{printf "%s,",$2}/pool/{printf "%s,",$2; system("tmsh list ltm "$0" {members} | awk '\''/:/{gsub(/ /, \"\", $0);gsub(/{/, \",\", $0);printf $s,$1}'\''");printf "\n"}' > virtuals.csv
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