Forum Discussion

Al_Faller_1969's avatar
Al_Faller_1969
Icon for Nimbostratus rankNimbostratus
May 09, 2006

Determining Failover State with Perl & iControl

Hi All -

 

 

I'm new to iControl, but old to perl. I'm attempting to determine the active/passive state of my F5 BigIPs using the SDK and perl. I think I'm on the right track, but I'm not getting any data back from the BigIP. I basically hacked apart one of the samples and came up with the attached code. Please note that I am able to run the sample code. Any idea why I get nothing?

 

Here is what I get when I run it:

 

 

$ ./SystemState.pl bigip 443 admin adminpw

 

==========================================================

 

System State

 

------------------

 

 

$

 

 

Thanks in advance!

 

 

  • You left a bit of the old code in the response parsing. The get_failover_state() method returns an enum containing the current failover state. This should work for you:

     

     

    sub getSystemState()
    {
      print "==========================================================\n";
      print "System State\n";
      print "------------------\n";
      $soapResponse = $soap->get_failover_state();
      if ( $soapResponse->fault )
      {
        print $soapResponse->faultcode, " ", $soapResponse->faultstring, "\n";
      }
      else
      {
        $FailoverState = $soapResponse->result;
        print "State: $FailoverState\n";
      }
    }

     

     

    -Joe