Forum Discussion
Feb 06, 2009
This should do it for you. This is a VB console app that takes as input a pool name and a single member ip/port and displays the statistics for it. You should be able to extend this by adding more values to the arrays. You could also use the LocalLBPool.get_member() method to return the members for the supplied pool name and use that as the array values.
Module Module1
Dim m_interfaces As iControl.Interfaces = New iControl.Interfaces()
Public Class CApp
Public Sub Run()
Dim args As String() = System.Environment.GetCommandLineArgs()
If (args.Length < 7) Then
Usage()
Else
If (m_interfaces.initialize(args(1), args(2), args(3))) Then
GetPoolMemberStats(args(4), args(5), Convert.ToInt32(args(6)))
End If
End If
End Sub
Public Sub Usage()
Console.WriteLine("VBTest.exe bigip username password pool member port")
End Sub
Public Sub GetPoolMemberStats(ByVal pool As String, ByVal member_addr As String, ByVal member_port As Integer)
Dim poolNameA() As String = New String() {pool}
' Declare jagged (2-d) array for member definitions
Dim memberDefAofA()() As iControl.CommonIPPortDefinition
memberDefAofA = New iControl.CommonIPPortDefinition(0)() {}
' Allocate the first dimesion
memberDefAofA(0) = New iControl.CommonIPPortDefinition(0) {}
' allocate the second dimension
memberDefAofA(0)(0) = New iControl.CommonIPPortDefinition()
memberDefAofA(0)(0).address = member_addr
memberDefAofA(0)(0).port = member_port
Dim memberStatsA() As iControl.LocalLBPoolMemberMemberStatistics
memberStatsA = m_interfaces.LocalLBPoolMember.get_statistics(poolNameA, memberDefAofA)
Dim memberAddr As String
Dim memberPort As Integer
Dim type As iControl.CommonStatisticType
Dim Value As iControl.CommonULong64
' Loop over all the pools
For i As Integer = 0 To poolNameA.Length - 1
' Loop over all the pool members for each pool
For j As Integer = 0 To memberStatsA(i).statistics.Length - 1
memberAddr = memberStatsA(i).statistics(j).member.address
memberPort = memberStatsA(i).statistics(j).member.port
Console.WriteLine("Stats for Pool " & poolNameA(i) & " member " & _
memberAddr & ":" & memberPort.ToString())
' Loop over all the metrics for each pool member
For k As Integer = 0 To memberStatsA(i).statistics(j).statistics.Length - 1
type = memberStatsA(i).statistics(j).statistics(k).type
Value = memberStatsA(i).statistics(j).statistics(k).value
Console.WriteLine(" " & type.ToString() & " = (" & Value.high.ToString() & ", " & Value.low.ToString() & ")")
Next
Next
Next
End Sub
End Class
Sub Main()
Dim theApp As CApp
theApp = New CApp
theApp.Run()
End Sub
End Module
Hope this helps..
-Joe