Forum Discussion
royster_128009
Nimbostratus
Oct 03, 2003Using iControl with Health Monitors
Hi,
I have been using BIGIPs at our company for several of our customers for a couple of years.
I have written custom monitors using perl before testing appilication avai...
Oct 03, 2003
Assuming you are running BIG-IP v4.5 you should have the necessary perl modules to execute iControl methods. The SDK includes sample code in for interacting with nodes including querying the states. The specific methods you are looking for are set_state() and set_availability() located in the ITCMLocalLB::Node namespace.
The only possible issue with using iControl on the box is that the perl script will have to have the local web username and password included which could be considered a security issue. The scenarios we generally see our customers using are
1. External Montoring
Basically this is using their own monitoring applications and making node provisioning method calls from the external application.
2. Server self monitoring
In this case logic is put on the webservers so they can report their own health to the BIG-IP. This is beneficial as the server has more information about it's "health" than any outside entity could. The downside to this approach is that custom code needs to be developed and maintained on the servers.
So, with that being said, if you (and your customers) are comfortable with putting the user credentials in the script it should be very straightforward to develop this script.
The following methods would be used:
// For draining connections to a node server (ie. 10.10.10.10:80)
void ITCMLocalLB::Node::set_availability(
in IPPortDefinition[] node_defs,
in AvailabilityState state
);
// For stopping connectivity to a node server (ie. 10.10.10.10:80)
void ITCMLocalLB::Node::set_state(
in IPPortDefinition[] node_defs,
in EnabledState state
);
Here's some code segments that might help in developing the code (forgive me for any typos as I'm writing this on the fly).
use SOAP::Lite;
$sBIGIPAddress = ""; Enter local BIG-IP address here
$sUID = ""; Enter Local Username here
$sPWD = ""; Enter Local Password here
$sNodeIP = ""; Set to nodes ip address
$sNodePort = ""; Set to node's port
$node_definition = { address => $sNodeIP, port => $sNodePort };
$AVAILABILITY_UP = 2;
$AVAILABILITY_DOWN = 1;
$STATE_DISABLED = 0;
$STATE_ENABLED = 1;
sub SOAP::Transport::HTTP::Client::get_basic_credentials
{
return "$sUID" => "$sPWD";
}
$LocalLBNode = SOAP::Lite
-> url('urn:iControl:ITCMLocalLB/Node')
-> readable(1)
-> proxy('https://$sBIGIPAddress/iControl/iControlPortal.cgi');
poll webserver for status code
$sResponse = &pollWebServer();
perform node action based on status code
if ( "OK" eq $sResponse )
{
$LocalLBNode->set_state
(
SOAP::Data->name ( node_defs => [$node_definition] ),
SOAP::Data->name ( state => $STATE_ENABLED )
);
Check for fault
$LocalLBNode->set_availability
(
SOAP::Data->name ( node_defs => [$node_definition] ),
SOAP::Data->name ( state => $AVAILABILITY_UP )
)
Check for fault
}
elsif ( "NoNew" eq $sResponse )
{
"drain" connections
$LocalLBNode->set_availability
(
SOAP::Data->name ( node_defs => [$node_definition] ),
SOAP::Data->name ( state => $AVAILABILITY_DOWN )
)
}
elsif ( "NotOK" eq $sResponse )
{
stop traffic
$LocalLBNode->set_state
(
SOAP::Data->name ( node_defs => [$node_definition] ),
SOAP::Data->name ( state => $STATE_DISABLED )
);
Check for fault
}
Good luck and let us know how things go...
-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