{
  "name": "AI Infrastructure Analysis",
  "nodes": [
    {
      "parameters": {},
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://172.32.0.200:8000/proxmox/nodes",
        "options": {}
      },
      "name": "Get Infrastructure Data",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Prepare data for AI analysis\nconst nodes = items[0].json.nodes;\nlet infraSummary = \"Proxmox Infrastructure Summary:\\n\\n\";\n\nfor (const node of nodes) {\n  infraSummary += `Node: ${node.node}\\n`;\n  infraSummary += `Status: ${node.status}\\n`;\n  infraSummary += `CPU Usage: ${(node.cpu * 100).toFixed(2)}%\\n`;\n  infraSummary += `Memory: ${(node.mem / 1024 / 1024 / 1024).toFixed(2)}GB / ${(node.maxmem / 1024 / 1024 / 1024).toFixed(2)}GB\\n`;\n  infraSummary += `Uptime: ${Math.floor(node.uptime / 86400)} days\\n\\n`;\n}\n\nconst aiPrompt = `\nAnalyze this Proxmox infrastructure and provide recommendations:\n\n${infraSummary}\n\nPlease provide:\n1. Resource utilization assessment\n2. Potential optimization opportunities\n3. Security recommendations\n4. Capacity planning suggestions\n\nKeep the response concise and actionable.`;\n\nreturn [{\n  json: {\n    model: \"llama2\",\n    prompt: aiPrompt,\n    stream: false\n  }\n}];"
      },
      "name": "Prepare AI Prompt",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        680,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://172.32.0.200:8000/ollama/generate",
        "options": {
          "bodyContentType": "json"
        },
        "jsonBody": "={{$json}}"
      },
      "name": "Generate AI Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Process AI response\nconst response = items[0].json.response;\nconst timestamp = new Date().toISOString();\n\nreturn [{\n  json: {\n    analysis: response,\n    timestamp: timestamp,\n    source: 'Proxmox MCP Server AI Analysis'\n  }\n}];"
      },
      "name": "Process AI Response",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1120,
        300
      ]
    },
    {
      "parameters": {
        "channel": "#infrastructure",
        "text": "\ud83e\udd16 AI Infrastructure Analysis Report\n\nTimestamp: {{$json[\"timestamp\"]}}\n\n{{$json[\"analysis\"]}}\n\nGenerated by: {{$json[\"source\"]}}",
        "otherOptions": {}
      },
      "name": "Send to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1340,
        300
      ]
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Get Infrastructure Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Infrastructure Data": {
      "main": [
        [
          {
            "node": "Prepare AI Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare AI Prompt": {
      "main": [
        [
          {
            "node": "Generate AI Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI Analysis": {
      "main": [
        [
          {
            "node": "Process AI Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process AI Response": {
      "main": [
        [
          {
            "node": "Send to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}