While web-based applications are commonly desirable for distributed management, desktop client applications still have their advantages. Graphical based applications are still primarily developed for the desktop as a target and this tech tip demonstrates how iControl can simplify development of these types of applications.


 

Language: C#

 

 

 

 

 

 

Contents

Introduction

SDK Components Referenced

Application Walkthrough

  Connection Dialog

  Main Window

  Traffic Distribution

  Pool Configuration

Summary

Related Links








Introduction top

 

With iControl, F5 networking device features and functionality are programmatically accessible to virtually any application.  There are situations when web based applications are optimal for distributed management, but web interfaces have limitations and are most optimally run with the least amount of client side code as possible.  Graphical based applications are still primarily developed for the desktop as a target and this sample application demonstrates how iControl can simplify development of these types of applications.  The Distribution Monitor sample was written in C#, but could just as easily be developed in another language or platform.





SDK Components Referenced top

 

The following components of the SDK were referenced in this sample application.

Interfaces:
    ITCMLocalLB::Node
    ITCMLocalLB::Pool
    ITCMSystem::SystemInfo
Methods:
ITCMSystem::SystemInfo
    ProductInformation[] get_product_info  (void);
ITCMLocalLB::Node
    AvailabilityState    get_availability  (IPPortDefinition node_def);
    void                 get_list          (out String [] node_addresses);
    EnabledState         get_state         (IPPortDefinition node_def);
    void                 get_statistics    (String pool_name,
                                            out NodeStatistics stats);
    void                 set_state         (IPPortDefinition [] node_defs,
                                            EnabledState state);
ITCMLocalLB::Pool
    LBMethod             get_lb_method     (String pool_name);
    void                 get_list          (out String[] pool_names);
    void                 get_member_list   (String pool_name,
                                            IPPortDefinition [] members);
Structures:
    struct ProductInformation
    {
        String product_code;
        String product_version;
        String package_version;
        String package_edition;
        String String[] product_features;
    };
    struct IPPortDefinition
    {
        String address;
        long port;
    };
    struct NodeStatistics
    {
        ThruputStatistics thruput_stats;
        ConnectionStatistics connection_stats;
    };
    struct ThruputStatistics
    {
        unsigned long long bits_in;
        unsigned long long bits_out;
        unsigned long long packets_in;
        unsigned long long packets_out;
    };
    struct ConnectionStatistics
    {
        unsigned long long current_connections;
        unsigned long long maximum_connections;
        unsigned long long total_connections;
    };
Enumerations:
    enum EnabledState
    {
        STATE_DISABLED,
        STATE_ENABLED,
    };
    enum AvailabilityState
    {
        AVAILABILITY_UNCHECKED,
        AVAILABILITY_DOWN,
        AVAILABILITY_UP,
        AVAILABILITY_CHECKING,
        AVAILABILITY_FORCED_DOWN,
        AVAILABILITY_ADDR_DOWN,
        AVAILABILITY_UNKNOWN,
        AVAILABILITY_MAINT,
        AVAILABILITY_ENABLED,
        AVAILABILITY_DISABLED,
        AVAILABILITY_ADDR_DISABLED,
        AVAILABILITY_PORT_DISABLED,
    };
    enum LBMethod
    {
        LB_METHOD_ROUND_ROBIN,
        LB_METHOD_RATIO,
        LB_METHOD_FASTEST,
        LB_METHOD_RATIO_MEMBER,
        LB_METHOD_LEAST_CONN_MEMBER,
        LB_METHOD_OBSERVED_MEMBER,
        LB_METHOD_PREDICTIVE_MEMBER,
        LB_METHOD_OBSERVED_NODE_ADDR,
        LB_METHOD_PREDICTIVE_NODE_ADDR,
        LB_METHOD_DYNAMIC_RATIO,
    };

 

 





Application Walkthrough top

 

 





Connection Dialog top

 

The application starts up with the main window displayed.  The first step is to add a BIG-IP to the main window's tree view.   By clicking on the "Add BIG-IP" link on the main window, the application displays the connection dialog. At this point the user will enter the address of the BIG-IP as well as the user credentials needed to establish the iControl communications.



 



Once the OK link is clicked, the application attempts to connect to the specified BIG-IP and retrieve the product information using the ITCMSystem::SystemInfo interface.  

The SDK components referenced in this section of code include:

Interfaces:
    ITCMSystem::SystemInfo
Methods:
    ProductInformation[] get_product_info  (void);
Structures:
    struct ProductInformation
    {
        String product_code;
        String product_version;
        String package_version;
        String package_edition;
        String String[] product_features;
    };

 

 





Main Window top

 

Assuming the address and credentials are valid, the ITCMLocalLB::Pool interface is then used to propagate the tree view with the pools available on the BIG-IP.


 



The available pools on the BIG-IP are now displayed under the BIG-IP branch on the tree.  Multiple BIG-IP's can be added to the tree by repeating the same procedures described above.  When one of the pools is selected in the tree, the "Monitor Traffic" link becomes enabled.  Clicking on this link will bring up the Traffic Distribution window.

The SDK components referenced in this section of code include:

Interfaces:
    ITCMLocalLB::Pool
Methods:
    void                 get_list          (out String[] pool_names);

 

 





Traffic Distribution top

 

The Traffic Distribution dialog will collect connection and traffic statistics for the given specified pool and plot them over time.  The polling interval is specified in the Collection Interval edit box with a default value of 10 seconds.  By clicking on the "Start" link, the data collection timer is enabled causing data collection to begin.  The ITCMLocalLB::Pool interface is used to get a list of the members in the given pool and the ITCMLocalLB::Node interface is then used to collect the statistics for the pool members.  At the completion of each data collection cycle, the connection statistics are presented by value for the current connections, and the throughput statistics are converted to a rate of bits/second for the total traffic.


 



The SDK components referenced in this section of code include:

Interfaces:
    ITCMLocalLB::Node
    ITCMLocalLB::Pool
Methods:
    void                 get_statistics    (String pool_name,
                                            out NodeStatistics stats);
    void                 get_member_list   (String pool_name,
                                            IPPortDefinition [] members);
 
Structures:
    struct IPPortDefinition
    {
        String address;
        long port;
    };
    struct NodeStatistics
    {
        ThruputStatistics thruput_stats;
        ConnectionStatistics connection_stats;
    };
    struct ThruputStatistics
    {
        unsigned long long bits_in;
        unsigned long long bits_out;
        unsigned long long packets_in;
        unsigned long long packets_out;
    };
    struct ConnectionStatistics
    {
        unsigned long long current_connections;
        unsigned long long maximum_connections;
        unsigned long long total_connections;
    };
Enumerations:
    ProductInformation[] get_product_info      (void);

 

 





Pool Configuration top

 

The ability to view a view and modify various aspects of a pools configuration has been added to this application.  By clicking on the "Configure" link on the Traffic Distribution dialog, the Pool Configuration dialog will be presented.  This is very similar to the pool configuration page on the BIG-IP web management interface.  The following features are available on this page


  • View and modify the load balancing method for the pool.
  • Add or remove members from the pool.
  • Enable or disable existing members in the pool.

 

 

By selecting the "Apply" link, any modifications that have been made to the pool will be sent to the BIG-IP and take effect on the next cycle of data collection.

 

The SDK components referenced in this section of code include:

Interfaces:
    ITCMLocalLB::Node
    ITCMLocalLB::Pool
Methods:
I   void                 get_list          (out String [] node_addresses);
    EnabledState         get_state         (IPPortDefinition node_def);
    AvailabilityState    get_availability  (IPPortDefinition node_def);
    void                 set_state         (IPPortDefinition [] node_defs,
                                            EnabledState state);
    LBMethod             get_lb_method     (String pool_name);
    void                 get_list          (out String[] pool_names);
    void                 get_member_list   (String pool_name,
                                            IPPortDefinition [] members);
Structures:
   struct IPPortDefinition
    {
        String address;
        long port;
    };
Enumerations:
    enum EnabledState
    {
        STATE_DISABLED,
        STATE_ENABLED,
    };
    enum AvailabilityState
    {
        AVAILABILITY_UNCHECKED,
        AVAILABILITY_DOWN,
        AVAILABILITY_UP,
        AVAILABILITY_CHECKING,
        AVAILABILITY_FORCED_DOWN,
        AVAILABILITY_ADDR_DOWN,
        AVAILABILITY_UNKNOWN,
        AVAILABILITY_MAINT,
        AVAILABILITY_ENABLED,
        AVAILABILITY_DISABLED,
        AVAILABILITY_ADDR_DISABLED,
        AVAILABILITY_PORT_DISABLED,
    };
    enum LBMethod
    {
        LB_METHOD_ROUND_ROBIN,
        LB_METHOD_RATIO,
        LB_METHOD_FASTEST,
        LB_METHOD_RATIO_MEMBER,
        LB_METHOD_LEAST_CONN_MEMBER,
        LB_METHOD_OBSERVED_MEMBER,
        LB_METHOD_PREDICTIVE_MEMBER,
        LB_METHOD_OBSERVED_NODE_ADDR,
        LB_METHOD_PREDICTIVE_NODE_ADDR,
        LB_METHOD_DYNAMIC_RATIO,
    };

 

 





Summary top

 

The Distribution Monitor sample application demonstrates how multiple components of the iControl SDK can be used to create an integrated monitoring application.  The ability to monitor application performance and capacity can help in determining optimal server provisioning and this sample serves as a starting point for that type of application.

 

The source for this application is included in the iControl SDK v4.5 distribution.





Related Links top

 

iControl Developer
MSDN XML Web Services Developer Center
Visual Studio .NET