iC2I: Dumping a Node

In this installment, we continue the series started with dumping a Virtual and dumping a Pool. We're working toward the ability to dump your BIG-IP from the command line, but taking it one step at a time.

There really isn't much new to dumping a node, nodes are pretty minimalistic items. But we could make use of other previous i2CI articles to include a list of pools and virtuals that rely on this node. We don't do that here because we want to keep this installment independent from others, but you could easily add it in since those routines are single-call routines if they're in your NodeAddress class.

With that, we'll delve right into the code. 

 

    public void dump(String ipAddress) throws java.lang.Exception {
        String addresses[] = {ipAddress};
        
        // screen name
        String names[] = stub.get_screen_name(addresses);
        System.out.println("Node Address: " + ipAddress);
        System.out.println("Name: " + names[0]);
        
        // connection limit
        CommonULong64 limits[] = stub.get_connection_limit(addresses);
        UsefulU64 limit = new UsefulU64(limits[0]);
        System.out.println("Connection Limit: " + limit.toString());
        
        // ratio and dynamic ratio
        long ratios[] = stub.get_ratio(addresses);
        System.out.println("Ratio: " + ratios[0]);
        int srats[] = stub.get_dynamic_ratio(addresses);
        System.out.println("Dynamic Ratio: " + srats[0]);
        
        // monitor association, instance, and status
        LocalLBMonitorIP monitorAddr[] = {new LocalLBMonitorIP()};
        monitorAddr[0].setIpaddress(ipAddress);
        monitorAddr[0].setAddress_type(LocalLBAddressType.ATYPE_UNSET);
        LocalLBNodeAddressMonitorAssociation monitorAssoc[] = stub.get_monitor_association(monitorAddr);
        System.out.println("Monitor Rule Template: " + monitorAssoc[0].getMonitor_rule().getMonitor_templates()[0]);
        System.out.println("Monitor Association Type: " + monitorAssoc[0].getNode_address().getAddress_type());

        LocalLBMonitorStatus monStat[] = stub.get_monitor_status(addresses);
        System.out.println("Monitor Status: " + monStat[0].toString());
        
        // node status
        LocalLBObjectStatus objStat[] = stub.get_object_status(addresses);
        System.out.println("Node Status: " + objStat[0].getStatus_description());
        
        // session status and enabled state
        CommonEnabledState sessState[] = stub.get_session_enabled_state(addresses);
        System.out.println("Session state: " + sessState[0].toString());
        LocalLBSessionStatus sessStatus[] = stub.get_session_status(addresses);
        System.out.println("Sesssion Status: " + sessStatus[0].toString());
        
        // statistics
        // Get Statistics
        LocalLBNodeAddressNodeAddressStatistics nodeStats = stub.get_statistics(addresses);
        System.out.print("Statistics for this node as of ");
        System.out.print(nodeStats.getTime_stamp().getHour() + ":" + nodeStats.getTime_stamp().getMinute() + ":" + nodeStats.getTime_stamp().getSecond());
        System.out.println(" on " + nodeStats.getTime_stamp().getMonth() + "/" + nodeStats.getTime_stamp().getDay() + "/" + nodeStats.getTime_stamp().getYear());
        
        LocalLBNodeAddressNodeAddressStatisticEntry ourNodeStats[] = nodeStats.getStatistics();

        // LocalLBNodeAddressNodeAddressStatisticEntry is one element per node passed in. Since we only passed one node, get the stats list out of [0].
        CommonStatistic statsList[] = ourNodeStats[0].getStatistics();
        for(int j = 0; j < statsList.length; j++) {
            CommonStatisticType type = statsList[j].getType();
            UsefulU64 value = new UsefulU64(statsList[j].getValue());
            System.out.println("\t" + type.toString() + "\t" + value.toString());
        }
        
    }

 

 

 

There's not much special about this - you'll notice that, due to a good design on the part of the iControl developers, the get statistics section is nearly a duplicate of the code to get pool statistics. Only the statistics type is different.

Limit and Ratio both return 0.0 if you haven't set them previously, and we send A_TYPE_UNSET to get_monitor_association() because we don't know what type the association was set to on any arbitrary node.

That's about it. We're almost to the point where we can dump the entire BIG-IP, just a couple more installments!

 

Published Jun 30, 2008
Version 1.0

Was this article helpful?

No CommentsBe the first to comment