# Rules

This wizard allows us to create rules.

## Steps

### Administration

Essential data for registration and identification for creating a rule in the platform.

Rules consist of **Easy rules** and **Advanced rules**, which are created differently in the second step.

We can configure a rule with the following options:

**New rules:** Create a new rule from scratch.
**From catalog:** Create a rule from the catalog.
**Clone existing rule:** Create a rule from a previously created one.

#### Easy rule

Build a rule using basic concepts for evaluation.
You must select the rule type depending on whether you want a data stream collection, the operation result, or an event. When selecting **Data Stream collection**, the Data Stream button above will be enabled.

{{< staticImage "ux/RuleWizard/EasyRule/newDatastream.png" "Administration" >}}

Clicking the Data Stream button will open a menu where you can search for and add the data stream, along with adding an alias.

{{< staticImage "ux/RuleWizard/EasyRule/menuDatastream.png" "Menu" >}}

However, if you select **Operation result** or **Event** as the rule type, the Data Stream button will not be visible.

For all three rule types, you need to select a parameter, which consists of an identifier, type, and value.

{{< staticImage "ux/RuleWizard/EasyRule/parameters.png" "Parameters" >}}

Within the parameter menu, you will enter an identifier, type (string, integer, number, or boolean), and value.

{{< staticImage "ux/RuleWizard/EasyRule/menuParameter.png" "Parameters" >}}

### Rule Definition (Easy)

Build a rule using basic concepts for evaluation.

#### Rule Conditions

This will trigger the rule when the rule meets the filter conditions.

Select a data stream to compose the filter.

{{< staticImage "ux/RuleWizard/RuleDefinition/addCondition.png" "Condition" >}}

You can also add a group to add another condition to the filter.

{{< staticImage "ux/RuleWizard/RuleDefinition/addConditionCpu.png" "Add" >}}

{{< staticImage "ux/RuleWizard/RuleDefinition/addConditionResource.png" "Resource" >}}

#### Perform the following actions

Actions will be executed when the configured conditions are met.

There are different options within the New Action menu:

{{< staticImage "ux/RuleWizard/RuleDefinition/actionlist.png" "Actions" >}}

You can delay the action by a specified number of milliseconds, creating a wait threshold before executing the actions. In this case, creating a new alarm has been selected.

{{< staticImage "ux/RuleWizard/RuleDefinition/ruleCondition.png" "RuleCondition" >}}

### Advanced rule

Build a rule using basic concepts for evaluation.

{{< staticImage "ux/RuleWizard/AdvancedRule/mainAdvancedRule.png" "AdvancedRule" >}}

Just like easy rules, the same options exist. You need to select the rule type depending on whether you want a data stream collection, the operation result, or an event. When selecting **Data Stream collection**, the Data Stream button above will be enabled.

{{< staticImage "ux/RuleWizard/AdvancedRule/menuDatastream.png" "MenuDatastream" >}}

#### Rule Definition (Advanced)

Allows you to write the JavaScript code of the rule for evaluation. It also allows you to delay the execution of actions with a wait threshold.

{{< staticImage "ux/RuleWizard/AdvancedRule/ruleCondition.png" "DefinitionRule" >}}


{{% children sort="weight" depth="10" %}}

---
