How to absorb a threshold level

Overview

There are 2 ways to absorb a threshold level depending on your source of information:

  • Using separate messages, one per classifier state
  • Using a single message with a flat definition

The tutorial shows how to absorb, using these 2 different methods, the following definition:

When filling a threshold level you need to specify the following information:

  • the related classifier
  • whether or not it's used
  • the down level
  • whether or not it's a strict down evaluation (true means <, false means ≤)
  • the up level
  • whether or not it's a strict up evaluation (true means >, false means ≥)

Please keep in mind that the default classifier must be marked as used but without any down or up levels.

Thus, you're going to create this configuratio:n

Classifier level-down strictness-down level-up stictness-up used
NORMAL null does not matter null does not matter true
WARNING null does not matter 10 true  true 
CRITICAL 0 true  20 true  true 

Configure the threshold level with one message per classifier

Mapping configuration

Notes:

  1. Conversion from the string version of the classifier (body[state]) and the classifier itself
  2. level-down value (null policy is set to clear in order to close existing value), same thing for level-up
  3. Force the strictness to true, it can also be forced to false or it can depend on another attribute of the message
  4. Mark this classifier as used in the threshold level

Sample route definition

This simple route example creates the proper threshold level definition using one message per classifier

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <from uri="timer:single?repeatCount=1"/>
        <setBody>
            <groovy><![CDATA[
            // We're creating an array that will be split and processed
            [
                [state:'normal'],
                [state:'warning', up: 10],
                [state:'critical', down: 0, up: 20]
            ]
            ]]></groovy>
        </setBody>
        <!-- Process the classifiers of the threshold one by one -->
        <split>
            <simple>${body}</simple>
            <to uri="tnd-absorption:fill_threshold_multiple_calls" />
        </split>
    </route>
</routes>

Configure the threshold level from a flat definition

Mapping configuration

Notes:

  1. Force the classifier to NORMAL using a constant, we will do the same thing for the other classifiers
  2. Ensure that the levels parameters of the default state are null (null policy is set to clear in order to close existing values)
  3. Mark the default state as used (the other classifiers will be too)
  4. Fill the definition of the WARNING state (null policy is set to clear in order to close existing values)
  5. Force the strictness to true, it can also be forced to false or it can depends on another attribute of the message
  6. Button used to create a new definition based on another classifier level

Sample route definition

This simple route example creates the proper threshold level definition using a flat definition

<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
    <route>
        <from uri="timer:single?repeatCount=1"/>
        <setBody>
            <groovy><![CDATA[
            ['warning-up':10, 'critical-down':0, 'critical-up':20]
            ]]></groovy>
        </setBody>

        <!-- Process this flat definition -->
        <to uri="tnd-absorption:fill_threshold_all_at_once"/>
    </route>
</routes>

Related Links