Forum Discussion
1 Reply
Sort By
- Michael_YatesNimbostratusHi kanarene,
//Custom Class public class PoolMember { public string PoolName { get; set; } public string Address { get; set; } public Int64 Port { get; set; } public string Status { get; set; } public CommonAddressPort F5DataFormatv2 { get; set; } } List _poolmember = new List(); private void GetPoolMemberList(string partition, string pool) { Interfaces f5Interface = new Interfaces(); //Initialize Connection to Device if (f5Interface.initialize(connection.hostname, connection.username, connection.password)) { //Set Active Partition f5Interface.ManagementPartition.set_active_partition(partition); //Retrieve Get Pool Member List CommonAddressPort[][] poolmemberlist = f5Interface.LocalLBPool.get_member_v2(new[] { pool }); //Populate Pool Member information into PoolMember Class and add it to the List of PoolMembers foreach (CommonAddressPort node in poolmemberlist[0]) { PoolMember member = new PoolMember {PoolName = pool, Address = node.address, Port = node.port, F5DataFormatv2 = node}; _poolmember.Add(member); } } GetPoolMemberStatus(partition, _poolmember); } private void GetPoolMemberStatus(string partition, List poolmembers) { Interfaces f5Interface = new Interfaces(); //Initialize Connection to Device if (f5Interface.initialize(connection.hostname, connection.username, connection.password)) { //Set Active Partition f5Interface.ManagementPartition.set_active_partition(partition); //Go through the List, collect status and dump to screen. foreach (PoolMember member in poolmembers) { //Method requires a multi-dimensional array for input. Add CommonAddressPort to new List List convertedserverlist = new List {member.F5DataFormatv2}; //Convert List to Array for input into the next method CommonAddressPort[] targetarry = convertedserverlist.ToArray(); //Call the BIG-IP - Inputs are an array of Pool Names and a multi-dimensional array of CommonAddressPorts LocalLBMonitorStatus[][] targetstatus = f5Interface.LocalLBPool.get_member_monitor_status(new[] { member.PoolName }, new[] { targetarry }); //Only requested a single pool, so specify the first dimension and collect data for output. foreach (LocalLBMonitorStatus status in targetstatus[0]) { rtb_output.AppendText("Pool Name: " + member.PoolName + "\r\n"); rtb_output.AppendText("Member: " + member.Address + ":" + member.Port + "\r\n"); rtb_output.AppendText("Member Status: " + status + "\r\n"); } } } }