{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "4f8a356e-3d08-4386-860d-3b0651d8993d",
      "name": "Monitoring Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        928
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "*/10 1-4 * * 1-5"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "1fe43501-0cc3-4167-ba17-3eaaee1fb101",
      "name": "Loop Over Targets",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        112,
        928
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "88c65eb8-8ee9-4857-ade1-6ee8f8de404b",
      "name": "Health Check",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        560,
        848
      ],
      "parameters": {
        "url": "={{ $('Loop Over Targets').item.json.url }}",
        "options": {
          "timeout": 3000,
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "96e1da86-a8ef-4368-8797-c7697b035149",
      "name": "Check Status 200",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        752
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8d74755f-f5b9-4747-95df-dee3137af1a1",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.statusCode }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b742efe6-1751-4f12-b2b7-fe6f65eab4f4",
      "name": "Generate Alert Message (GPT-4o-mini)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1328,
        864
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=\u3042\u306a\u305f\u306f\u591c\u9593\u306e\u969c\u5bb3\u4e00\u6b21\u5bfe\u5fdc\u652f\u63f4\u62c5\u5f53\u3067\u3059\u3002\n\u6b21\u306e\u76e3\u8996\u7d50\u679c\u304b\u3089\u3001\u904b\u7528\u62c5\u5f53\u304c\u3059\u3050\u52d5\u3051\u308b\u300c\u77ed\u3044\u901a\u77e5\u6587\u300d\u3092\u4f5c\u3063\u3066\u304f\u3060\u3055\u3044\u3002\n\n\u3010\u76e3\u8996\u7d50\u679c\u3011\nsystem_name: {{ $('Set NG Result').item.json.name }}\nurl: {{ $('Set NG Result').item.json.url }}\nstatusCode: {{ $('Set NG Result').item.json.status_code }}\nerror_message: {{ $('Set NG Result').item.json.error_message }}\nchecked_at: {{ $('Set NG Result').item.json.checked_at }}\n\n\u3010\u51fa\u529b\u30eb\u30fc\u30eb\u3011\n- \u65e5\u672c\u8a9e\n- 250\u6587\u5b57\u4ee5\u5185\uff08\u9577\u304f\u3057\u306a\u3044\uff09\n- \u6b21\u306e\u5f62\u5f0f\u3067\u51fa\u529b\uff08\u6539\u884c\u3092\u542b\u3080\uff09\n\u72b6\u6cc1: ...\n\u7dca\u6025\u5ea6: \u9ad8/\u4e2d/\u4f4e\n\u307e\u305a\u78ba\u8a8d: 1) ... 2) ... 3) ...\n\u30a8\u30b9\u30ab\u30ec: ..."
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "69814c49-880c-49bb-86b2-a38f8bd689bb",
      "name": "Send Alert Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1616,
        864
      ],
      "parameters": {
        "sendTo": "YOUR_ALERT_EMAIL_ADDRESS",
        "message": "={{ $json.output[0].content[0].text }}",
        "options": {},
        "subject": "=\ud83d\udea8 Alert: {{ $('Set NG Result').item.json.name }} is DOWN / {{ $('Set NG Result').item.json.status_code }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "78aff004-8cef-4d35-980d-4263feeb97e7",
      "name": "No Operation (Continue Loop)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        2032,
        912
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "65d32fe7-b13c-4de4-8319-4e35cbf96a6f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        192
      ],
      "parameters": {
        "width": 1008,
        "height": 688,
        "content": "## \ud83d\udda5\ufe0f Nighttime System Health Monitor \u2014 Sheets \u00d7 GPT-4o-mini \u00d7 Gmail\n\n**Who this is for**\nSystem administrators, DevOps, and IT operations teams who need automated overnight monitoring of internal services or APIs \u2014 with AI-generated alert messages sent directly to email.\n\n**What this workflow does**\n- Reads monitoring targets (URLs) from Google Sheets\n- Runs health checks against each URL on a schedule\n- Logs every result (OK and ERROR) to Google Sheets\n- On failure: generates a structured Japanese alert message via GPT-4o-mini and sends it by Gmail\n- Updates the log to record whether an alert was sent\n\n**How it works**\n1. Monitoring Schedule triggers every 10 minutes, weekdays 1:00\u20134:59 AM (Cron: */10 1-4 * * 1-5)\n2. Read Monitor Targets fetches active URLs from the Monitor Targets sheet\n3. Loop Over Targets processes each URL one by one\n4. Record Start Time captures the start timestamp for response time calculation\n5. Health Check sends an HTTP GET request (timeout: 3000ms)\n6. Check Status 200 routes OK (200) and non-OK responses\n7. Set OK Result / Set NG Result formats the result data\n8. Log to Check Log (OK/ERROR) appends every result to the Check Log sheet\n9. On ERROR: Generate Alert Message creates a structured alert in Japanese via GPT-4o-mini\n10. Send Alert Email delivers the alert to the configured email address\n11. Update alert_sent to TRUE marks the log entry as notified\n\n**Prerequisites**\n- Google Sheets (copy link provided in the Setup section below)\n- Gmail account connected to n8n\n- OpenAI API key"
      },
      "typeVersion": 1
    },
    {
      "id": "5f54c42e-cb3a-432b-bde5-eeebaa7031dd",
      "name": "Read Monitor Targets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -112,
        928
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ true }}",
              "lookupColumn": "active"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Monitor Targets"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/edit?usp=drivesdk",
          "cachedResultName": "System Health Monitor - Config & Log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "f06805e8-ca40-4a46-a24b-1fbf611e67f6",
      "name": "Record Start Time",
      "type": "n8n-nodes-base.set",
      "position": [
        336,
        848
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "24c6c235-b4c6-46a8-8c7b-957599308f22",
              "name": "start_time",
              "type": "number",
              "value": "={{ Date.now() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e111a598-aedc-4c39-b00a-67e812f9a8a2",
      "name": "Set OK Result",
      "type": "n8n-nodes-base.set",
      "position": [
        1344,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "87c63c28-37ff-48f6-8c60-7d1f22392cc7",
              "name": "checked_at",
              "type": "string",
              "value": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}"
            },
            {
              "id": "58e17fa7-649e-451a-b862-82e108e6ac3a",
              "name": "name",
              "type": "string",
              "value": "={{ $('Loop Over Targets').item.json.name }}"
            },
            {
              "id": "922a9606-446d-475d-b8dd-b1c77456e5cc",
              "name": "url",
              "type": "string",
              "value": "={{ $('Loop Over Targets').item.json.url }}"
            },
            {
              "id": "a36586c6-b0a4-4a87-a905-ce3996ecfe07",
              "name": "status",
              "type": "string",
              "value": "OK"
            },
            {
              "id": "868ae1b7-b90f-4526-ba01-8fc4fd338ebe",
              "name": "status_code",
              "type": "string",
              "value": "={{ $('Health Check').item.json.statusCode }}"
            },
            {
              "id": "388f1210-e827-4540-b289-98bc00c8baea",
              "name": "response_time_ms",
              "type": "number",
              "value": "={{ Date.now() - $('Record Start Time').item.json.start_time }}"
            },
            {
              "id": "e015c17d-2770-4fa0-ad85-8b8f0b68a5b0",
              "name": "error_message",
              "type": "string",
              "value": ""
            },
            {
              "id": "4795122e-21ca-49b2-a192-3d9b579e222a",
              "name": "alert_sent",
              "type": "string",
              "value": "FALSE"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b242b895-224f-4813-a829-883261a100ab",
      "name": "Log to Check Log (OK)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1632,
        640
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $json.url }}",
            "name": "={{ $json.name }}",
            "status": "={{ $json.status }}",
            "alert_sent": "={{ $json.alert_sent }}",
            "checked_at": "={{ $json.checked_at }}",
            "status_code": "={{ $json.status_code }}",
            "error_message": "={{ $json.error_message }}",
            "response_time_ms": "={{ $json.response_time_ms }}"
          },
          "schema": [
            {
              "id": "checked_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "checked_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status_code",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status_code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "response_time_ms",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "response_time_ms",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "error_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "alert_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "alert_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Check Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/edit?usp=drivesdk",
          "cachedResultName": "System Health Monitor - Config & Log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "89b6c3d4-a422-4e4e-bdb0-e106a463b22a",
      "name": "Log to Check Log (ERROR)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1152,
        864
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $json.url }}",
            "name": "={{ $json.name }}",
            "status": "={{ $json.status }}",
            "alert_sent": "={{ $json.alert_sent }}",
            "checked_at": "={{ $json.checked_at }}",
            "status_code": "={{ $json.status_code }}",
            "error_message": "={{ $json.error_message }}",
            "response_time_ms": "={{ $json.response_time_ms }}"
          },
          "schema": [
            {
              "id": "checked_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "checked_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status_code",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status_code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "response_time_ms",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "response_time_ms",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "error_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "alert_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "alert_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Check Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/edit?usp=drivesdk",
          "cachedResultName": "System Health Monitor - Config & Log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c4223442-7975-41ba-9830-1b044e587928",
      "name": "Set NG Result",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        864
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "87c63c28-37ff-48f6-8c60-7d1f22392cc7",
              "name": "checked_at",
              "type": "string",
              "value": "={{ $now.format('yyyy-MM-dd HH:mm:ss') }}"
            },
            {
              "id": "58e17fa7-649e-451a-b862-82e108e6ac3a",
              "name": "name",
              "type": "string",
              "value": "={{ $('Loop Over Targets').item.json.name }}"
            },
            {
              "id": "922a9606-446d-475d-b8dd-b1c77456e5cc",
              "name": "url",
              "type": "string",
              "value": "={{ $('Loop Over Targets').item.json.url }}"
            },
            {
              "id": "a36586c6-b0a4-4a87-a905-ce3996ecfe07",
              "name": "status",
              "type": "string",
              "value": "ERROR"
            },
            {
              "id": "868ae1b7-b90f-4526-ba01-8fc4fd338ebe",
              "name": "status_code",
              "type": "string",
              "value": "={{ $('Health Check').item.json.statusCode || $json.error?.code || \"N/A\" }}"
            },
            {
              "id": "388f1210-e827-4540-b289-98bc00c8baea",
              "name": "response_time_ms",
              "type": "number",
              "value": "={{ Date.now() - $('Record Start Time').item.json.start_time }}"
            },
            {
              "id": "e015c17d-2770-4fa0-ad85-8b8f0b68a5b0",
              "name": "error_message",
              "type": "string",
              "value": "={{ $json.error?.message || $json.errorMessage || $json.message || \"unknown error\" }}"
            },
            {
              "id": "4795122e-21ca-49b2-a192-3d9b579e222a",
              "name": "alert_sent",
              "type": "string",
              "value": "FALSE"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1d2d86e8-f67e-4d47-88f2-782ed2975937",
      "name": "Update alert_sent to TRUE",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1776,
        864
      ],
      "parameters": {
        "columns": {
          "value": {
            "alert_sent": "TRUE",
            "checked_at": "={{ $('Log to Check Log (ERROR)').item.json.checked_at }}"
          },
          "schema": [
            {
              "id": "checked_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "checked_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status_code",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "status_code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "response_time_ms",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "response_time_ms",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "error_message",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "error_message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "alert_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "alert_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "checked_at"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Check Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/edit?usp=drivesdk",
          "cachedResultName": "System Health Monitor - Config & Log"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "7baf3119-354a-4c4b-b455-e34a64e7469b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1760,
        1152
      ],
      "parameters": {
        "color": 5,
        "width": 880,
        "height": 1120,
        "content": "## \ud83d\udcca Google Sheets Setup\n\n1. Make a copy of the template spreadsheet:\n   \ud83d\udc49 https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/copy\n\n2. Copy the Spreadsheet ID from your copied sheet's URL:\n   `https://docs.google.com/spreadsheets/d/\u3010THIS IS THE ID\u3011/edit`\n\n3. Replace the Spreadsheet ID in the following nodes with your copied sheet's ID:\n   - Read Monitor Targets\n   - Log to Check Log (OK)\n   - Log to Check Log (ERROR)\n   - Update alert_sent to TRUE\n\n4. Add your monitoring targets to the Monitor Targets sheet:\n   | name       | url                             | active |\n   |------------|-------------------------------|--------|\n   | Service A  | https://your-service.com/health | TRUE   |\n   | Service B  | https://api.example.com/ping    | TRUE   |\n\n   Set active to FALSE to temporarily disable a target without deleting the row.\n\n---\n\n## \ud83d\udcca Google Sheets\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\n\n1. \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30b3\u30d4\u30fc\u3092\u4f5c\u6210\uff1a\n   \ud83d\udc49 https://docs.google.com/spreadsheets/d/1OIo7K64HGvfUFufGYvAqxElVc0Ot65x3g-D5_w7ulLs/copy\n\n2. \u30b3\u30d4\u30fc\u3057\u305f\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eURL\u304b\u3089ID\u3092\u53d6\u5f97\uff1a\n   `https://docs.google.com/spreadsheets/d/\u3010\u3053\u3053\u304cID\u3011/edit`\n\n3. \u4ee5\u4e0b\u306e\u30ce\u30fc\u30c9\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\u3092\u30b3\u30d4\u30fc\u5148\u306eID\u306b\u5909\u66f4\u3059\u308b\uff1a\n   - Read Monitor Targets\n   - Log to Check Log (OK)\n   - Log to Check Log (ERROR)\n   - Update alert_sent to TRUE\n\n4. Monitor Targets\u30b7\u30fc\u30c8\u306bURL\u3092\u8ffd\u52a0\u3059\u308b\uff1a\n   | name       | url                             | active |\n   |------------|---------------------------------|--------|\n   | Service A  | https://your-service.com/health | TRUE   |\n   | Service B  | https://api.example.com/ping    | TRUE   |\n\n   active\u3092FALSE\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u884c\u3092\u524a\u9664\u305b\u305a\u306b\u4e00\u6642\u7684\u306b\u76e3\u8996\u3092\u505c\u6b62\u3067\u304d\u307e\u3059\u3002"
      },
      "typeVersion": 1
    },
    {
      "id": "9ee879e7-59af-4cbe-b6c1-613626ce7586",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        1136
      ],
      "parameters": {
        "color": 5,
        "width": 864,
        "height": 688,
        "content": "## \ud83d\udd11 Credentials & Settings Checklist\n\nReplace all placeholders before publishing:\n\n| Placeholder | Type | Node(s) |\n|---|---|---|\n| YOUR_GOOGLE_SHEETS_CREDENTIAL | Google Sheets OAuth2 | Read Monitor Targets, Log to Check Log (OK/ERROR), Update alert_sent to TRUE |\n| YOUR_GMAIL_CREDENTIAL | Gmail OAuth2 | Send Alert Email |\n| YOUR_OPENAI_CREDENTIAL | OpenAI API Key | Generate Alert Message (GPT-4o-mini) |\n| YOUR_ALERT_EMAIL_ADDRESS | Email address | Send Alert Email \u2192 sendTo field |\n\n---\n\n## \ud83d\udd11 \u30af\u30ec\u30c7\u30f3\u30b7\u30e3\u30eb\u30fb\u8a2d\u5b9a\u30c1\u30a7\u30c3\u30af\u30ea\u30b9\u30c8\n\nPublish\u3059\u308b\u524d\u306b\u5168\u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u30fc\u3092\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\uff1a\n\n| \u30d7\u30ec\u30fc\u30b9\u30db\u30eb\u30c0\u30fc | \u7a2e\u5225 | \u5bfe\u8c61\u30ce\u30fc\u30c9 |\n|---|---|---|\n| YOUR_GOOGLE_SHEETS_CREDENTIAL | Google Sheets OAuth2 | Read Monitor Targets\u3001Log to Check Log (OK/ERROR)\u3001Update alert_sent to TRUE |\n| YOUR_GMAIL_CREDENTIAL | Gmail OAuth2 | Send Alert Email |\n| YOUR_OPENAI_CREDENTIAL | OpenAI API\u30ad\u30fc | Generate Alert Message (GPT-4o-mini) |\n| YOUR_ALERT_EMAIL_ADDRESS | \u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9 | Send Alert Email \u2192 sendTo\u30d5\u30a3\u30fc\u30eb\u30c9 |"
      },
      "typeVersion": 1
    },
    {
      "id": "06cb9d89-ef76-41d0-97e4-fc86aa9a4fb0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        1136
      ],
      "parameters": {
        "color": 5,
        "width": 1024,
        "height": 1008,
        "content": "## \u23f0 Schedule Setting\n\nThis workflow runs every 10 minutes between 1:00\u20134:59 AM on weekdays (Mon\u2013Fri).\nThe timezone follows your n8n instance setting (Settings \u2192 Default Timezone).\nAdjust the Cron expression in the Monitoring Schedule node to fit your window.\n\n*/10 1-4 * * 1-5   \u2192 Every 10 min, 1:00\u20134:59 AM, Mon\u2013Fri (current setting)\n*/5 22-23 * * 1-5  \u2192 Every 5 min, 10:00 PM\u201311:59 PM, Mon\u2013Fri\n*/10 0-5 * * *     \u2192 Every 10 min, 0:00\u20135:59 AM, every day\n\n\u26a0\ufe0f Note: checked_at is used as the matching key in Update alert_sent to TRUE.\nIn rare cases where multiple errors occur within the same second,\nthe update may affect the wrong row. This is acceptable for most use cases.\n\n---\n\n## \u23f0 \u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u8a2d\u5b9a\n\n\u3053\u306e\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u306f\u5e73\u65e5\uff08\u6708\u301c\u91d1\uff09\u306e1:00\u301c4:59\u306e\u9593\u300110\u5206\u3054\u3068\u306b\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\n\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306fn8n\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u8a2d\u5b9a\uff08Settings \u2192 Default Timezone\uff09\u306b\u5f93\u3044\u307e\u3059\u3002\nMonitoring Schedule\u30ce\u30fc\u30c9\u306eCron\u5f0f\u3092\u5909\u66f4\u3057\u3066\u76e3\u8996\u6642\u9593\u5e2f\u3092\u8abf\u6574\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\n*/10 1-4 * * 1-5   \u2192 \u5e73\u65e5 1:00\u301c4:59 \u306b10\u5206\u3054\u3068\uff08\u73fe\u5728\u306e\u8a2d\u5b9a\uff09\n*/5 22-23 * * 1-5  \u2192 \u5e73\u65e5 22:00\u301c23:59 \u306b5\u5206\u3054\u3068\n*/10 0-5 * * *     \u2192 \u6bce\u65e5 0:00\u301c5:59 \u306b10\u5206\u3054\u3068\n\n\u26a0\ufe0f \u6ce8\u610f\uff1aUpdate alert_sent to TRUE\u30ce\u30fc\u30c9\u306fchecked_at\u3092\u30de\u30c3\u30c1\u30f3\u30b0\u30ad\u30fc\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\n\u540c\u4e00\u79d2\u5185\u306b\u8907\u6570\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3001\u7a00\u306b\u8aa4\u3063\u305f\u884c\u304c\u66f4\u65b0\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\n\u307b\u3068\u3093\u3069\u306e\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u3067\u306f\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002"
      },
      "typeVersion": 1
    },
    {
      "id": "0f4fe26f-6ee4-41d6-8a9a-7c45e02362b6",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        928
      ],
      "parameters": {
        "width": 1008,
        "height": 784,
        "content": "## \ud83d\udda5\ufe0f \u591c\u9593\u30b7\u30b9\u30c6\u30e0\u6b7b\u6d3b\u76e3\u8996 \u2014 Sheets \u00d7 GPT-4o-mini \u00d7 Gmail\n\n**\u3053\u306e\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u306e\u5bfe\u8c61\u30e6\u30fc\u30b6\u30fc**\n\u793e\u5185\u30b5\u30fc\u30d3\u30b9\u3084API\u306e\u591c\u9593\u76e3\u8996\u3092\u81ea\u52d5\u5316\u3057\u3001\u969c\u5bb3\u767a\u751f\u6642\u306bAI\u304c\u751f\u6210\u3057\u305f\u65e5\u672c\u8a9e\u30a2\u30e9\u30fc\u30c8\u3092\u30e1\u30fc\u30eb\u3067\u53d7\u3051\u53d6\u308a\u305f\u3044\u30b7\u30b9\u30c6\u30e0\u7ba1\u7406\u8005\u30fbDevOps\u30fbIT\u904b\u7528\u62c5\u5f53\u8005\u5411\u3051\u3067\u3059\u3002\n\n**\u3053\u306e\u30ef\u30fc\u30af\u30d5\u30ed\u30fc\u3067\u3067\u304d\u308b\u3053\u3068**\n- Google Sheets\u304b\u3089\u76e3\u8996\u5bfe\u8c61URL\u4e00\u89a7\u3092\u8aad\u307f\u8fbc\u3080\n- \u5404URL\u306b\u5bfe\u3057\u3066\u30d8\u30eb\u30b9\u30c1\u30a7\u30c3\u30af\u3092\u5b9f\u884c\u3059\u308b\n- \u5168\u7d50\u679c\uff08OK\u304a\u3088\u3073ERROR\uff09\u3092Google Sheets\u306b\u30ed\u30b0\u3068\u3057\u3066\u8a18\u9332\u3059\u308b\n- \u969c\u5bb3\u691c\u77e5\u6642\uff1aGPT-4o-mini\u304c\u69cb\u9020\u5316\u3055\u308c\u305f\u65e5\u672c\u8a9e\u30a2\u30e9\u30fc\u30c8\u3092\u751f\u6210\u3057\u3001Gmail\u3067\u9001\u4fe1\u3059\u308b\n- \u30a2\u30e9\u30fc\u30c8\u9001\u4fe1\u6e08\u307f\u304b\u3069\u3046\u304b\u3092\u30ed\u30b0\u306b\u8a18\u9332\u3059\u308b\n\n**\u51e6\u7406\u306e\u6d41\u308c**\n1. Monitoring Schedule\u304c\u5e73\u65e51:00\u301c4:59\u306e10\u5206\u3054\u3068\u306b\u8d77\u52d5\uff08Cron: */10 1-4 * * 1-5\uff09\n2. Read Monitor Targets\u304cMonitor Targets\u30b7\u30fc\u30c8\u304b\u3089\u30a2\u30af\u30c6\u30a3\u30d6\u306aURL\u3092\u53d6\u5f97\n3. Loop Over Targets\u304c1\u4ef6\u305a\u3064\u51e6\u7406\n4. Record Start Time\u304c\u30ec\u30b9\u30dd\u30f3\u30b9\u30bf\u30a4\u30e0\u8a08\u6e2c\u7528\u306e\u958b\u59cb\u6642\u523b\u3092\u8a18\u9332\n5. Health Check\u304cHTTP GET\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u9001\u4fe1\uff08\u30bf\u30a4\u30e0\u30a2\u30a6\u30c8: 3000ms\uff09\n6. Check Status 200\u304cOK\uff08200\uff09\u3068\u975eOK\u3092\u632f\u308a\u5206\u3051\n7. Set OK Result / Set NG Result\u304c\u7d50\u679c\u30c7\u30fc\u30bf\u3092\u6574\u5f62\n8. Log to Check Log\uff08OK/ERROR\uff09\u304cCheck Log\u30b7\u30fc\u30c8\u306b\u5168\u7d50\u679c\u3092\u8a18\u9332\n9. ERROR\u306e\u5834\u5408\uff1aGenerate Alert Message\u304c\u30a2\u30e9\u30fc\u30c8\u6587\u3092\u751f\u6210\n10. Send Alert Email\u304c\u30e1\u30fc\u30eb\u3067\u30a2\u30e9\u30fc\u30c8\u3092\u9001\u4fe1\n11. Update alert_sent to TRUE\u304c\u30ed\u30b0\u3092\u30a2\u30e9\u30fc\u30c8\u9001\u4fe1\u6e08\u307f\u306b\u66f4\u65b0\n\n**\u524d\u63d0\u6761\u4ef6**\n- Google Sheets\uff08\u4e0b\u8a18\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30bb\u30af\u30b7\u30e7\u30f3\u306e\u30b3\u30d4\u30fc\u7528\u30ea\u30f3\u30af\u3092\u4f7f\u7528\uff09\n- n8n\u306b\u63a5\u7d9a\u6e08\u307f\u306eGmail\u30a2\u30ab\u30a6\u30f3\u30c8\n- OpenAI API\u30ad\u30fc"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Health Check": {
      "main": [
        [
          {
            "node": "Check Status 200",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set NG Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set NG Result": {
      "main": [
        [
          {
            "node": "Log to Check Log (ERROR)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set OK Result": {
      "main": [
        [
          {
            "node": "Log to Check Log (OK)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status 200": {
      "main": [
        [
          {
            "node": "Set OK Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set NG Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Alert Email": {
      "main": [
        [
          {
            "node": "Update alert_sent to TRUE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Targets": {
      "main": [
        [],
        [
          {
            "node": "Record Start Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record Start Time": {
      "main": [
        [
          {
            "node": "Health Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monitoring Schedule": {
      "main": [
        [
          {
            "node": "Read Monitor Targets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Monitor Targets": {
      "main": [
        [
          {
            "node": "Loop Over Targets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Check Log (OK)": {
      "main": [
        [
          {
            "node": "No Operation (Continue Loop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Check Log (ERROR)": {
      "main": [
        [
          {
            "node": "Generate Alert Message (GPT-4o-mini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update alert_sent to TRUE": {
      "main": [
        [
          {
            "node": "No Operation (Continue Loop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation (Continue Loop)": {
      "main": [
        [
          {
            "node": "Loop Over Targets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Alert Message (GPT-4o-mini)": {
      "main": [
        [
          {
            "node": "Send Alert Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}