forked from Eeveid/lightOps
实现 LightOps 运维面板基础功能
This commit is contained in:
29
migrations/0005_notifications.sql
Normal file
29
migrations/0005_notifications.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
CREATE TABLE IF NOT EXISTS notification_channels (
|
||||
id TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
channel_type TEXT NOT NULL,
|
||||
config_json TEXT NOT NULL DEFAULT '{}',
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS notification_deliveries (
|
||||
id TEXT PRIMARY KEY,
|
||||
event_id TEXT NOT NULL,
|
||||
channel TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
error TEXT,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
FOREIGN KEY(event_id) REFERENCES alert_events(id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_notification_deliveries_event ON notification_deliveries(event_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_notification_deliveries_status ON notification_deliveries(status, created_at DESC);
|
||||
|
||||
INSERT OR IGNORE INTO settings(key, value) VALUES
|
||||
('notifications.webhook_enabled', 'false'),
|
||||
('notifications.webhook_url', '');
|
||||
|
||||
INSERT OR IGNORE INTO alert_rules(id, name, metric, operator, threshold, severity) VALUES
|
||||
('builtin-ssl-expiring', 'SSL 证书即将到期', 'ssl_days_remaining', '<=', 30, 'warning');
|
||||
Reference in New Issue
Block a user