Forum Discussion
jon_monts_46033
Feb 07, 2012Nimbostratus
Pycontrol 2 - issue disabling nodes
Created a script via python to disable nodes, and nodes are not being disabled. Script & log included. Any suggestions would be apperciated.
Script:
import sys
import pycont...
JRahm
Feb 10, 2012Admin
your code appears to work for me, however, the monitor state and the session state need to be disabled. Also, this interface is deprecated, so if you are on v11+, please use the NodeAddressV2 interface instead.
>>> na = b.LocalLB.NodeAddress
>>> def enable_node():
... enable_disable_node('STATE_ENABLED')
...
>>> def disable_node():
... enable_disable_node('STATE_DISABLED')
...
>>> def enable_disable_node(target_state):
... nodes = ['10.10.10.10']
... states = []
... states.append(target_state)
... na.set_session_enabled_state(nodes=nodes, states = states)
...
>>>
>>> def enable_disable_node(target_state):
... nodes = ['10.10.10.10']
... states = []
... states.append(target_state)
... na.set_session_enabled_state(node_addresses = nodes, states = states)
... na.set_monitor_state(node_addresses = nodes, states = states)
...
>>> enable_node()
>>> na.get_monitor_status(node_addresses = ['10.10.10.10'])
[MONITOR_STATUS_UNCHECKED]
>>> na.get_session_status(node_addresses = ['10.10.10.10'])
[SESSION_STATUS_ENABLED]
>>> disable_node()
>>> na.get_monitor_status(node_addresses = ['10.10.10.10'])
[MONITOR_STATUS_FORCED_DOWN]
>>> na.get_session_status(node_addresses = ['10.10.10.10'])
[SESSION_STATUS_FORCED_DISABLED]
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