Forum Discussion

karan12_154818's avatar
karan12_154818
Icon for Nimbostratus rankNimbostratus
Jun 12, 2014

V10 ltm perl script to get Virtual Server IP address using tmsh show ltm virtual raw detail field-fmt

Hi

 

I am using perl script and .sh using command tmsh show ltm virtual raw detail field-fmt to fetch all the variable like Virual server ip and Pool member information and create an xls sheet using perl script.BUt i get Virtual Server Ips as all 0s.Later i notied the output for tmsh show ltm virtual raw detail field-fmt on v10 and v11 has one difference,on v11 we get destination keyword using which perl can fetch Virtual address.

 

But in version 10 there is no keyword for destination in ltm virtual.So i think if i need to fetch the same for v10 then i have to match ip address in Virtual-addresses section.I tried change my perl code ,but it does not help!!

 

Can anyone help this section of code to work for v10 also.I am sharing perl script as below:-

 

if (/^ltm virtual/../^}$/) { if (/^ltm virtual/) { (my $dummy1, my $dummy2, $vip_name)=split(" ",,); } if (/^ clientside.bits-in/) { (my $dummy1, $b_in)=split(" ",,); } print $b_in } if (/^ clientside.bits-out/) { (my $dummy1, $b_out)=split(" ",,); } print $b_out } if (/^ clientside.pkts-in/) { (my $dummy1, $p_in)=split(" ",,); } print $p_in } if (/^ clientside.pkts-out/) { (my $dummy1, $p_out)=split(" ",,); } print $p_out } if (/^ destination/) { (my $dummy1, $vip, $svc)=split(/destination |:/,,); } print $vip, $svc } if (/^ status.availability-state/) { (my $dummy1, $v_a_state)=split(/status.availability-state /,,); } print $v_a_state } if (/^ status.enabled-state/) { (my $dummy1, $v_e_state)=split(/status.enabled-state /,,); } print $v_e_state } if (/^ status.status-reason/) { (my $dummy1, $v_r_state)=split(/status.status-reason /,,); } if (/^ pools/../^ }$/) { $pm1=""; $pm2=""; $pm3=""; $pm4=""; if (/^ name/) { (my $dummy1, $pool)=split(" ",,); } if (/^ status.availability-state/) { (my $dummy1, $p_a_state)=split(" ",,); } if (/^ status.enabled-state/) { (my $dummy1, $p_e_state)=split(" ",,); } if (/^ status.status-reason/) { (my $dummy1, $p_r_state)=split(" ",,); } if (/^ active-member-cnt/) { (my $dummy1, $p_member_cnt)=split(" ",,); } if (/^ members/../^ }$/) { if (/^ addr/../^ }$/) { if (/^ addr/) { (my $dummy1, $pm1)=split(" ",,) ; } if (/^ port/) { (my $dummy1, $pm2)=split(" ",,) ; } if (/^ status.availability-state/) { (my $dummy1, $pm3)=split(" ",,); } if (/^ status.enabled-state/) { (my $dummy1, $pm4)=split(" ",,); } if (/^ }$/) { push (@pool_members,$pm1.":".$pm2."\n"); push (@pool_members_s,$pm3.",".$pm4."\n");} $pm1=$none; $pm3=""; } } } Thanks Karun

 

1 Reply

  • Probably better off putting it a gist and providing a link here... if you want to post it here, paste it again, highlight all the lines then hit tab. This will protect the formatting.