Files
buryan-infra/infra/n8n/workflows/alert-queue-processor.json
root d2ecee05bc feat(n8n): workflows-as-code — 4 canonical workflows under Git control
Closes Phase 0 of Foundation & Swarm sprint (#null).

Workflows:
- Buryan Health Monitor (webhook → host_states)
- Alert Queue Processor (cron 15min → Telegram)
- Uptime Kuma Self-Healing (webhook → Gitea issue)
- Gitea Task Dispatcher (webhook → Agent Swarm)

All workflows cleaned (del shared/activeVersion/versionId) for portability.

Ref: MASTER-PLAN.md v1.2 §4 Phase 0
2026-10-06 21:40:26 +03:00

178 lines
4.1 KiB
JSON

[
{
"updatedAt": "2026-08-05T20:15:46.000Z",
"createdAt": "2026-08-05T20:15:42.923Z",
"id": "alertQueueProc01",
"name": "Alert Queue Processor",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 15
}
]
}
},
"name": "Every 15 Minutes",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
260,
300
],
"id": "cron"
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT * FROM alert_queue ORDER BY created_at",
"options": {}
},
"name": "Get Queue",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [
460,
300
],
"id": "getqueue",
"credentials": {
"postgres": {
"id": "8czcy3lV8sUxWTd9",
"name": "Monitoring"
}
}
},
{
"parameters": {
"jsCode": "\nconst items = $('Get Queue').all();\nif (items.length === 0) return [];\nconst alerts = items.map(i => i.json);\nconst hosts = [...new Set(alerts.map(a => a.host))];\nconst lines = alerts.map(a => `${a.host} (${a.ip}): ${a.alert_text}`).join('\\n');\nconst title = hosts.length === 1 ? `🚨 ${hosts[0]} (${alerts[0].ip})` : `🚨 Массовый сбой (${hosts.length} хостов)`;\nreturn [{ json: { text: `${title}\\n\\n${lines}` } }];\n"
},
"name": "Aggregate Alerts",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
660,
300
],
"id": "aggregate"
},
{
"parameters": {
"chatId": "273442500",
"text": "={{ $json.text }}"
},
"name": "Send Summary",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
860,
300
],
"id": "sendsummary",
"credentials": {
"telegramApi": {
"id": "MI5ZSM5d514km2wE",
"name": "Telegram Bot"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "DELETE FROM alert_queue",
"options": {}
},
"name": "Clear Queue",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [
1060,
300
],
"id": "clearqueue",
"credentials": {
"postgres": {
"id": "8czcy3lV8sUxWTd9",
"name": "Monitoring"
}
}
}
],
"connections": {
"Every 15 Minutes": {
"main": [
[
{
"node": "Get Queue",
"type": "main",
"index": 0
}
]
]
},
"Get Queue": {
"main": [
[
{
"node": "Aggregate Alerts",
"type": "main",
"index": 0
}
]
]
},
"Aggregate Alerts": {
"main": [
[
{
"node": "Send Summary",
"type": "main",
"index": 0
}
]
]
},
"Send Summary": {
"main": [
[
{
"node": "Clear Queue",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": {
"node:Every 15 Minutes": {
"recurrenceRules": [
null
],
"recurrenceRuleSignatures": [
null
]
}
},
"meta": null,
"nodeGroups": [],
"pinData": {},
"triggerCount": 1,
"sourceWorkflowId": null,
"tags": [],
"versionMetadata": {
"name": null,
"description": null
}
}
]