Difference between revisions of "Adding a rule"

From Senfi Docs
Jump to: navigation, search
 
(44 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=== Pre-requisites ===
+
<translate>
 +
=== Pre-requisites === <!--T:1-->
 
A rule requires design and logical programing in order for it to work correctly. If this is your first time creating a rule, please read [[Rule|this guide]] first.
 
A rule requires design and logical programing in order for it to work correctly. If this is your first time creating a rule, please read [[Rule|this guide]] first.
  
You should also be similar with the basic [[Measurement|measurements]] and its concepts. Please read [[Concepts#Measurement.2C_Metric.2C_Tag|this section]] if you require a refresher.
+
<!--T:2-->
 +
You should also be familiar with the basic [[Measurement|measurements]] and its concepts. Please read [[Concepts#Measurement.2C_Metric.2C_Tag|this section]] if you require a refresher.
  
 +
<!--T:3-->
 
You should  
 
You should  
 
* Know what event the Rule should detect.
 
* Know what event the Rule should detect.
Line 12: Line 15:
 
* (Optional) Be able to send simulated records to '''Input''' measurement & metric (to simulate occurrence of event or situation)
 
* (Optional) Be able to send simulated records to '''Input''' measurement & metric (to simulate occurrence of event or situation)
  
=== Adding a New Rule ===
+
=== Adding a New Rule === <!--T:4-->
  
# Login to the [https://ems.senfi.io/cms CMS]
+
<!--T:5-->
# Go to the '''Rule''' tab
+
# Login to the [https://ems.senfi.io/cms CMS].
 +
# Go to the '''Rule''' tab.
 
# Click the '''+''' button to add a new rule.
 
# Click the '''+''' button to add a new rule.
 
# Give the rule a descriptive name. This will be shown to users of the dashboard.
 
# Give the rule a descriptive name. This will be shown to users of the dashboard.
 
# Select the Severity of the rule.
 
# Select the Severity of the rule.
# Select Evaluate Type of the rule. Read [[Rule#Rule_execution_options|this section]] if you require a refresher
+
# Select [[Rule#Rule_execution_options|Evaluate Type]] of the rule.
 
# (Optional) Select the Access Group that would be able to view and modify the rule. Defaults to all users in your organization.
 
# (Optional) Select the Access Group that would be able to view and modify the rule. Defaults to all users in your organization.
# Give the rule a descriptive '''Description'''. The '''Description''' would be the default content for any '''Action'''
+
# Give the rule a descriptive '''Description'''. The '''Description''' would be the default content for any '''Action'''.
# Construct the '''Conditions''' using the editor. [[#Constructing_Condition|Constructing the Condition]] for more details.
+
# Construct the '''Conditions''' using the editor. Read section on [[Rule#Constructing_Condition|"Constructing Condition"]] for more details.
# Save when done
+
# Save when done.
# (Optional) Send records to simulate event to test the rule.
+
# (Optional) Test the rule by sending records to simulate event.
  
=== Constructing Condition ===
 
This section will guide you to construct a condition using the Editor when adding/editing a Rule in the CMS
 
[[File:rule_editor.png|thumb|Rule Editor]]
 
The Rule Editor is a graph based "Drag and Drop" editor. Each node in the Editor represents either an '''Input''', Data Transformation, Logic, or an '''Action'''. Arrows are used to link the nodes and control the flow of data between nodes. Arrows going into the left of a node indicates the node's input, and arrows flowing out the right of a node indicates the node's output.
 
  
The graph must always start from the '''Input''' nodes and ends in the '''Output''' and '''Action''' nodes
+
<!--T:6-->
 
+
<div class="right">[[Adding_a_computed_measurement|Next: Adding a computed measurement]]</div>
;'''Input''' nodes
+
</translate>
:'''Constant''' - outputs a constant value. e.g: 0, 1, true, false
 
:'''Metric''' - outputs the latest value of a metric
 
;'''Input''' modifier nodes
 
:'''Range''' - modifies the "Metric" node to output historical values
 
;Logic Nodes
 
:'''Operator''' - comparison operators. e.g. <, >=, ==, !=
 
:'''Logic''' - perform "AND" or "OR" between 2 or more boolean values
 
;Data Transformation nodes
 
:'''Filter''' - to be used with "Range" node. Filters input values to output a subset number of values.
 
:'''Aggregate''' - to be used with "Range" node. Aggregates input values into a single value. E.g. sum, average, median.
 
:'''Function''' - value-wise transformation. Can be used directly with a "Metric" node, or with "Range" node. Outputs the same number of values as its input.
 
;Output node
 
:'''Output''' - output node. Must have 1 and only 1 node. Specifies the output of the '''Conditions'''
 
;Action nodes
 
:'''Action''' - action node. Input must always be from the Output node. Can have 0 or more Action nodes. Instructs Senfi to do something when Output changes.
 
 
 
# Drag "Metric" nodes into the working area, one for each '''Input''' metric.
 
# Select the correct measurement and metric for each created "Metric" node. Read: [[#Configuring_Nodes|how to configure a node]]
 
# (Optional) If you need to compare metric value against a constant value, use the "Constant" node.
 
# Drag "Operator" and "Logic" nodes to construct the necessary logic to detect desired event.
 
#*
 
#
 
 
 
==== Working with historical values ====
 
By default, a "Metric" node will output the Last Known value of the metric. Attaching a Range node to it modifies the "Metric" node to output historical values.
 
 
 
TODO....
 
 
 
==== Configuring Nodes ====
 
Each node contains attributes & options which you can modify. To modify the attributes of a node, move your mouse over the node and click on the "Gear" button that appears near the top right corner of the node (Beside the "X" button). A window will popup to allow you to configure the node.
 
 
 
TODO: go through each node and what each configuration option does
 

Latest revision as of 14:18, 5 November 2019

Pre-requisites

A rule requires design and logical programing in order for it to work correctly. If this is your first time creating a rule, please read this guide first.

You should also be familiar with the basic measurements and its concepts. Please read this section if you require a refresher.

You should

  • Know what event the Rule should detect.
  • Know what you would like Senfi to do (Action) when the event is detected
  • Have already created the Input measurement & metrics.
  • Know the thresholds or values which indicates occurrence of event.
  • Be able to send records to Input measurement & metric.
  • (Optional) Be able to send simulated records to Input measurement & metric (to simulate occurrence of event or situation)

Adding a New Rule

  1. Login to the CMS.
  2. Go to the Rule tab.
  3. Click the + button to add a new rule.
  4. Give the rule a descriptive name. This will be shown to users of the dashboard.
  5. Select the Severity of the rule.
  6. Select Evaluate Type of the rule.
  7. (Optional) Select the Access Group that would be able to view and modify the rule. Defaults to all users in your organization.
  8. Give the rule a descriptive Description. The Description would be the default content for any Action.
  9. Construct the Conditions using the editor. Read section on "Constructing Condition" for more details.
  10. Save when done.
  11. (Optional) Test the rule by sending records to simulate event.