8
n8n 中文网amn8n.com

多URL自动监控与宕机警报

高级

这是一个AI领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Gmail, SplitOut, Summarize 等节点,结合人工智能技术实现智能自动化。 多URL自动监控与宕机警报

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "b643a27a3e5d7748d41ee6285fc688ed2cbf9a93ddb8d5b0ae79684ac7064b2b",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "2744df51-ca51-4c01-9a49-b29c5b27f7bf",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        200
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cae73f18-028e-4cb5-aee2-a18768c5367e",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        480,
        100
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "urls"
      },
      "typeVersion": 1
    },
    {
      "id": "398d41cf-c555-44d7-bf08-2732a47a18e7",
      "name": "URLs",
      "type": "n8n-nodes-base.set",
      "position": [
        260,
        100
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "{\n  \"urls\": {\n    \"URL 2\": \"https://example.com\",\n    \"URL 1\": \"https://google.es\",\n    \"URL 4\": \"https://github.com\",\n    \"URL 3\": \"https://n8n.io\",\n    \"URL 5\": \"https://n8niouou.io\",\n    \"URL 6\": \"https://n8niopuou.io\"\n  }\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "876e4ca3-c607-4443-a4ec-cb83fe84e6c3",
      "name": "成功",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        260
      ],
      "parameters": {
        "columns": {
          "value": {
            "Caida": "=",
            "Funcional": "=Funciona: {{ $('Split Out').item.json.urls }}"
          },
          "schema": [
            {
              "id": "Funcional",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Funcional",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caida",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Caida",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920/edit?usp=drivesdk",
          "cachedResultName": "Prova2"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "nnznbiLx5YNRZzDM",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "c99e1ec7-0b11-4278-8f97-d6b9cef798cd",
      "name": "错误",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1220,
        460
      ],
      "parameters": {
        "columns": {
          "value": {
            "Caida": "=Caida: {{ $json.urls }}"
          },
          "schema": [
            {
              "id": "Funcional",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Funcional",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Caida",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Caida",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920/edit#gid=0",
          "cachedResultName": "Hoja 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/13EHjUGc0wHYbBYZFPqlGuSE1pnttvokU1y3gJCWz920/edit?usp=drivesdk",
          "cachedResultName": "Prova2"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "nnznbiLx5YNRZzDM",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "9aeec8f1-1498-4381-bfab-a76c8e40a862",
      "name": "总计",
      "type": "n8n-nodes-base.summarize",
      "position": [
        960,
        20
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "Caida"
            },
            {
              "field": "Funcional"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "01fd1dbc-ca4c-4a94-abbc-e1d67a7dd775",
      "name": "循环 URLs",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        700,
        100
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "760cea59-8d84-4abf-b91a-c277ca122420",
      "name": "运行触发器",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1ec7a4ea-e929-4f50-b4b8-4732b9e439ed",
      "name": "发送消息",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1560,
        20
      ],
      "webhookId": "cf566774-8539-422c-8129-7c9fea6b367c",
      "parameters": {
        "sendTo": "email@youemail.com",
        "message": "=Te informamos que actualmente estos URLs se encuentran caídos: \n\n{{ $json.url }}\n\n\nCaídos: {{ $('Total').item.json.count_Caida }}\n\nFuncionales: {{ $('Total').item.json.count_Funcional }}",
        "options": {},
        "subject": "Webs caídas"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "ED5PJ0BhFPmKkgyc",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e6ca120c-21e0-42c5-b3d0-c8e447e09386",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        1160,
        20
      ],
      "parameters": {
        "jsCode": "// 1) Traemos TODOS los ítems que generó el nodo \"Bucle URLs\"\nconst items = $items('Bucle URLs');   // respeta exactamente el nombre del nodo\n\n// 2) Extraemos la propiedad Caida y descartamos vacíos\nconst caidaUrls = items\n  .map(it => it.json.Caida)               \n  .filter(url => typeof url === 'string' && url.trim().length);\n\nif (caidaUrls.length === 0) {\n  throw new Error('No se encontraron URLs en la propiedad \"Caida\".');\n}\n\nreturn caidaUrls.map(url => ({ json: { url } }));\n\n/*  Si prefieres un ÚNICO item con el array completo, comenta la línea anterior\n    y descomenta esto:\nreturn [\n  { json: { caidaUrls } },     // { \"caidaUrls\": [\"https://n8niouou.io\", \"https://n8niopuou.io\"] }\n];\n*/\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d5fb83e9-689f-44f3-a02a-32ff511c9ee0",
      "name": "拆分输出2",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1360,
        20
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "url"
      },
      "typeVersion": 1
    },
    {
      "id": "464a16ea-17f0-4757-b491-1b331395cd14",
      "name": "请求",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        960,
        220
      ],
      "parameters": {
        "url": "={{ $json.urls }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "5df0c197-037d-46da-bc4b-fd7ed514bbe5",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        320
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "content": "## 工作原理 (P1)"
      },
      "typeVersion": 1
    },
    {
      "id": "8e2d7f73-8731-4b35-8fb0-10d68978a671",
      "name": "便签 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        500
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 180,
        "content": "## 工作原理 (P1)"
      },
      "typeVersion": 1
    },
    {
      "id": "4367f7ee-0b74-476b-84b4-202bc3d909e7",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        240
      ],
      "parameters": {
        "width": 260,
        "height": 180,
        "content": "## 工作原理 (P2)"
      },
      "typeVersion": 1
    },
    {
      "id": "466863c5-a256-499c-b457-4651de2bb8fc",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        460
      ],
      "parameters": {
        "width": 260,
        "height": 180,
        "content": "## 工作原理 (P2)"
      },
      "typeVersion": 1
    },
    {
      "id": "4cb90ac4-9808-413a-8fb0-c7ed0db631bb",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        40
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 220,
        "content": "### 在此处输入要扫描的URL"
      },
      "typeVersion": 1
    },
    {
      "id": "040739ca-50d8-4d77-bf3a-c7406bd60410",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 480,
        "content": "### 作为触发器,您也可以实现webhook或MCP"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Split Out2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URLs": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error": {
      "main": [
        [
          {
            "node": "Bucle URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Total": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Request": {
      "main": [
        [
          {
            "node": "Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success": {
      "main": [
        [
          {
            "node": "Bucle URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Bucle URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bucle URLs": {
      "main": [
        [
          {
            "node": "Total",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out2": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run trigger": {
      "main": [
        [
          {
            "node": "URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 人工智能

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量18
分类1
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Oriol Seguí

Oriol Seguí

@oxsr11

Completion of a higher degree on the way to university (computer engineering)

外部链接
在 n8n.io 查看

分享此工作流