n8n Server Online Slack Notifier

This automation posts when the n8n server comes online. It also gets the amount of storage used so far and the n8n version that is currently running and adds it to the slack notification.

image.png
{
  "meta": {
    "instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
  },
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        240,
        300
      ],
      "id": "b88f55f2-f9fd-46b1-85d4-e87eaaf134c1"
    },
    {
      "parameters": {
        "events": [
          "init"
        ]
      },
      "name": "n8n Trigger",
      "type": "n8n-nodes-base.n8nTrigger",
      "typeVersion": 1,
      "position": [
        240,
        460
      ],
      "id": "0f4673b9-689f-4451-8c95-11fdd52f7a9d"
    },
    {
      "parameters": {
        "authentication": "basicAuth",
        "url": "http://localhost:5678/rest/settings",
        "options": {}
      },
      "name": "Get n8n Version",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        460,
        460
      ],
      "typeVersion": 1,
      "id": "824d0f3a-c75c-4ae8-bdf9-bd1bb9de6526",
      "credentials": {
        "httpBasicAuth": {
          "id": "17",
          "name": "n8n Creds"
        }
      }
    },
    {
      "parameters": {
        "command": "df -k / | tail -1 | awk '{print $5}'"
      },
      "name": "Execute Command",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        640,
        460
      ],
      "id": "42fac717-8d4f-44c3-9ab5-b579fc772834"
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"stdout\"]}}",
              "value2": 50
            }
          ]
        }
      },
      "name": "Check if less than 50% used",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        860,
        460
      ],
      "id": "5d1e6db7-bcc5-4c97-b4da-2e17f501048e"
    },
    {
      "parameters": {},
      "name": "Less than 50% Storage Left",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1080,
        260
      ],
      "id": "f10ad10a-5f72-4bc3-92b6-4df699f225e9"
    },
    {
      "parameters": {},
      "name": "More than 50% Storage Left",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1080,
        520
      ],
      "id": "1737935b-e2ac-44dc-bda9-7c1d8bc99062"
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[\"stdout\"]}}",
              "operation": "largerEqual",
              "value2": 80
            }
          ]
        }
      },
      "name": "Check if more than 80% used1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1340,
        260
      ],
      "id": "42fb8bf6-cc8b-414e-8ac3-7dd68a2632dd"
    },
    {
      "parameters": {
        "channel": "alerts-n8n",
        "text": "=n8n.aztechsol.com is now online.\nN8n is on version `{{$node[\"Get n8n Version\"].json[\"data\"][\"versionCli\"]}}`\n`{{$json[\"stdout\"]}}` of Hard Disk Used",
        "otherOptions": {
          "unfurl_links": true
        },
        "attachments": [
          {
            "image_url": "https://aztechsol.com/wp-content/uploads/2022/06/n8nloadingnoloop.gif",
            "thumb_url": "https://aztechsol.com/wp-content/uploads/2022/06/n8nloadingnoloop.gif",
            "color": "#07FF03",
            "title": "Server Load Complete"
          }
        ]
      },
      "name": "Slack - All Good",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1280,
        520
      ],
      "id": "0c13446a-59b8-490a-b7d3-a29b31a47b94",
      "credentials": {
        "slackApi": {
          "id": "21",
          "name": "n8n creds - AZ Tech Sol"
        }
      }
    },
    {
      "parameters": {
        "channel": "alerts-n8n",
        "text": "=n8n.aztechsol.com is now online.\nN8n is on version `{{$node[\"Get n8n Version\"].json[\"data\"][\"versionCli\"]}}`\n`{{$json[\"stdout\"]}}` of Hard Disk Used",
        "otherOptions": {
          "unfurl_links": true
        },
        "attachments": [
          {
            "image_url": "https://aztechsol.com/wp-content/uploads/2022/06/low-disk-space-warning-thumbnail.jpg",
            "thumb_url": "https://aztechsol.com/wp-content/uploads/2022/06/low-disk-space-warning-thumbnail.jpg",
            "color": "#FF0303",
            "title": "Server Load Complete"
          }
        ]
      },
      "name": "20% Storage Left",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1600,
        120
      ],
      "id": "b317a110-88ed-4853-b17f-1abce93fb2c0",
      "credentials": {
        "slackApi": {
          "id": "21",
          "name": "n8n creds - AZ Tech Sol"
        }
      }
    },
    {
      "parameters": {
        "channel": "alerts-n8n",
        "text": "=n8n.aztechsol.com is now online.\nN8n is on version `{{$node[\"Get n8n Version\"].json[\"data\"][\"versionCli\"]}}`\n`{{$json[\"stdout\"]}}` of Hard Disk Used",
        "otherOptions": {
          "unfurl_links": true
        },
        "attachments": [
          {
            "image_url": "https://aztechsol.com/wp-content/uploads/2022/06/n8nloadingnoloop.gif",
            "thumb_url": "https://aztechsol.com/wp-content/uploads/2022/06/n8nloadingnoloop.gif",
            "color": "#F1FE00",
            "title": "Server Load Complete"
          }
        ]
      },
      "name": "Slack - Less than 50% Left",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1600,
        360
      ],
      "id": "3b5ba732-36f5-4c2e-9300-b0514880972f",
      "credentials": {
        "slackApi": {
          "id": "21",
          "name": "n8n creds - AZ Tech Sol"
        }
      }
    }
  ],
  "connections": {
    "n8n Trigger": {
      "main": [
        [
          {
            "node": "Get n8n Version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get n8n Version": {
      "main": [
        [
          {
            "node": "Execute Command",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command": {
      "main": [
        [
          {
            "node": "Check if less than 50% used",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if less than 50% used": {
      "main": [
        [
          {
            "node": "Less than 50% Storage Left",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "More than 50% Storage Left",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Less than 50% Storage Left": {
      "main": [
        [
          {
            "node": "Check if more than 80% used1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "More than 50% Storage Left": {
      "main": [
        [
          {
            "node": "Slack - All Good",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if more than 80% used1": {
      "main": [
        [
          {
            "node": "20% Storage Left",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - Less than 50% Left",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Back to Articles Subscribe by Email