Steffen_Beach_8
Feb 15, 2010Nimbostratus
Polling all current connections from all default pools
So I've been playing around with iControl in preparation of building a custom web interface for my NOC and deployment tool for us engineers. While doing what I would think would be a simple query (snippet below) I've kicked the snot out of my ltm... It times out if I try to collect all data, and there is a nasty spike in CPU. This is on an 8900, which I would think could process this request no problemo.
Here is the summary of objects:
Virtual Servers 166
Pools 246
Nodes 1196
My question is, why does this cause such havoc, and what would be a better approach to getting what I need?
My initial thought to making things more manageable is storing some data (virtual server/pool names) in a DB and performing my own batch calls. More work that I thought would be needed given that the interface accepts (forces) array data types for multi object lookups.
Here is my code snippet:
static void Main(string[] args)
{
Interfaces m_interfaces = new Interfaces();
string ipAddress = "********";
string user = "**********";
string pass = "********";
//Initalize the f5 interface
m_interfaces.initialize(ipAddress, user, pass);
//Check if inialized
if (!m_interfaces.initialized)
Environment.Exit(Environment.ExitCode);
//Get the partition list to drop into PROD
ManagementPartitionAuthZPartition[] partitionList = m_interfaces.ManagementPartition.get_partition_list();
for (int i = 0; i < partitionList.Length; i++)
{
if (partitionList[ i ].partition_name == "PROD")
m_interfaces.ManagementPartition.set_active_partition(partitionList[ i ].partition_name);
}
// TEST DATA
//string[] vsName = new string[1];
//vsName[0] = "vs_products_http";
//string[] localDefaultPools = m_interfaces.LocalLBVirtualServer.get_default_pool_name(vsName);
// END TEST DATA
//Get all virtual servers
string[] localVirtualServers = m_interfaces.LocalLBVirtualServer.get_list();
//Get all the active default pools
string[] localDefaultPools = m_interfaces.LocalLBVirtualServer.get_default_pool_name(localVirtualServers);
//Get the pool stats
LocalLBPoolPoolStatistics poolStats = m_interfaces.LocalLBPool.get_statistics(localDefaultPools);
//Get the pool stat entries
LocalLBPoolPoolStatisticEntry[] poolStatEntries = poolStats.statistics;
//Loop through each pool and print out the server side current connection stats
for (int i = 0; i < poolStatEntries.Length; i++)
{
CommonStatistic[] commonStats = poolStatEntries[ i ].statistics;
for (int x = 0; x < commonStats.Length; x++)
{
if (commonStats[x].type == CommonStatisticType.STATISTIC_SERVER_SIDE_CURRENT_CONNECTIONS && poolStatEntries[ i ].pool_name != "")
{
CommonULong64 commonValue = commonStats[x].value;
Console.WriteLine("Pool name: {0} Current connections: {1}", poolStatEntries[ i ].pool_name, commonValue.low.ToString());
}
}
}
}