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
| Method | Endpoint | Description |
|---|---|---|
POST | /automation/rules | Create rule |
GET | /automation/rules | List rules |
GET | /automation/rules/:id | Get rule |
PATCH | /automation/rules/:id | Update rule |
DELETE | /automation/rules/:id | Delete rule |
POST | /automation/rules/:id/toggle | Enable/disable |
POST | /automation/rules/:id/duplicate | Clone rule |
POST | /automation/rules/:id/execute | Manual trigger |
POST | /automation/rules/:id/preview | Preview execution |
POST | /automation/rules/:id/stop | Stop execution |
POST | /automation/rules/:id/pause | Pause execution |
POST | /automation/rules/:id/resume | Resume execution |
POST | /automation/rules/:id/retry | Retry failed |
GET | /automation/templates | List templates |
GET | /automation/metrics | Execution metrics |
GET | /automation/settings | Get settings |
PATCH | /automation/settings | Update 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
| Method | Endpoint | Description |
|---|---|---|
POST | /smart-alerts | Create alert |
GET | /smart-alerts | List alerts |
GET | /smart-alerts/:id | Get alert |
POST | /smart-alerts/:id/acknowledge | Acknowledge |
POST | /smart-alerts/:id/resolve | Resolve |
POST | /smart-alerts/:id/suppress | Suppress |
GET | /smart-alerts/stats | Alert statistics |
POST | /smart-alerts/evaluate | Force 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 deviceevaluateAllDevices()— Check all tenant devices- Emits
smart.alert.createdevent when new alert triggered - 5 default alert rules seeded on startup
Related Modules
DevicesModule— Device state evaluationTelemetryModule— Metric-based alert triggersNotificationsModule— Alert deliveryEventsModule— Real-time alert broadcasting