Forum Discussion

kanarene_49054's avatar
kanarene_49054
Icon for Nimbostratus rankNimbostratus
Jan 03, 2013

looking for example LocalLB::Pool::get_member_monitor_status

Hello,

 

I am looking for example LocalLB::Pool::get_member_monitor_status.

 

Im trying in perl.. but i dont manage.

 

 

1 Reply

  • Hi kanarene,

    The method that you are trying to use was not introduced until v11.0.0, so it may not be available to you depending on what version you are running.

    I don't know Perl, so I can't help you there, but I can show you a working example in C if you are interested.

    
    //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");
                        }
                    }
                }
            }
    

    This is the output:

    Pool Name: /Common/Test.Pool

    Member: /Common/10.10.10.10:80

    Member Status: MONITOR_STATUS_ADDRESS_DOWN

    Pool Name: /Common/Test.Pool

    Member: /Common/20.20.20.20:80

    Member Status: MONITOR_STATUS_ADDRESS_DOWN

    Pool Name: /Common/Test.Pool

    Member: /Common/30.30.30.30:80

    Member Status: MONITOR_STATUS_FORCED_DOWN

    The iControl API Reference Wiki might help a lot too.

    Hope this helps.