{
  "name": "Guida - Monitorare se un sito e online",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            { "field": "minutes", "minutesInterval": 5 }
          ]
        }
      },
      "id": "trigger1",
      "name": "Ogni 5 minuti",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "url": "https://example.com",
        "options": {
          "timeout": 10000,
          "response": { "response": { "neverError": true } }
        }
      },
      "id": "http1",
      "name": "Verifica il sito",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0]
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "loose" },
          "conditions": [
            {
              "id": "cond1",
              "leftValue": "={{$json.statusCode}}",
              "rightValue": 200,
              "operator": { "type": "number", "operation": "notEquals" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "if1",
      "name": "Sito offline?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [440, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "a1", "name": "esito", "type": "string", "value": "OFFLINE" }
          ]
        }
      },
      "id": "set1",
      "name": "Sito OFFLINE",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [660, -80]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "a2", "name": "esito", "type": "string", "value": "ONLINE" }
          ]
        }
      },
      "id": "set2",
      "name": "Sito ONLINE",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [660, 80]
    }
  ],
  "connections": {
    "Ogni 5 minuti": { "main": [[{ "node": "Verifica il sito", "type": "main", "index": 0 }]] },
    "Verifica il sito": { "main": [[{ "node": "Sito offline?", "type": "main", "index": 0 }]] },
    "Sito offline?": {
      "main": [
        [{ "node": "Sito OFFLINE", "type": "main", "index": 0 }],
        [{ "node": "Sito ONLINE", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" }
}
