{
  "name": "Monitor Docker host health via SSH with GPT-4o-mini and alerts to Discord",
  "nodes": [
    {
      "id": "sticky-overview",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -416
      ],
      "parameters": {
        "width": 620,
        "height": 880,
        "content": "# Homelab Health Dashboard\n\nAutomated daily health monitoring for your homelab. SSH into your Docker host, collect 30+ system and container metrics, analyze with AI for actionable insights, and get a "
      }
    },
    {
      "id": "sticky-config",
      "name": "Sticky Note - Configuration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        32
      ],
      "parameters": {
        "width": 420,
        "height": 440,
        "content": "## ⚙️ Configuration\nEdit the configuration node below to set your Discord webhook URL, alert thresholds, and monitoring preferences. All user settings are in one place."
      }
    },
    {
      "id": "sticky-collection",
      "name": "Sticky Note - Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        32
      ],
      "parameters": {
        "width": 700,
        "height": 440,
        "content": "## 📊 Data Collection\nTwo SSH commands collect 30+ metrics in ~2 seconds. System metrics (real CPU %, memory, all filesystems, swap, network I/O, top 5 processes, zombies, failed services, connections)"
      }
    },
    {
      "id": "sticky-analysis",
      "name": "Sticky Note - AI Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        32
      ],
      "parameters": {
        "width": 764,
        "height": 440,
        "content": "## 🤖 AI Analysis\nLoads 7 days of historical metrics from Google Sheets, builds a context-rich prompt with all 30+ data points, and sends to the LLM. The AI returns structured JSON with severity-tagged"
      }
    },
    {
      "id": "sticky-output",
      "name": "Sticky Note - Delivery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        32
      ],
      "parameters": {
        "width": 600,
        "height": 520,
        "content": "## 📬 Delivery & Storage\nBuilds a 4-embed Discord dashboard: (1) status header with 6 inline metric fields, (2) severity-tagged AI findings with fix commands, (3) Docker ecosystem + network + trends + "
      }
    },
    {
      "id": "sticky-critical",
      "name": "Sticky Note - Critical Alerts",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        592
      ],
      "parameters": {
        "width": 1580,
        "height": 400,
        "content": "## 🚨 Critical Alerts\nRuns every 5 minutes with a lightweight SSH check. Edit the \"⚙️ Alert settings\" node to configure your Discord webhook URL and alert thresholds. Fires immediately if disk > 90%, m"
      }
    },
    {
      "id": "sticky-warning",
      "name": "Sticky Note - API Cost Warning",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1776,
        592
      ],
      "parameters": {
        "width": 320,
        "height": 192,
        "content": "⚠️ Requires OpenAI API key\n\n**Quick setup:** Create a key at [platform.openai.com/api-keys](https://platform.openai.com/api-keys), then add it in n8n via Credentials → OpenAI.\n\n**Full instructions:** "
      }
    },
    {
      "id": "daily-trigger",
      "name": "Run daily health check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        208,
        240
      ]
    },
    {
      "id": "config",
      "name": "⚙️ Configure monitoring settings",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        240
      ]
    },
    {
      "id": "ssh-system",
      "name": "Collect system metrics",
      "type": "n8n-nodes-base.ssh",
      "position": [
        640,
        240
      ]
    },
    {
      "id": "ssh-docker",
      "name": "Collect Docker container metrics",
      "type": "n8n-nodes-base.ssh",
      "position": [
        880,
        240
      ]
    },
    {
      "id": "parse-metrics",
      "name": "Parse and normalize all metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        240
      ]
    },
    {
      "id": "read-history",
      "name": "Read metrics history (last 7 days)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1360,
        240
      ]
    },
    {
      "id": "build-prompt",
      "name": "Build analysis prompt with history",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        240
      ]
    },
    {
      "id": "llm-chain",
      "name": "Generate daily health digest",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1792,
        240
      ]
    },
    {
      "id": "openai-model",
      "name": "OpenAI GPT-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1840,
        464
      ]
    },
    {
      "id": "format-digest",
      "name": "Format digest for Discord",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        240
      ]
    },
    {
      "id": "send-digest",
      "name": "Send daily digest to Discord",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2320,
        192
      ]
    },
    {
      "id": "store-metrics",
      "name": "Store today's metrics in history",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2528,
        368
      ]
    },
    {
      "id": "critical-trigger",
      "name": "Check for critical issues",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        208,
        784
      ]
    },
    {
      "id": "ssh-quick",
      "name": "Quick system health check",
      "type": "n8n-nodes-base.ssh",
      "position": [
        576,
        784
      ]
    },
    {
      "id": "check-thresholds",
      "name": "Check against critical thresholds",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        784
      ]
    },
    {
      "id": "if-critical",
      "name": "Any critical issues found?",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        784
      ]
    },
    {
      "id": "format-alert",
      "name": "Format critical alert message",
      "type": "n8n-nodes-base.code",
      "position": [
        1296,
        768
      ]
    },
    {
      "id": "send-alert",
      "name": "Send critical alert",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1536,
        768
      ]
    },
    {
      "id": "sticky-setup",
      "name": "Sticky Note - First-Time Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        1088
      ],
      "parameters": {
        "width": 1120,
        "height": 364,
        "content": "## 🚀 First-Time Setup\nClick \"Test workflow\" on the trigger below to auto-create a formatted \"Homelab Health Dashboard\" Google Sheet with color-coded metrics tracking, frozen headers, and conditional f"
      }
    },
    {
      "id": "setup-trigger",
      "name": "▶️ Run first-time setup",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        208,
        1264
      ]
    },
    {
      "id": "alert-config",
      "name": "⚙️ Alert settings",
      "type": "n8n-nodes-base.set",
      "position": [
        384,
        784
      ]
    },
    {
      "id": "setup-create",
      "name": "Create health dashboard spreadsheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        1264
      ]
    },
    {
      "id": "setup-layout",
      "name": "Build dashboard layout",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        1264
      ]
    },
    {
      "id": "setup-format",
      "name": "Format spreadsheet as dashboard",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        928,
        1264
      ]
    },
    {
      "id": "prepare-row",
      "name": "Prepare metrics row for storage",
      "type": "n8n-nodes-base.code",
      "position": [
        2320,
        368
      ]
    }
  ],
  "connections": {
    "OpenAI GPT-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Generate daily health digest",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Alert settings": {
      "main": [
        [
          {
            "node": "Quick system health check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build dashboard layout": {
      "main": [
        [
          {
            "node": "Format spreadsheet as dashboard",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect system metrics": {
      "main": [
        [
          {
            "node": "Collect Docker container metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run daily health check": {
      "main": [
        [
          {
            "node": "⚙️ Configure monitoring settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for critical issues": {
      "main": [
        [
          {
            "node": "⚙️ Alert settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format digest for Discord": {
      "main": [
        [
          {
            "node": "Send daily digest to Discord",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare metrics row for storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Quick system health check": {
      "main": [
        [
          {
            "node": "Check against critical thresholds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any critical issues found?": {
      "main": [
        [
          {
            "node": "Format critical alert message",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "▶️ Run first-time setup": {
      "main": [
        [
          {
            "node": "Create health dashboard spreadsheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate daily health digest": {
      "main": [
        [
          {
            "node": "Format digest for Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format critical alert message": {
      "main": [
        [
          {
            "node": "Send critical alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse and normalize all metrics": {
      "main": [
        [
          {
            "node": "Read metrics history (last 7 days)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare metrics row for storage": {
      "main": [
        [
          {
            "node": "Store today's metrics in history",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Docker container metrics": {
      "main": [
        [
          {
            "node": "Parse and normalize all metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check against critical thresholds": {
      "main": [
        [
          {
            "node": "Any critical issues found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build analysis prompt with history": {
      "main": [
        [
          {
            "node": "Generate daily health digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read metrics history (last 7 days)": {
      "main": [
        [
          {
            "node": "Build analysis prompt with history",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create health dashboard spreadsheet": {
      "main": [
        [
          {
            "node": "Build dashboard layout",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Configure monitoring settings": {
      "main": [
        [
          {
            "node": "Collect system metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}