Skip to main content

Automation & Smart Alerts

Rule-based automation engine and intelligent alert system for device monitoring.

Automation Engine

Source: src/automation/
Permission: MANAGE_SYSTEM

In-Memory Storage

Automation rules are stored in an in-memory Map, not persisted to the database. Rules are lost on server restart. Three default templates are seeded on startup.

Endpoints

MethodEndpointDescription
POST/automation/rulesCreate rule
GET/automation/rulesList rules
GET/automation/rules/:idGet rule
PATCH/automation/rules/:idUpdate rule
DELETE/automation/rules/:idDelete rule
POST/automation/rules/:id/toggleEnable/disable
POST/automation/rules/:id/duplicateClone rule
POST/automation/rules/:id/executeManual trigger
POST/automation/rules/:id/previewPreview execution
POST/automation/rules/:id/stopStop execution
POST/automation/rules/:id/pausePause execution
POST/automation/rules/:id/resumeResume execution
POST/automation/rules/:id/retryRetry failed
GET/automation/templatesList templates
GET/automation/metricsExecution metrics
GET/automation/settingsGet settings
PATCH/automation/settingsUpdate settings

Default Templates (Seeded on Startup)

3 built-in automation templates are created when the module initializes.

Smart Alerts

Source: src/smart-alerts/
Permission: MANAGE_ALERTS

Intelligent alert evaluation with priority-based routing.

Endpoints

MethodEndpointDescription
POST/smart-alertsCreate alert
GET/smart-alertsList alerts
GET/smart-alerts/:idGet alert
POST/smart-alerts/:id/acknowledgeAcknowledge
POST/smart-alerts/:id/resolveResolve
POST/smart-alerts/:id/suppressSuppress
GET/smart-alerts/statsAlert statistics
POST/smart-alerts/evaluateForce evaluation

Alert Types & Priorities

enum AlertType {
DEVICE_OFFLINE, DEVICE_ERROR, PERFORMANCE,
SECURITY, MAINTENANCE, CUSTOM
}

enum AlertPriority {
LOW, MEDIUM, HIGH, CRITICAL
}

Evaluation

  • Cron job periodically evaluates all alert rules against device states
  • evaluateDeviceAlerts(deviceId) — Check one device
  • evaluateAllDevices() — Check all tenant devices
  • Emits smart.alert.created event when new alert triggered
  • 5 default alert rules seeded on startup
  • DevicesModule — Device state evaluation
  • TelemetryModule — Metric-based alert triggers
  • NotificationsModule — Alert delivery
  • EventsModule — Real-time alert broadcasting