You are close. You haven’t allocated a value for the monitor_states[ 0 ][ 0 ] value. This should work for you:
private void SetMonitorState(string pool, string memberaddr, long memberport)
{
string[] pool_names = new string[] { pool };
LocalLBPoolMemberMemberMonitorState[][] monitor_states;
// Allocate a 2-d array
monitor_states = new iControl.LocalLBPoolMemberMemberMonitorState[ 1 ][];
// Allocate the first dimensions value to a 1-d array of size 1
monitor_states[ 0 ] = new iControl.LocalLBPoolMemberMemberMonitorState[ 1 ];
// Allocate the value for the entry in the first element of the second dimension
monitor_states[ 0 ][ 0 ] = new iControl.LocalLBPoolMemberMemberMonitorState();
// Allocate the IPPortDefinition
monitor_states[ 0 ][ 0 ].member = new iControl.CommonIPPortDefinition();
monitor_states[ 0 ][ 0 ].member.address = memberaddr;
monitor_states[ 0 ][ 0 ].member.port = memberport;
monitor_states[ 0 ][ 0 ].monitor_state = CommonEnabledState.STATE_DISABLED;
m_interfaces.LocalLBPoolMember.set_monitor_state(pool_names, monitor_states);
}
BTW, sorry for how the forum munges brackets followed by numbers. I’m going to have to track that down one of these days.
Regarding my post, “pool member forced offline”, I see where my mistake was. I was using LocalLBPoolMemberMemberSessionState. What I really wanted was LocalLBPoolMemberMemberMonitorState. I suspect that I was not communicating clearly in the post.