Forum Discussion
ltaylor510_5583
Nimbostratus
Sep 18, 2008Perl script to display All BigIP pool members
I have a Perl CGI application in apache that will need a perl script to display all the available elements in one script:
("poolname" "address" "port" "session_state" "priority_group")
preferably in a toggle script under the showPoolMembers() subroutine.
I see the get_priority() method is only listed as a java method. Is there a perl equivalent that could list all of these elements in one script?
thanks in advance for any help.
- None of our methods are Java only. Where are you seeing that documented? iControl is a web service (SOAP) based API so all the methods are language independent. If you choose to use perl, then you have access to all the same methods that you would if you were using Java or .Net.
- ltaylor510_5583
Nimbostratus
- ltaylor510_5583
Nimbostratus
Joe, - From the error it looks as if you are attempting to access the LocalLB.Pool.get_priority() method which does not exist. You want to be going to the LocalLB.PoolMember interface. Are you defining your $PoolMember variable corectly?
$PoolMember = SOAP::Lite -> uri('urn:iControl:LocalLB/PoolMember') -> readable(1) -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
$PoolMember = SOAP::Lite -> uri('urn:iControl:LocalLB/Pool') -> readable(1) -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
- ltaylor510_5583
Nimbostratus
Hello Joe, - I'll have to check this out this weekend. From a first glance it looks like your issue is with the the loop over the member_state inside the member_priority foreach. Both of those arrays will be the same size for the given pool index. You'll want to do a for loop, looping over the length of those arrays and pull out the separate entries together. I'll get something whipped up for you by Monday.
- hwidjaja_37598
Altostratus
Pls read next post - hwidjaja_37598
Altostratus
Try the attached file. - Try this out:
sub showPoolMembers() { my (@pool_list) = @_; my @sortedPool = sort { lc($a) cmp lc($b) } @pool_list; my @member_state_lists = &getPoolMemberStates(@sortedPool); my @member_priority_lists = &getPoolPriority(@sortedPool); print "Pool Members Enabled State\n"; print "==========================\n"; $i = 0; for $i (0 .. scalar(@sortedPool)-1) { $pool = @sortedPool[ $i ]; @MemberSessionStateList = @{@member_state_lists[ $i ]}; @MemberPriorityList = @{@member_priority_lists[ $i ]}; for $j (0 .. scalar(@MemberSessionStateList)-1) { $MemberSessionState = @MemberSessionStateList[ $j ]; $MemberPriority = @MemberPriorityList[ $j ]; $member = $MemberSessionState->{"member"}; $address = $member->{"address"}; $port = $member->{"port"}; $session_state = $MemberSessionState->{"session_state"}; $priority = $MemberPriority->{"priority"}; print "$pool:$address:$port:$session_state:$priority\n"; } } }
- ltaylor510_5583
Nimbostratus
Joe,
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects