Programming an iApps LX Stats Processor

Statistics are used to monitor the overall health of an iApps LX framework. By default, the stats processor triggers an automatic collection of default high-level health statistics. You can view the default statistics in /mgmt/shared/iapp/blocks/[blockId]/stats. The BlockUpdateStatsWorker runs a scheduled task to collect statistics from the iApps LX block.

Note

Statistics are only collected when the block is in the BOUND state.

The collected health statistics are aggregated into overall health summary statistics (health.summary) and state of the application statistics (health.state) based on the health status of the configuration objects it is managing. When using the iApps LX default GUI in a BIG-IP GUI, a green or red icon is displayed (Main > iApps > Application Services > Applications LX > Status) next to the iApp LX indicating its health status. For example, for an iApp LX for pool management, the stats processor would report it as unhealthy if one of the configured pool members was down, and as a result, its Status would show as red in the BIG-IP GUI. When using a custom GUI, you can configure the stats processor to manage custom statistics (such as health.stats.*), which can be displayed, for example, as a graph in the custom GUI.

About configuring a JSON block for a Stats Processor

The following properties are defined (either by default or manually) in the JSON block template for the stats processor:

Stats Processor Properties
Property Type Description
statsProcessorReference Links to the stats processor
statsProcessorTimeoutSeconds Interval (in seconds) in which the BlockUpdateStatsWorker runs a scheduled task (default every 15 seconds) to collect statistics from the iAppS LX block

About configuring a Stats Processor

The stats processor is configured in JavaScript code. When a POST request is received, it triggers a BlockStatsTask with the corresponding block for which statistics should be collected. Upon a successful retrieval of statistics for the block resources, the stats processor sends a PATCH request to the BlockStatsTask with the updated statistics. This process is managed internally.

Note

If you are using the default statistics, no manual configuration is required.

The following is an example of a stats processor configuration in JavaScript to manage statistics for an iApps LX block that is used for pool member management. The stats processor is configured to aggregate the statistics from the pool members and the virtual sever. Collected statistics, such as, the number of successful connections or the number of bytes transferred, are then aggregated into the health.summary statistic.

ExchangeStatsProcessor.prototype.onPost = function(restOperation) {

 this.logger.info("[Exchange iApps LX Stats Processor] onPost");

 // respond 202 immediately
 restOperation.setStatusCode(this.wellKnownPorts.STATUS_ACCEPTED);
 this.completeRestOperation(restOperation);

 var stats = [
 {
     "name" : "health.in.summary.myCustomStat",
     "value" : Math.floor(Math.random() * 2),
     "description" : "hello world",
     "updateType" : "BASIC"
 },
 {
     "name" : "health.summary.myOtherCustomStat",
     "value" : 1,
     "description" : "comment 2",
     "updateType" : "BASIC"
 },
 {
     "name" : "health.summary.poolMembers",
     "value" : 1,
     "description" : "comment 1",
     "updateType" : "BASIC"
 }];

 var taskState = restOperation.getBody();
 var uri = this.restHelper.makeRestjavadUri('/shared/iapp/block-stats-tasks/' + taskState.Id, null);

 var restOp = this.restOperationFactory.createRestOperationInstance()
     .setBody({
         "subStatus": "HANDLE_PROCESSOR_RESPONSE",
         "postStats": {
             "stats": stats
         }
     })
     .setMethod("Patch")
     .setUri(uri)
     .setIsSetBasicAuthHeader(true)
             .setBasicAuthorization(restOperation.getBasicAuthorization());

 this.restRequestSender.sendPatch(restOp).then(function(response) {
     this.logger.info("[Exchange iApps LX Stats Processor] " + JSON.stringify(response));
 }, function(error) {
     this.logger.warning("[Exchange iApps LX Stats Processor] " + error);
 });
 };

Example of a Stats Processor Response

The following example shows an aggregated health.summary statistic.

"health.summary": {
  "value": 1.0,
  "lastUpdateMicros": 1404158491770498,
  "updateType": "BASIC"
},

Note

Values of “1.0” indicate a healthy status, while values of less than “1.0” indicate an unhealthy status.