Skip to content

Rule Library

This page is under development.

Screenshots and detailed configuration options will be added soon.

Rule Library is the screen where automation rules are created and managed. Each rule binds a data source query, a condition expression, and an action.


Prerequisite

Before defining a rule, create a data source in Port and then a query in Compass. You will select that Compass record in the Trigger section.


Rule Components

Component Description
Trigger Which data source or Compass query to monitor
Condition Which value or state transition activates the rule
Action What to do when triggered (Alert Center entry, webhook, email)
Priority Critical / High / Medium / Low
Status Active / Inactive — pause without removing the rule

Creating a Rule

  1. Open Automation → Rule Library in the left menu.
  2. Click the Add New Rule button.
  3. In the Trigger section pick a data source and the relevant Compass query.
  4. In the Condition section define the threshold value or state expression (e.g. value > 95).
  5. In the Action section define what happens when triggered.
  6. Enter priority and description; click Save.

Condition Syntax

Conditions are written as JavaScript-like expressions (Goja engine):

Example Meaning
value > 95 When the value exceeds 95
value < 10 \|\| value > 90 When the value goes out of range
value >= threshold && status !== 'maintenance' When threshold is exceeded and not in maintenance
status === 'stopped' When status becomes "stopped"

Action Configuration

Alert Center Entry (Default)

When Alert Center is selected as the action, a record is automatically created in Alert Center when the rule triggers. The record includes the rule name, priority, trigger time, and the value at the time of trigger.

Webhook

  1. Select Webhook in the Action section.
  2. Enter the target URL (e.g. https://hooks.example.com/alert).
  3. Optionally add HTTP headers and a payload template.
  4. Pirivision sends a POST request to this URL when the rule triggers.

Payload

The JSON body includes the rule name, trigger time, value, and priority.

Email Notification

  1. Select Email in the Action section.
  2. Enter recipient email addresses (comma-separated).
  3. Customize the subject line.
  4. A notification email is sent to the listed addresses when the rule triggers.

SMTP Configuration

The email action requires SMTP configuration to be completed in the Docker Compose environment.


Rule Management

Action Description
Edit Update any component of the rule
Active / Inactive Toggle to temporarily pause the rule
Delete Remove the rule permanently
Test Trigger the condition manually with current data and see the result

Next Step

Alert Center — Alert ManagementAutomation OverviewHorizon — Monitoring PanelAtlas — Advanced Dashboard


Common Mistakes

Mistake Why It Happens Fix
Rule never triggers Compass query returns no data Test the query in Compass; verify data is present
Rule triggers constantly Condition is true on every data update Add a time window or debounce interval to the condition
Webhook fails Target URL unreachable Verify the URL is accessible from the Docker network
Email not received SMTP not configured Check the SMTP variables in dev/.env