Forum Discussion
DFresh4130_2492
Apr 10, 2012Nimbostratus
Script to identify if unit is active or standby
Hi All,
I currently have basic operator privileges to our F5 systems. I haven't worked with F5s much in the past and have never written scripts to interact with them before.
I'm basically trying to get a script going that will return whether the F5 is currently active or standby. I tried the obvious non-programmer route first with wget, but no luck. Can someone point me to a doc that will give me the basic overview on how to get a script working that'll just login and perform what function I want on system status? Thanks
- hooleylistCirrostratusHi,
- DFresh4130_2492NimbostratusMy goal is to enhance our current deploy script. When we deploy new code to our tomcat/jboss instances our script will invoke some java code to disable a member from the pool, deploy the code and bounce then enable the member again. Rinse and repeat. Our F5 host value is hardcoded in the shell script and I would like to make the script include a check to see if the primary is currently the active F5.
- HamishCirrocumulusSome code from a past project...
sub activeUnit { my ($FailoverAPI, $icServer)=@_; print "activeUnit:\n"; my $soapResponse = $FailoverAPI->get_failover_state(); my($status,$text)=&checkResponse($soapResponse); if(($status!=1)||($text ne "OK")) { print "activeUnit: status $status error [$text] from get_failover_state()\n"; return; } print "activeUnit: status $status success [$text] from get_failover_state()\n"; print Dumper($soapResponse->result); $fostate=$soapResponse->result; print "activeUnit: status $status fostate [$fostate] from get_failover_state()\n"; return ($fostate eq "FAILOVER_STATE_ACTIVE"); }
- HamishCirrocumulusAnd also to sync from the current unit to the peer...
sub syncConfig { my($configAPI, $synctype)=@_; print "syncConfig:\n"; my $soapResponse = $configAPI->synchronize_configuration(SOAP::Data->name(sync_flag => $synctype)); my($status,$text)=&checkResponse($soapResponse); if(($status!=1)||($text ne "OK")) { print "syncConfig: status $status error [$text] from synchronize_configuration($synctype)\n"; return; } print "syncConfig: status $status success [$text] from synchronize_configuration($synctype)\n"; print "syncConfig:\n"; }
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