Node-red Docker Watchdogs

I am starting to see why there are so many fans of Node-RED. I got it setup today and the first project was to make use of HA-Dockermon to setup watchdogs to automatically restart all of the docker containers if they stop for some reason. I was inspired by the new YouTube channel “The Hook up” (e.g. Intro to Node-RED].

I started his video on setting up a watchdog to restart Node-RED if it stops responding for some reason. Then I used HA-Dockermon to restart the container when the “off” event is triggered for the container’s state switch. I set this up for all of my docker containers except Node-RED and Home Assistant. Finally I setup a watchdog for the Home Assistant container.

Of course I couldn’t use the switches in Home Assistant, because if Home assistant wasn’t working those switches won’t be available to check. :slight_smile: So I had to get the state of Home Assistant by reading the JSON response from HA-Dockermon (e.g. http://10.0.0.56:8126/container/home-assistant).

Anyway, if you have any questions, let me know. Here are screenshots with some examples of my setup.

Watchdogs Flow


Home Assistant State Node: 'mosquitto service state switch’

HTTP Request Node: 'dockermon restart url’

Home Assistant Watchdog Flow

Here is a link to flow code for Node-RED if you are interested.
https://github.com/brianhanifin/Home-AssistantConfig/tree/master/_nodered_flows

Hi,

I appreciate the effort, but isn’t it better to just define containers to restart automatically?
(I am doing it in docker-compose.yaml)
Your way, if Node-red is not working the containers won’t get restarted.

I am using a similar setup (HA-dockermon + Node-red) to monitor HASS container and notify me if it sopped for some reason (it will restart automatically on its own).

I wondered about that. But, I’m new to Docker too… so I wasn’t sure.

Using the trick by The Hook Up it should.

In retrospect I guess I over engineered it. I tend to do that. On the plus side I learned a lot, so it wasn’t a waste. :slight_smile:

Some times the node-red flows stop working, whilst the container appears to be running.
In the link “Into to node red” this uses hass to monitor for a state change of a input boolean and if that fails after say 1 minute it restarts node red container automatically

I think I will keep the Node-RED one, and maybe the Home Assistant one just in case. I might just set the HA one to check only like every 15 minutes. Its probably safe to assume that Docker Compose isn’t going to come to the rescue if it hasn’t by then.

I think I will disable the big one and keep it for reference for now.

Yep it is never a waste even if over-engineered :).
But it is always nice to discuss and see multiple opinions to see if we are doing something wrong or it can be improved.

I saw that some people were using watchdogs like you linked, but never got around to test it more.
Thaanks for the link - I will check it when I have time.

Hi,

is it possible to send me the flow of “Node-Red Watchdog”?

Thank you…

I haven’t used Node-red in years, nor have I had it installed. But here are the flows for you to try.