Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

export F5 ltm virtual servers and pool members to excel or csv

keenon_49862
Nimbostratus
Nimbostratus

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?

 

17 REPLIES 17

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_49862
Nimbostratus
Nimbostratus

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_41673
Nimbostratus
Nimbostratus

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

 

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

 

Venkatar
Nimbostratus
Nimbostratus

Thanks a lot Jay for the command. It is really great. Can you please add Node members IP and status.

 

Patric
Altostratus
Altostratus

Is it possible to have this done with REST API call instead?

 

Ricky_77387
Nimbostratus
Nimbostratus

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.

 

works really good if you were smart and didn't use Partitions. Ug!

 

Trying to make this awesome script work with Partitions.

 

Hi WildWeasel,

 

Are you able to prepare script with partitions.

 

thanks,

Samares

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?

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.

SivaYenduri
Cirrus
Cirrus

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_K
Nimbostratus
Nimbostratus

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

f51
Cirrostratus
Cirrostratus

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

EGComacho
Nimbostratus
Nimbostratus

Hi all, 
Can someone please confirm how can I run the script in a partition?

I need to export F5 config from a F5 LTM to another and there's a lot of configuration. Please help me to find a way to export and import F5 LTM configurations (VS, pool, nodes). The difference is that in the new F5 LTM the VS IPs, nodes IP and server names are different, but the rest is the same.
This is a like to like migration.