Forum Discussion
ltp_55848
Aug 31, 2011Nimbostratus
Perl iControl package
Hi All,
I've been working on this off and on for some time now and I thought others may find it useful. It's still somewhat rough around the edges and is still a work in progress but basic functionality for common tasks exists.
http://search.cpan.org/~ltp/iControl-0.01/lib/iControl.pm
Using the module, you can undertake simple tasks with (hopefully) less code like the following examples.
First; include the module and create a new iControl object;
use iControl;
my $ic = iControl->new(
server => 'myf5.company.com',
username => 'username',
password => 'password',
port => 443,
proto => 'https'
);
Then, to list all virtual servers and their default pools;
foreach my $vs ($ic->get_vs_list()) {
print "Virtual server: $vs, Pool: ", @{$ic->get_default_pool_name($vs)}[0], "\n";
}
Will output something similar to;
Virtual: my_virtual_name, Pool: my_pool_name
...
Or to print the statistics for each configured virtual server;
foreach my $vs ($ic->get_vs_list()) {
print "\n\n$vs\n";
my %stats = $ic->get_vs_statistics_stringified($vs);
foreach (sort keys %{$stats{stats}}) {
print "$_: $stats{stats}{$_}\n";
}
}
Will output for each virtual server:
virtual_server_name
STATISTIC_CLIENT_SIDE_BYTES_IN: 52688
STATISTIC_CLIENT_SIDE_BYTES_OUT: 30680
STATISTIC_CLIENT_SIDE_CURRENT_CONNECTIONS: 0
STATISTIC_CLIENT_SIDE_MAXIMUM_CONNECTIONS: 4
STATISTIC_CLIENT_SIDE_PACKETS_IN: 981
STATISTIC_CLIENT_SIDE_PACKETS_OUT: 682
STATISTIC_CLIENT_SIDE_TOTAL_CONNECTIONS: 637
STATISTIC_CURRENT_PVA_ASSISTED_CONNECTIONS: 0
...full stats truncated...
Feel free to let me know of any bugs you find. I'll be adding methods as I find a need for them and updating the module when I do.
Cheers,- hooleylistCirrostratusThat looks really cool. Do you have any plans to support the v11 iControl SDK at some point?
- ltp_55848NimbostratusHi Hoolio,
- Grain_131632NimbostratusHI.ltp,it's so cool... but ,I have a question,how to get ltm vs availability status ??....do you have same ideas?
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