HTTP Monitor check

This flow checks a HTTP or HTTPS URL on its contents. If a certain string is encountered (in this example 'A visual tool for wiring', as it checks the Node-Red website) the page is considered to be available. If the string is not encountered or the site could not be retrieved, the page is considered to be down.

There are two outputs for the check function, one for failure and one for success after the page is back up. This allows for the throttling of failure messages via a Rate Limiter, while the message that the page is backup is send immediately.

There is currently one caveat for this flow: if a page goes down, a message is send, the page goes back up and goes down again a little later, no message is send. This is because of the Rate Limiter, which does not get reset when the page is back up.

[{"id":"3fc2ea78.549ace","type":"http request","name":"Nodered site check","method":"GET","url":"","x":261.2499694824219,"y":135,"z":"1dca54.d12be5ac","wires":[["29e68ad0.cc2c0e"]]},{"id":"29e68ad0.cc2c0e","type":"function","name":"String check","func":"var title = 'Node-red check', result;\n\nif(msg.payload.indexOf('A visual tool for wiring') !== -1) {\n\tif(context.lastWasError) {\n\t\tcontext.lastWasError = false;\n\t\tresult = {\n\t\t\tpayload: 'Check is back up!',\n\t\t\ttopic: title\n\t\t};\n\t\treturn [null, result];\n\t}\n\treturn;\n}\n\nresult = {\n\tpayload: msg.payload,\n\ttopic: title\n};\ncontext.lastWasError = true;\nreturn [result, null];","outputs":"2","x":456.7499694824219,"y":136.25,"z":"1dca54.d12be5ac","wires":[["cba65a05.00c3"],["3839cb5d.1c34ac"]]},{"id":"cba65a05.00c3","type":"delay","name":"Rate limiter","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"day","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":624.2499694824219,"y":91,"z":"1dca54.d12be5ac","wires":[["bb03cc6a.16d6b8"]]},{"id":"ff61d2c5.281c58","type":"inject","name":"","topic":"Trigger","payload":"","payloadType":"none","repeat":"1800","crontab":"","once":true,"x":81.25,"y":135,"z":"1dca54.d12be5ac","wires":[["3fc2ea78.549ace"]]},{"id":"bb03cc6a.16d6b8","type":"debug","name":"Check failure","active":true,"console":"false","complete":"false","x":817.5,"y":91.25,"z":"1dca54.d12be5ac","wires":[]},{"id":"3839cb5d.1c34ac","type":"debug","name":"Check up","active":true,"console":"false","complete":"false","x":593.75,"y":170,"z":"1dca54.d12be5ac","wires":[]}]

Flow Info

created 4 years ago

Node Types

  • debug (x2)
  • delay (x1)
  • function (x1)
  • http request (x1)
  • inject (x1)


  • monitor
  • http
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option