Forum Discussion
Pushkar_73645
Nimbostratus
Aug 23, 2010php 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
7 Replies
- samstep
Cirrocumulus
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 - Pushkar_73645
Nimbostratus
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? - JRahm
Admin
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 - Richard_Jones
Nimbostratus
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 - Pushkar_73645
Nimbostratus
$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. - Richard_Jones
Nimbostratus
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? - Pushkar_73645
Nimbostratus
yes $server is a node address.
I have unsuccessfully tried to disable pool member. still trying to troubleshoot it.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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