For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Managing Rules

The OCS Rule engine allows automatic actions on objects when they match a certain criteria.

Triggers

The server uses a predefined set of triggers that determine when the rules are evaluated and the scope of the data considered:

  • Base inventory received: triggers when a base inventory is created or updated. The scope is limited to the fields defined in the base inventory. See Base inventory for more details.

  • User login: triggers when a user logs in through any authentication method. The scope is limited to user-related fields.

  • Network device inventory received: similar to the Base inventory received trigger, but applied to IPDiscover devices.

Default Rules

Out of the box, OCS provides six predefined rules, evaluated against the OS Name or Agent field of the base inventory and used to assign Templates automatically:

Field evaluated

OS Name

OS Name

OS Name

OS Name

Agent

OS Name

Value(s) expected

Windows

Ubuntu, Debian

Redhat, Centos, Alma, Rocky

Mac

OCS-NG

SNMP

Template

Windows

Debian based

RHEL based

macOS

Legacy

Generic SNMP

Rules general view
Rules general view

Rule evaluation order

Rules are evaluated per trigger, by execution priority order. Actions inside a rule are also evaluated by priority. Rules have a break on first match option: if enabled and the rule matches, its actions are executed first, then evaluation stops for remaining rules of that trigger.

If multiple executed rules/actions write the same field, the last executed write wins which is why priority order and break on first match are important.

To change the execution order:

1

Navigate to Configuration → Inventory → Rules.

2

Locate the handle.

Find the drag-and-drop handle on the left side of the Actions table for each entry.

3

Reposition the row.

Drag the handle to move the row to your desired order.

The table will automatically update to reflect the new order.

Creating a rule

1

Navigate to Configuration → Inventory → Rules.

2

Click the Add a rule button (top right of the table).

3

Complete the form.

  • Name

  • Enabled switch

  • Break on first match switch

4

Click Add.

The new rule will appear in the list.

5

Locate the newly created rule, then click the gear icon in the Actions column.

By default, you’ll be directed to the Criteria tab, where you can define the conditions a device or user must match.

6

Define a criteria and click Save.

7

Switch to the Actions tab.

8

Specify the actions to be performed on matching objects, then click Save.

1

Navigate to Configuration → Inventory → Rules.

2

Click the Add a rule button (top right of the table).

3

Complete the form.

4

Click Add.

The new rule will appear in the list.

5

Locate the newly created rule, then click the gear icon in the Actions column.

By default, you’ll be directed to the Criteria tab, where you can define the conditions a device or user must match.

6

Define a criteria and click Save.

7

Switch to the Actions tab.

8

Specify the actions to be performed on matching objects, then click Save.

Authentication rules can assign users to groups when they log in.

These rules can evaluate:

  • The authentication method used by the user

  • The authentication configuration used during login

  • Authentication metadata returned by the identity provider

Authentication metadata is specific to providers. Use . to navigate nested values.

Examples:

  • LDAP: memberOf, dn, attributes

  • OIDC: claims.sub, claims.email, claims.groups

  • CAS: attributes.givenName, attributes.roles, attributes.department

1

Navigate to Configuration → Inventory → Rules.

2

Click the Add a rule button (top right of the table).

3

Complete the form.

  • Name

  • Choose User login as the Triggers

  • Enable the rule

4

Click Add.

The new rule will appear in the list.

5

Locate the newly created rule, then click the gear icon in the Actions column.

By default, you’ll be directed to the Criteria tab, where you can define the conditions a user must match.

6

For this example, assign users authenticated with OIDC based on the custom_group attribute.

We check that claims.custom_group contains asset-management.

If several LDAP configurations are enabled, you can choose which one the rule applies to. Local, OIDC, and CAS only allow one active configuration.

7

Switch to the Actions tab.

8

Specify the actions to be performed on matching objects, then click Save.

Updating a rule

1

Navigate to Configuration → Inventory → Rules.

2

Locate the rule you want to modify and click the gear icon in the Actions column.

Modifying the criteria

On the default tab (Criteria), update or add new conditions as needed.

Modifying the action

Switch to the Actions tab, then update or add an action as needed.

3

Click Save.

Updating a rule immediately affects all future inventory or login events matching its criteria.

Enabling or disabling a rule

1

Navigate to Configuration → Inventory → Rules.

2

Locate the rule you want to modify and click the pencil icon in the Actions column.

3

Use the switch to enable or disable the rule.

4

Click Save.

Disabling a rule prevents it from being executed during inventory or login events until it is re-enabled.

Last updated