{
  "id": "Fa5gHN3U2OqsX2ed",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n Monitoring best practices",
  "tags": [],
  "nodes": [
    {
      "id": "234daa50-a80c-4fd5-8814-eaa335391658",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 416,
        "content": "## Dummy Data Load\nThis node simulates the final step where your processed data is synced to a target system (like a CRM or Database), confirming the functional success of the workflow.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bda34c64-badd-4295-8066-2f7d15747d98",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 416,
        "content": "## Run this workflow manually\n"
      },
      "typeVersion": 1
    },
    {
      "id": "03f95f7e-a1aa-42f5-8768-dace371c93b6",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 640,
        "height": 448,
        "content": "# n8n Monitoring best practices\nHere you can find some best practices on how to monitor your workflow and get notified when an error occurs:\n\n**Dead Man\u2019s Switch Monitoring**: You monitor that at least one item is successfully processed every 24 hours. This ensures you get alerted even if the server or trigger fails quietly.\n\n**Performance Transparency**: You will get a clear overview of the exact amount of processed items in watchflow to detect \"successful\" runs that accidentally processed zero data.\n\n**Instant Incident Alerting**: You will receive immediate notifications the moment an unexpected error occurs, including the specific error message and a direct link to the failed execution."
      },
      "typeVersion": 1
    },
    {
      "id": "7cc0e9fa-fd48-467b-b15e-67c45e31ebbf",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 416,
        "content": "## Dummy Data Transformation\nDummy data transformation: This node simulates your business logic by processing the extracted items and preparing them for the final monitoring step."
      },
      "typeVersion": 1
    },
    {
      "id": "13df5c5f-9f22-499e-9db2-150a417a1d1d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        480
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 416,
        "content": "## Dummy Data Source\nYour dummy workflow data extraction source: In this step, we exemplary fetch 20 items from a source to simulate a real-world data stream for processing and monitoring."
      },
      "typeVersion": 1
    },
    {
      "id": "477e8408-78cc-4dd3-b2b9-46c40e5024af",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        64,
        640
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "86d39f6b-8630-4e66-8790-b60de3d4ccf3",
      "name": "Mark job as successful",
      "type": "@watchflow/n8n-nodes-watchflow.watchflow",
      "position": [
        2336,
        624
      ],
      "parameters": {
        "key": "sample",
        "data": "={\n  \"items\": {{ $('Aggregate').item.json.data.length }}\n} ",
        "name": "Sample Monitor"
      },
      "credentials": {
        "watchflowApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8e7e82e5-3595-47d9-938b-2e3d07b23602",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1568,
        640
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c93627bc-4108-4b13-8ac5-5311640258c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        480
      ],
      "parameters": {
        "width": 640,
        "height": 416,
        "content": "## Workflow Monitoring & Data Aggregation\nThis node uses an Aggregate pattern to collect all processed items into a single count. By calculating the total amount of successful syncs, you can send precise metrics to watchflow to ensure your workflow didn't just \"run,\" but actually delivered results."
      },
      "typeVersion": 1
    },
    {
      "id": "61e85dbb-9e2b-48b4-bf37-5d7b64c2b227",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        1936,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9737c5f0-16a5-4147-96b6-e1db07aebdf8",
      "name": "Mark job as failed",
      "type": "@watchflow/n8n-nodes-watchflow.watchflow",
      "position": [
        2192,
        256
      ],
      "parameters": {
        "key": "PDF_GENERATION",
        "name": "Pdf Generation",
        "error": "={{ JSON.stringify($json.execution) }}",
        "operation": "fail"
      },
      "credentials": {
        "watchflowApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7d632180-9eff-4fa2-a4c0-c3a6e6c47bbb",
      "name": "Set Label",
      "type": "n8n-nodes-base.set",
      "position": [
        1056,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "06efa185-5199-4609-8cf9-983997f76b6d",
              "name": "label",
              "type": "string",
              "value": "=Item #{{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "38ca4876-28bd-45ee-97a3-eaa7d5b40351",
      "name": "Get Items",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0f21ebca-bfe0-43b0-bdf2-584c3d604144",
              "name": "data",
              "type": "array",
              "value": "[1,2,3,4,5,6,7,8,9]"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "46552766-12d8-489c-842a-bbef9429cca8",
      "name": "Split Out Items",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        640,
        640
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "8b444607-f51e-4602-9020-c5c3cdaf635f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        96
      ],
      "parameters": {
        "width": 640,
        "height": 352,
        "content": "## Generic Error Trigger \nThis dedicated module listens for any unexpected node failure across your entire workflow. It captures the specific error message and the failed node name, immediately triggering an incident alert in watchflow so you can debug the exact execution link without searching through logs."
      },
      "typeVersion": 1
    },
    {
      "id": "903ad4d2-5385-46ed-88b7-fdb4a5ffc34a",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        2112,
        640
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "678a43f3-b9ee-4d54-b336-9a50a9763bad",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.length > 0 }}",
              "rightValue": "={{true}}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "607dad79-1b82-4ecb-8beb-7b06ea6eb828",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1936,
        640
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2c7ad47b-bef7-4aec-8161-39017d156964",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Mark job as successful",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Items": {
      "main": [
        [
          {
            "node": "Split Out Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Label": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Mark job as failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Items": {
      "main": [
        [
          {
            "node": "Set Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}