php based solution of icontrol

Hi,

I am trying to write an php script to enable and disable nodes.

I was trying to use following call. I get $serv value from my previous call to LB which get list of all servers.

I see myself entering the loop. But the node is not disabled.

if ($serv == “192.168.100.50”){

echo “test”;

$client3->set_monitor_state($serv,“STATE_DISABLED”);

}

Thanks,

Pushkar

set_monitor_state method takes an array of nodes as a first parameter, not a string, check out the API documentation:

http://devcentral.f5.com/wiki/default.aspx/iControl/LocalLB\_\_NodeAddress\_\_set\_monitor\_state.html

You will also need to disable the session state using set_session_enabled_state in order to disable the node

Thanks.

It requires both node address and session enabled state as an array. It works for me now.

Another question ralated to this is that when i disable using set_monitor_state and set_session_enabled_state, the node goes into Forced Offline mode.

Is there a way of changing node state to Disabled and not Forced Offline?

Enabled (All traffic allowed):

set_monitor_state : STATE_ENABLED

set_session_enabled_state : STATE_ENABLED

Disabled (Only persistent or active connections allowed):

set_monitor_state : STATE_ENABLED

set_session_enabled_state : STATE_DISABLED

Forced Offline (Only active connections allowed):

set_monitor_state : STATE_DISABLED

set_session_enabled_state : STATE_DISABLED

Pushkar,

Can you post the PHP code you used for setting up your arrays and calling set_session_enabled_state and set_monitor_state?

I got the set_monitor_state working (I think), but I can’t seem to get the set_session_enabled_state function called correctly.

Thanks

$servers = array(0=>$server);

$state = array (0=>“STATE_DISABLED”);

$client3->set_monitor_state($servers,$state);

$client3->set_session_enabled_state($servers,$state);

I am just trying to disable 1 node at a time.

Thanks! Unfortunately, it doesn’t seem to work for me. I assume $server is the node address? What about for disabling a pool member? Have you tried that at all?

yes $server is a node address.

I have unsuccessfully tried to disable pool member. still trying to troubleshoot it.