Forum Discussion
Feb 24, 2015
BIG-IP : determine active device
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi
Via iControl API :
How to determine if a specific device is operating in active or standby mode for an active-standby sync-failo...
Hamish
Feb 24, 2015Cirrocumulus
Here's one from walkF5Stats that I wrote a few years back... There's some additional bits in there that track elapsed time to call, logging etc. but the important part is the call to System/Failover and get_failover_state
Now that's (below) only for a device. In v11 with traffic-groups it's slightly different. Hold on a bit and I'll see if I can dig that up (I wrote something a couple of months ago for that, just need to find it 🙂 )
sub getFailoverState {
my ($dbh, $dev)=(@_);
my $t0=[gettimeofday];
my $devID=$dev->{ID};
my $devFQDN=$dev->{FQDN};
my $icServer=$dev->{MgmtAddr};
my $icPort=$dev->{MgmtPort};
dbprint "getFailoverState: cookiejar (Before)\n";
print Dumper($cookieJar);
my $Failover = SOAP::Lite
-> uri('urn:iControl:System/Failover')
-> proxy("$sProtocol://$icUser:$icPass\@$icServer:$icPort/iControl/iControlPortal.cgi", cookie_jar => $cookieJar);
-> proxy("$sProtocol://$icUser:$icPass\@$icServer:$icPort/iControl/iControlPortal.cgi"i,
$Failover->transport->cookie_jar($cookieJar);
dbprint "getFailoverState: Getting failover state for $devFQDN\n";
my $soapResponse = $Failover->get_failover_state();
dbprint "getFailoverState: cookiejar (After)\n";
print Dumper($cookieJar);
&checkResponse($soapResponse);
my $failoverState=$soapResponse->result;
dbprint "getFailoverState: state=$failoverState\n";
my $updatestr="update device set fostate='$failoverState' where id=$devID";
dbprint "getFailoverState: SQL [$updatestr]\n";
my $update=$dbh->prepare($updatestr);
$update->execute;
my $elapsed=tv_interval ( $t0 );
log_action($elapsed, 0, "getFailoverState", "$updatestr");
}
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