Smart rules collection
Cumulocity includes preset global smart rule types. Each global smart rule type provides different parameters to configure.
On alarm send SMS
Functionality
If an alarm is created, an SMS is sent.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On alarm matching | The types of alarms triggering the rule. For each newly created alarm with one of these types in the list the rule is triggered. |
3 | Send SMS | Phone number: Target phone number. It is recommended to include mobile country code for all numbers, for example, "+49" or "0049" for Germany. Multiple numbers can be separated by a comma (",", do not use a space!). Message: Text of SMS with max. 160 characters. You can use variables of the form #{name}, see Smart rule variables. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
You can select a single group or a single device (just one, not multiple). To enable it in other assets or devices you must navigate to each context and enable it there. Afterwards you’re able to see all target assets or devices in a list with the title “Active for target asset or devices” in the smart rule detail
Troubleshooting
-
Verify that the alarm was created and not duplicated from somewhere.
-
Check if the device is in maintenance mode. In this case no new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
On alarm send email
Functionality
If an alarm is created, an email is sent.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On alarm matching | The types of alarms triggering the rule. For each newly created alarm with one of these types in the list the rule is triggered. |
3 | Send email | Send to:/Send CC to:/Send BCC to: Email addresses for sending the email to. Multiple addresses can be separated by a comma (",", do not use a space!). Reply to: Address to be used to reply to the message. Subject: Subject of email. You can use a variable of the form #{name}, see Smart rule variables. Message: Text of the email. You can use a variable of the form #{name}, see Smart rule variables. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
-
Verify that the alarm was created and not duplicated from somewhere.
-
Check if the device is in maintenance mode. In this case no new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
-
Check your spam folder.
On alarm escalate it
Functionality
If an alarm is created, sends email or SMS.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On alarm matching | The types of alarms triggering the rule. For each newly created alarm with one of these types in the list the rule is triggered. |
3 | Escalate as follows | Escalation steps processed in a chain. Click Add step to define at least one step: Type: Type of action executed in the step. Possible values are: - Email (see "On alarm send email" rule for parameter descriptions). - SMS (see "On alarm send SMS" rule for parameter descriptions). Condition: The condition applied when the rule will be executed. Possible values are: - Always: Action will always be executed. - Always: If step N failed. Only phone steps may fail. The step is marked as failed once all retries have been made without a successful call. This option only appears if there already is a phone step configured that can be referred to. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Troubleshooting
-
Verify that the alarm was created and not duplicated from somewhere.
-
Check if the device is in maintenance mode. In this case no new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
On alarm duration increase severity
Functionality
If an alarm is active for a certain time, the severity is increased.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On alarm matching | The types of alarms triggering the rule. For each newly created alarm with one of these types in the list the rule is triggered. |
3 | Increase alarm severity | Duration, an alarm must be active, before increasing the severity. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Description
When a configured type of alarm is raised, it starts monitoring how long the alarm stays active.
If the alarm is still active after the specified duration, the severity will be increased one level, for example, from MINOR to MAJOR.
If the alarm has reached CRITICAL, it will stop monitoring because there is no further action possible.
On geofence create alarm
Functionality
If a geofence border is crossed, an alarm is created.
The rule can be configured for entering or leaving the geofence, or both. Existing alarms are cleared when the opposite condition is true again, for example, if a tracked car which has left the geofence area is re-entering the geofence area.
Parameters
The rule uses the following parameters:
|
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On geofence violation | Polygon that defines the borders of an area. Click Edit geofence and set the area. Double-click to add points and click and drag them to adjust. |
3 | Create alarm | Trigger: Reason for triggering the alarm: "On entering", "On leaving" (the default), "On entering and leaving". Type: Type of alarm being raised. It is strongly recommended to use different types of alarms for each smart rule. If the same alarm type is used across multiple smart rules, smart rules may interfere when trying to update the same alarm type, which might lead to unexpected behavior. Severity: Severity of alarm being raised. Text: Alarm message. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Troubleshooting
-
Make sure the device was inside the geofence at least once after creating/activating the rule.
-
Check if the device is in maintenance mode. No new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
On geofence send email
Functionality
If a geofence border is crossed by leaving the geofence area, an email is sent.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On geofence violation | Polygon that defines the borders of an area. Click Edit geofence and set the area. Double-click to add points and click and drag them to adjust. |
3 | Send email | Send to:/Send CC to:/Send BCC to: Email addresses for sending the email to. Multiple addresses can be separated by a comma (",", do not use a space!). Reply to: Address to be used to reply to the message. Subject: Subject of email. You can use a variable of the form #{name}, see Smart rule variables. Message: Text of the email. You can use a variable of the form #{name}, see Smart rule variables. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Troubleshooting
-
Make sure the device was inside the geofence at least once after creating/activating the rule.
-
Check your spam folder.
Calculate energy consumption
Functionality
Creates consumption data point based on data from an electric, gas, or water meter.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | Monitored measurement | Fragment/Series: Name of the measurement fragment and series. The incoming measurement must have exactly the same fragment/series name as configured. When creating a rule from the data explorer, these fields are already filled in. Time interval: Interval in which consumption values shall be calculated. Specifies how often per hour the consumption is calculated. |
3 | Energy consumption measurement | Name of the measurement fragment and series that shall be generated. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
The unit of the consumption measurement is always per hour (that means, if the measurements are in “kg” the consumption will be in “kg/h”).
The rule takes the last two measurements for a specified time, calculates the difference in value and time and then calculates the consumption per hour.
Example
The rule is configured to calculate every 20 minutes. The following measurements are coming in: 100 kg at 11:59 and 200 kg at 12:14. At 12:20 the rule is triggered, taking the last two measurements. It calculates value and time difference. The consumption measurement created at 12:20 will therefore be 400 kg/h. If no new measurement was created in the last period a measurement with consumption 0 will be created.
On missing measurements create alarm
Functionality
If no new measurement data has been received for a specified time, an alarm is created.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | Monitored measurement | Type: Type of measurement. The incoming measurement must have the same type as configured. When creating a rule from the data explorer, the type is already filled in. Time interval: Interval for calculating consumption values. |
3 | Create alarm | Type: Type of alarm being raised. It is strongly recommended to use different types of alarms for each smart rule. If the same alarm type is used across multiple smart rules, smart rules may interfere when trying to update the same alarm type, which might lead to unexpected behavior. Severity: Severity of alarm being raised. Text: Alarm message. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
On alarm execute operation
Functionality
If a certain alarm occurs, the specified operation is sent back to the device that raised the alarm.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On alarm matching | The types of alarms triggering the rule. For each newly created alarm with one of these types in the list the rule is triggered. |
3 | Execute operation | The operation that will be sent. The operation is provided as JSON description. Some standard operations can be selected below the Operation field. To use a standard operation, select one, and press the arrow button at the right. This will insert the JSON of the selected operation. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
On measurement threshold create alarm
Functionality
If the measurement value enters or leaves the red/yellow range, an alarm is created or respectively cleared.
The severity of alarm is determined as follows:
-
If the measurement value moves into the red range, then an alarm of CRITICAL severity is created. If it moves out of the red range, the CRITICAL alarm is cleared.
-
If the measurement value moves into the yellow range, then an alarm of MINOR severity is created. If it moves out of the yellow range, the MINOR alarm is cleared.
The rule uses the following parameters from the device object or data point library:
-
Data point library red/yellow range: Red range when the system should create CRITICAL alarms and yellow range when the system should create MINOR alarms. Note that the data point should have at least one of red or yellow range configured.
-
Object red range: Range when the system should create CRITICAL alarms. These values can be edited in the data explorer for each data point. Note that these are close intervals ([red min: red max]) that contain the lowest accepted value and the highest accepted value, see also examples below.
-
Object yellow range: Range when the system should create MINOR alarms. These values can be edited in the data explorer for each data point. Note that these are half-open intervals ([yellow min : yellow max)) that contain the lowest accepted value but not the highest accepted value, see also examples below.
Examples
Example 1 - Red range:
If we set the red range to “[60;90]”
- red min: 60
- red max: 90
and the measured value is between 60 - 90 (including the values 60 and 90) as a result a CRITICAL alarm (red) will be created.
Example 2 - Yellow range:
If we set the yellow range to “[30;50)”
- yellow min: 30
- yellow max: 50
and the measured value is between 30 - 49 as a result a MINOR alarm (yellow) will be created. The value 50 is out of the yellow range.
Example 3 - Red and yellow range:
As a result of the above behavior, we can set configurations like the following:
- red min: 60
- red max: 90
- yellow min: 30
- yellow max: 60
If the measured value is 60, then as a result a CRITICAL alarm (red) will be created because red includes the value 60.
Example 4 - Overlap:
The red range and the yellow range can overlap. A value in this overlap range is treated as being in the yellow range.
If we set the yellow range to “[30;60)” and the red range to “[50;90]”:
- red min: 50
- red max: 90
- yellow min: 30
- yellow max: 60
and the measured value is 55, a MINOR alarm (yellow) will be created.
Using these mechanisms, you can configure global threshold ranges in the data point library. These global values can then be overridden for specific objects on a case-by-case basis.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On threshold | Fragment/Series: Name of the measurement fragment and series. The incoming measurement must have exactly the same fragment name as configured. When creating a rule from the data explorer, these fields are already filled in. Data point library entry: Name of the entry in the data point library. This is used to find the default values for red and yellow ranges in case they are not configured for an individual object. Note that the unit which is set in the data point is not taken into account here. |
3 | Create alarm | Type: Type of alarm being raised. It is strongly recommended to use different types of alarms for each smart rule. If the same alarm type is used across multiple smart rules, smart rules may interfere when trying to update the same alarm type, which might lead to unexpected behavior. Text: Alarm message. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Description
For each incoming measurement value, the rule performs the following steps:
-
Check if the smart rule has a valid data point. If not, an alarm with MAJOR severity is sent from the rule engine (CEP) informing that the rule has an invalid configuration.
-
Check if the rule is activated for the source object.
-
Check if the measurement includes data for the fragment and series (configured data point’s parameter).
-
The data of the red and yellow range is collected from either:
- The data point library (control parameter).
- The source object (the measurement). If found, ranges from the source object’s data point override are merged.
If no red/yellow ranges are defined in the merged parameters, no alarms are generated.
-
Incoming value inside the red range: If there is no active alarm of CRITICAL severity of given type for the object, create a CRITICAL alarm, else do nothing.
-
Incoming value inside the yellow range: If there is no active alarm of MINOR severity of given type for the object, create a MINOR alarm, else do nothing.
-
Measurement outside of yellow and red range: If there is an active alarm of given type for the object, clear the CRITICAL and/or MINOR alarm.
Troubleshooting
-
Verify that the alarm was created and not duplicated from somewhere.
-
Check if the device is in maintenance mode. In this case no new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
-
Check if an alarm was already cleared by the next scheduled measurements with resulting value in a green range.
-
If you clear an alarm, you state that the alarm is resolved. A new alarm is not raised unless the device changes its state and exceeds the thresholds again.
-
Under certain circumstances, that means, if the time gap between measurements is quite large, this smart rule may raise a wrong alarm severity. If, for example, the CEP/Apama pod is restarted, the internal state is lost and therefore an alarm is raised again when it should not, resulting in a different alarm severity.
On measurement explicit threshold create alarm
Functionality
If the measurement value enters or leaves the red range, a CRITICAL alarm is generated or cleared.
The severity of alarm is determined as follows:
-
If the measurement value moves into red range, then the severity is CRITICAL.
-
If the measurement value moves into GREEN range, no alarm is created.
Parameters
The rule uses the following parameters:
Step | Field | Description |
---|---|---|
1 | Rule name | Pre-filled with the name of the rule template. Can be modified according to your needs. |
2 | On threshold | Fragment/Series: Name of the measurement fragment and series. The incoming measurement must have exactly the same fragment name as configured. When creating a rule from the data explorer, these fields are already filled in. Minimum, Maximum: When a value is in the specified range [minimum; maximum], the configured alarm is raised. |
3 | Create alarm | Type: Type of alarm being raised. It is strongly recommended to use different types of alarms for each smart rule. If the same alarm type is used across multiple smart rules, smart rules may interfere when trying to update the same alarm type, which might lead to unexpected behavior. Text: Alarm message. |
4 | Target asset or devices | Select a group or device the rule shall be applied to. To activate the smart rule in other assets or devices, navigate to the respective objects and enable the smart rule. The smart rules details will show a list "Active for target asset or devices". If you leave this field empty, the smart rule will be applied to every group and device. You can then deactivate the smart rule for specific assets or devices. In this case the smart rules details will show a list "Inactive for target asset or devices". For details on enabling/disabling a smart rule, see To enable/disable a smart rule for a group or device. |
Troubleshooting
-
Verify that the alarm was created and not duplicated from somewhere.
-
Check if the device is in maintenance mode. In this case no new alarm will be created because of suppression policy.
-
If you have configured an alarm mapping rule (see Alarm mapping) which changes the alarm severity, the alarm may have different severity than expected.
-
Check if an alarm was already cleared by the next scheduled measurements with resulting value in a green range.
-
If you clear an alarm, you state that the alarm is resolved. A new alarm is not raised unless the device changes its state and exceeds the thresholds again.
-
Under certain circumstances, that means, if the time gap between measurements is quite large, this smart rule may raise a wrong alarm severity. If, for example, the CEP/Apama pod is restarted, the internal state is lost and therefore an alarm is raised again when it should not, resulting in a different alarm severity.
Smart rule variables
In certain rule parameters, various trigger fields can be used as variables. When a rule is triggered, the variables are replaced by the actual values of these trigger fields.
You can use this mechanism for example to insert device names or alarm text into various outputs (email, SMS).
Common fields to be used from all triggers (alarms, measurements, operations, events)
Variable | Content |
#{id} | Identifier of the trigger. |
#{type} | Type of the trigger. |
#{source} | Identifier of the source of the trigger. |
#{time} | Timestamp of the trigger. |
#{text} | Text or message of the trigger. |
Fields specific for alarms
Variable | Content |
#{status} | Status of the alarm: ACTIVE, ACKNOWLEDGED or CLEARED. |
#{severity} | Severity of the alarm: CRITICAL, MAJOR, MINOR or WARNING. |
#{count} | Number of times the alarm has been sent. Repeating alarms for the same device and same alarm type are de-duplicated into one alarm. |
Fields specific for operations
Variable | Content |
#{status} | Status of the operation: SUCCESSFUL, FAILED, EXECUTING or PENDING. |
Fields specific for measurements
Variable | Content |
#{valueFragment} | Measurement value fragment name. |
#{valueSeries} | Measurement series fragment name. |
#{value} | Value from the sensor. |
#{unit} | Unit being used, for example "mm", "lux". |
Moreover, the following pattern is supported:
Variable | Content |
#{X.Y} or #{X.Y.Z} | The property field information available in extra params or nested structure params of the trigger. |
Example
Cumulocity trigger
{
"source":{
"id":"10200"
},
"type":"TestEvent",
"text":"sensor was triggered",
"time":"2014-03-03T12:03:27.845Z",
"c8y_Position":{
"lat":2,
"lng":2
},
"c8y_evtdata":{
"data1":111,
"date2":222,
"evtInnerData":{
"indate1":333,
"indate2":444
}
}
}
Here we can for example define the following variables:
Variable | Content |
#{ c8y_Position.lat} | Gets latitude value. |
#{ c8y_evtdata.data1} | Gets data1 value. |
{ c8y_evtdata. evtInnerData . indate1} | Gets nested structure value. |
#{source.X.Y} | The property field information from the source device (ManagedObject) of the trigger. For example:
#{source.c8y_Hardware.serialNumber} > Serial number of the device. #{source.c8y_Notes} > Note field of the device. |