Define rules in SSM

Contents

Overview

In SSM, a rule is a construction that defines what action should be taken with given data once a certain condition was met. Such rules give you flexibility to adjust your cluster for specific needs. For example, with SSM rules, you can automate moving log files that are older than 7 days to a special location and rename them, or if a file is requested rather frequently, you can move it to cache.

A rule consists of four parts:

  • Objects. Files to which the command will be applied.

  • Trigger. An optional parameter that defines when the condition will be checked, e.g. at a certain time or every N hours.

  • Conditions. An expression composed out of object property values and operators that is evaluated to true or false.

  • Commands. Actions that are launched once the condition is met.

A template for a rule is presented below:

<objects>: <trigger> | <conditions> | <commands>
NOTE
The symbols : and | are reserved by SSM as separators and cannot be used within the rule parts, otherwise the rule parse will fail.

The forementioned examples can be implemented as shown below.

file: path matches "var/logs/*.log" and age > 7day | rename -dest "var/old_logs/"
file: accessCount(15min) > 3 | cache

A rule can be in four states:

  • Active. When a rule is active, SSM will evaluate the conditions depending on the trigger and execute commands when the conditions are met.

  • Disabled. Default state of a rule after it was added. An active rule that is paused gets into this state, it can be reactivated afterwards. If there were unfinished actions while pausing, you can choose whether to finish these actions or to cancel them during the reactivation. The default behavior is to cancel them.

  • Finished. If a rule had a time trigger that was met and won’t be met again, it gets into this state.

  • Deleted. A state that a rule gets when the user deletes it, but there are still actions to complete. Once the actions are completed, the rule will be permanently deleted.

More information about the SSM rules is available in the SSM rules reference.

Add rules

To add a rule, you need to go the AD.SSM web interface. To do that, follow the steps below:

  1. On the Clusters page, find your ADH cluster with SSM installed and click its name.

  2. On the Services tab, click SSM and go to the Info tab in the service menu.

  3. Click the link leading to the web interface.

In the web UI, you can add rules on the Rules page.

The AD.SSM Rules page
The Rules page
The AD.SSM Rules page
The Rules page

To create a rule:

  1. In the AD.SSM interface, go to the Rules section.

  2. Select the Create rule option.

  3. In the window that appears, describe the desired rule and click Create.

The created rule will have the Disabled status. To activate it, click btn play light btn play dark. The status will change to Active.

Found a mistake? Seleсt text and press Ctrl+Enter to report it