Monitor a rule
After you create a rule, it will appear in the Rule Details view as you can see on the screenshot below. You will be prompted to Enable it, upon which the action script will start its execution on the devices in the scope. However, you may also choose to enable the rule later on.
By default, the Rule Details view displays its Overview tab (see bottom of the screenshot), where you can see extensive information about it.
In particular, you will see monitoring attributes such as: the rule's name and ID, overall state, triggers and general condition, action script, scope type and selection mode, the IDs of the involved devices or the relevant group, as well as the applied execution options - if any. There is also information about the number of devices involved in the rule, their summarized execution states, as well as how many times the rule has been triggered, i.e. how many tasks have been launched by it.
Here you will also find the possible rule management actions - Enable, Retry, Delete, Edit, Clone, etc., explained in more details in the Manage a rule section further below.
In order to see a list of the tasks launched by the rule, with their respective monitoring attributes, open the Tasks tab, which you will find next to the Overview tab.
In particular, there you will find each task's ID, overall state, launch and finish times. Double click on a task of interest to see further details about its involved devices, their execution states within the task, etc. The detailed information will appear as described in Monitor a task.
Note that, if the fields Involved Devices, Running Devices, etc. have values, they will be hyperlinks, which open the list of the corresponding devices. You can expand each device on this list to check further monitoring attributes on device level. This allows you to monitor the execution of the rule, in particular - the execution of the last task launched by it - on device level.
You may notice that this is the same view as described in Monitor a task, Execution Status Details tab, Filtered by Execution Status.
Therefore, you can monitor each rule on three levels - rule level, task level and device level.
Switching between monitoring levels
As illustrated above, you can monitor the execution of mass management actions on several levels - rule, task and device, and you can also easily switch from one to the other.
From a rule, you can switch to a task or a device. From a task, you can switch to a rule (provided that the task was launched by rule) or a device (see how in Monitor and manage tasks) .
However, it is also possible to start from device level and check all tasks and rules in which a particular device has been involved so far. To do that, go the Device Management perspective of the console, select the device of interest and then expand the Task Executions view:
This will list all rules and free tasks in which the device has been involved. You can expand each entry on the list to see further execution monitoring details.
A free task is a task which is not launched by a rule. A rule task is a task launched by a rule.
If you expand a rule on this list, you will see the tasks launched by it for the particular device. You can also expand any of the tasks, upon which you will see their partial executions for the particular device.
When you select a partial execution, you will be able to see further information about it in the Task Details area as on the screenshot below.
The State column shows device execution states (such as Finished Successfully, Finished with Error, etc.) in a hierarchy, i.e. a device rule execution state, device task execution states and partial execution states of the device within the task.
On the top level, there is the device rule execution state, which is the same as device task execution state in the last task launched by the rule for the particular device.
On the next level, there is the device task execution state, which is formed by the partial execution states of the device within the particular task.
By right clicking on a rule or task from the list, you will be able to Retry or respectively Cancel the rule or task for the particular device.
Manage a rule
There are several possible rule management actions. They differ slightly depending on whether the rule is currently active (i.e. Enabled) or not.
Each of these actions - Enable, Fire, Pause, Disable, Edit, Clone, Export (and respectively Import), Retry and Delete - is further explained below.
When you create a rule, it does not automatically become active and start launching tasks. To activate it you need to Enable it - through the pop-up that appears immediately after you create the rule, or through the Enable button. Before you Enable a rule for the first time, its state remains Defined, and when you Enable it, its state changes to Enabled.
The Fire Rule button will appear on the list of possible rule management actions if the rule is supposed to be triggered manually. Clicking Fire rule will start the rule execution process, i.e. will cause the system to check the condition (if any), and if it is satisfied will launch a new task.
Pause and Disable
If you want a particular rule to temporarily stop launching new tasks, you may either Pause or Disable it.
If you choose to Pause the rule, all currently running tasks launched by this rule will be stopped but will not be canceled, which means that their execution will automatically continue when you Enable the rule again.
If you choose to directly Disable the rule, all currently running tasks launched by this rule will be canceled and will not be automatically resumed when the rule is Enabled again.
Both Pause and Disable will change the rule state to Disabled.
You can only Edit rules in a state which is not Enabled, i.e. which is either Defined or Disabled.
When you attempt to Edit a rule, you will be asked to confirm your choice, being warned that all monitoring data regarding the previous executions of this rule will be deleted.
So if you confirm, you will go back to the Create Rule wizard where you may edit the rule settings. Therefore, once you finish editing the rule, it will appear as a newly created one and it has to be Enabled in order to start launching tasks.
If you want to reuse an existing rule or some of its settings- such as its scope or action script for example - rather than creating a new one from scratch, you can Clone a rule. The Cloned rule will appear on the list of rules with the name Copy of ... followed by the name of the original rule and will have a Defined state. Then you can Edit it as described above, or even directly Enable it if no changes are needed.
Export and Import
In order to reuse a rule at a later stage or save it for reference, you may export it through the corresponding button. This will generate a .rule file which contains a JSON-schema of the exported rule. You may also export several rules at once, upon which the export will be in the form of a ZIP archive with .rule files (one file per rule).
Rules exported and saved in this way may be later imported again in the system, or in a different subscription and account, either in .rule or .zip format through the corresponding Import Rules button and be reused directly.
Retrying a rule means that you allow the system to temporarily override the rule's once-per-device execution option with regard to a selected set of devices based on their execution states. You can easily select them through the pop-up of the Retry rule button (see screenshot below) . Therefore, the Retry button will function only on rules in which the once-per-device execution option is set to 'yes' (in the Create Rule wizard).
As its name suggests, the once-per-device execution option allows only one execution of the rule's action script per device. Therefore, even if a device has finished the execution with an error for example, any future triggering of the rule will not involve such a device. With Retry rule, you can temporarily override this restriction and involve such a device in the next task launched by the rule.
When you click Retry, the script execution will not start immediately but will wait until the next triggering of the rule, whether manual, timer-based or event-based.
The rule's state must be Enabled for a Retry operation. If the rule is currently Disabled or Defined, you can directly Enable it through the pop-up as on the screenshot.
However, if you need to adjust the once-per-device execution option , you will have to Edit the rule. Remember that after an Edit operation, all previous execution statistics for the entire rule will be deleted.
With regard to devices with a RUNNING state, consider also the selected version of the overlapping execution option .
When you have selected No Overlapping - Skip New the system will continue the execution of the currently running task and will not include the device in a new task even if you select the device for a Retry operation.
Find out more on the possible rule execution options in the Conceptual Guide.
If you do not need a particular rule any longer, you may Delete it through the respective button, which will also delete any monitoring data related to its executions.