Forum Discussion

dalexand_127251's avatar
dalexand_127251
Icon for Nimbostratus rankNimbostratus
Oct 29, 2003

Threshold for minimum number of nodes in a pool

We would like to define a threshold for the minumum number of nodes in a pool when a pool is created. This threshold would be used by external monitoring to generate alerts when the number of active nodes falls below the threshold. Is there a way to do this using the iControl API? The closest thing that I have found is the get_minimum_active_member method, but changing this value affects the load balancer's behaviour. Are there any user defined values that could be used for this purpose?

 

 

Thanks,

 

Dave

3 Replies

  • Minimum active members are used to specify a threashold on a pool to change packet distribution to other priority groups when the threashold is reached. If you don't want load balancing decisions to be effected by the number of active members then minimum active members is not what you want.

     

     

    There currently is no support for user defined values associated with pools but we do have the ability to query the pool members active states. So by passing in the list of members you can get the list of active states for all the nodes. You can then iterate this list to determine the number of "active" nodes in a pool and then store your own "threshold" externally, you can perform external actions.

     

     

    void get_member_list( 
         in String pool_name, 
         out IPPortDefinition[] members 
     ); 
      
     void get_member_active_states( 
         in String pool_name, 
         in IPPortDefinition[] member_defs, 
         out MemberState[] member_states 
     ); 
     

     

     

    Your code could look something like the following.

     

     

     
     // Get member list 
     Pool.get_member_list(pool_name); 
     // extract member list from results 
     Pool.get_member_active_states(pool_name, member_list); 
     // extract active states from results 
     // iterate through list and count active members 
      
     if ( active_members < threshold ) { 
         // send alert 
     } 
     

     

     

    Let us know if this solution isn't what you were looking for. If so, pass along more details on your specific scenario.

     

     

    -Joe
  • I'm using perl to get the member active states, and I'm having trouble figuring out how to pass the member_defs argument to the get_member_active_states method. The code samples provided in the SDK only pass simple parameters like strings, but I can't figure out how to pass an IPPortDefinition[] struture.

     

     

    Here's what I have been trying:

     

     

    my $soap_response = $soap->get_member_active_states ( SOAP::Data->name(pool_name => $poolName), SOAP::Data->name(member_defs => @{member_list})

     

     

    @member_list is the result of the getPoolMemberList function in the LocalLBPool.pl example from the SDK.

     

     

    Thanks,

     

    Dave
  • Sorry I didn't get back to you sooner as I just got back from vacation.

     

     

    You are very close. Actually, for a hint on passing arrays in the LocalLBNode sample the call to "set_state" passes in an array of IPPortDefinitions. When writing the first set of sample apps, I tried to get all combinations of parameters (ins and outs) illustrated.

     

     

    I'm not a perl guru by any means so I can't explain what all the combinations of curly brackes, at signs, dollar signs, etc do in all combinations but I have found that when passing arrays you should surround the value with brackets to force it to an array. Here's a bit of code that should do the job for you (building from the LocalLBPool sample).

     

     

        ------------------------------------------------------------------------ 
          Get Member List 
         ------------------------------------------------------------------------ 
         print "Members   : {"; 
         (@member_list) = getPoolMemberList($sPool); 
         foreach my $member (@member_list) 
         { 
             print $member->{"address"}, ":", $member->{"port"}, ", "; 
         } 
         print "\b\b}\n"; 
      
         ------------------------------------------------------------------------ 
          Get member active states 
         ------------------------------------------------------------------------ 
         print "Member Active States :\n"; 
         $soap_response = 
             $soap->get_member_active_states 
             ( 
                 SOAP::Data->name(pool_name => $sPool), 
                 SOAP::Data->name(member_defs => [@member_list]) 
             ); 
      
         @member_states = @{$soap_response->result}; 
         foreach my $member_state (@member_states) 
         { 
             $member_def = $member_state->{"member_def"}; 
             $member_ip = $member_def->{"address"}; 
             $member_port = $member_def->{"port"}; 
             $active_state = $member_state->{"active_state"}; 
             print "  ", $member_ip, ":", $member_port, ": ", $active_state, "\n"; 
         } 
     

     

     

    Personally I have a good understanding of the soap transport so I use the built-in trace facility in SOAP::Lite (uncommented at the top of each script) to help debug issues like this. If you know it needs to be an array and the trace isn't showing it that way, you can tweak the code until it works.

     

     

    Let us know if this works for you.

     

     

    -Joe