Monitor Internet Connection - Uptime Kuma

We had a question in beta about how to monitor internet connection. Great question! This can be done on other platforms. You can run Uptime Kuma wherever. We just happen to provide it on CORE because it’s a great tool with a ton of benefits. That being said, below is a walkthrough on setting it up on CORE. If you’re doing this on another system, you’d need to modify it accordingly.

After enabling Uptime Kuma on CORE

sudo oll-uptime-kuma --enable
sudo oll-uptime-kuma --start

You can also do this in SYS|Dash

image

Once it’s up and running, open the interface. The tile will be in SYS|Dash.

First
Go into settings and create the notification.
in the upper right hand corner click the down arrow.
Click Settings
Setup Notification

Click Add new monitor

image

There are a ton of things you can do with Kuma. Check out the list!
We’re choosing DNS for this example
Here are some example settings. Don’t set your interval on this one for less than 60 seconds, or it may stop resolving for you.

Turn on the Node-RED Edit switch

Click Save on the webhook
and Save on the monitor page.

Next, you need to go to Node-RED

If you turn on the upside down mode, you can get the information you need to straighten out the flow for yourself. (This is for testing) Don’t forget to turn it off in this case. Upside down has other use cases, but here, use it to harvest your Node-Red Information.

Add a debug node right out of the uptime kuma node to get the output.

Don’t forget that you will always need the http (200) reply for this to work. For webhooks, the 200 node must be paired with http in.
After you complete the flow and customize it, you can monitor your Internet!

[{"id":"6fabca6b70567331","type":"http in","z":"b12af926a1d7a0d3","name":"uptime kuma","url":"/webhook/uptime-kuma","method":"post","upload":false,"swaggerDoc":"","x":1410,"y":2280,"wires":[["d8ff5fe2508a6859","9a1280ccf12f08b4"]]},{"id":"d8ff5fe2508a6859","type":"http response","z":"b12af926a1d7a0d3","name":"","statusCode":"200","headers":{},"x":1640,"y":2240,"wires":[]},{"id":"9a1280ccf12f08b4","type":"change","z":"b12af926a1d7a0d3","name":"MonitorID as topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.heartbeat.monitorID","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1670,"y":2280,"wires":[["b461396ecc9f0995"]]},{"id":"b461396ecc9f0995","type":"switch","z":"b12af926a1d7a0d3","name":"MonitorID","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"6","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1860,"y":2280,"wires":[["7efa8d72e0ac75c3"]]},{"id":"7efa8d72e0ac75c3","type":"switch","z":"b12af926a1d7a0d3","name":"Up/Down?","property":"payload.heartbeat.status","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":2030,"y":2280,"wires":[["c151a12a21f3c77b"],["16331fdb5f779c75"]]},{"id":"c151a12a21f3c77b","type":"change","z":"b12af926a1d7a0d3","name":"Down","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":2260,"wires":[[]]},{"id":"16331fdb5f779c75","type":"change","z":"b12af926a1d7a0d3","name":"Up","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":2300,"wires":[[]]}]

[EDIT]
Wanted to mention that you only need to set up this flow one time in Node-RED. If you want notifications on other devices/services set up in Uptime Kuma, you can just add it to the flow. Set it up as a separate tab in Node-RED. You can then link out to, perhaps, a pushover page that will notify you when you have … incidents.

If you go back to your setup notification screen, you have an option to set this as default and apply to all existing monitors.

1 Like

Thanks @april.brandt

One thing, the Node-Red Edit switch is not available. What have you done to enable that switch?

1 Like

I’m so sorry! I missed a step. I will add it in the original instructions.

1 Like

Here is the step to enable that.

in the upper right hand corner click the down arrow.
Click Settings
Setup Notification

Thanks. I was working on the webhook address, but somehow it’s disappeared from the post above. Something like 10.10.2.1/pods/something or other

1 Like

sorry about that. Power editing never works.
:eyes:

1 Like

Just got home and tried this.

I had to change the Post URL to /node-red-3/ from /node-red/, the sooner NR2 is deprecated the better.

Also in the flow what are the ‘MonitorID as topic’ change node and ‘MonitorID’ switch mode used for (my MonitorID = 3 so would never pass anything as it was looking for 6 in the imported flow), bypassing both of them and I get the Up and Down triggering a debug node so it is working without them,
Just adding observations for anyone else trying this and by setting ‘Heartbeat Interval Retries’ to 2 in Kuma settings works great for a 3 minute delay before (in my case) the modem is rebooted.
Thanks @april.brandt yet again

2 Likes

The node set up for Uptime Kuma will pull everything that you monitor. I would suggest using everything just to clean up the output to make it easier to understand and parse data. since you can connect everything that you want to monitor through Uptime Kuma in one flow, you need an identifier to do so. If you choose to monitor other things in your network, you would do it through this. Not a separate flow for each because ideally one webhook will do the job efficiently. The monitor id defines each instance:
eg: dns, website, vps, phone presence, whatever is on your network can use this single webhook. configured for Uptime Kuma

I assumed that you would come to that exact conclusion using debug when it didn’t work.
:wink:

I set it up this way because I use it to identify and split several monitors and parse the data into something usable with separate outputs depending on what I want to happen.

I discovered that the monitor id is more reliable and easier to use as each instance is unique. Short and sweet.

IMHO it’s a better idea to make it more granular early on so that you can easily add other things to it such as phone presence as an example. I didn’t think that I’d be using it for much and boy was I wrong. It keeps flaky wifi devices on line. Just look at the list of protocols and connections it talks to. It doesn’t need to send a message unless it changes. Keeps the traffic and logging to a minimum.

I’m looking for some help here as Icannot get this to work.
If a connect a debug node and click on ‘test’ I get a debug output. I’m assuming from the comments above that the payload.object.monitor field should contain something. i.e. a number that I put in the monitorID node.
I’m getting a null in this field.
Any thoughts or suggestions?

EDIT: I am getting an output on the dashboard showing as down. I have upside down mode enabled for testing as you have suggested.

can you post your flow please

what are you monitoring?

[{"id":"6fabca6b70567331","type":"http in","z":"b12af926a1d7a0d3","name":"uptime kuma","url":"/webhook/uptime-kuma","method":"post","upload":false,"swaggerDoc":"","x":1410,"y":2280,"wires":[["d8ff5fe2508a6859","9a1280ccf12f08b4"]]},{"id":"d8ff5fe2508a6859","type":"http response","z":"b12af926a1d7a0d3","name":"","statusCode":"200","headers":{},"x":1640,"y":2240,"wires":[]},{"id":"9a1280ccf12f08b4","type":"change","z":"b12af926a1d7a0d3","name":"MonitorID as topic","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.heartbeat.monitorID","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1670,"y":2280,"wires":[["b461396ecc9f0995"]]},{"id":"b461396ecc9f0995","type":"switch","z":"b12af926a1d7a0d3","name":"MonitorID","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"6","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1860,"y":2280,"wires":[["7efa8d72e0ac75c3"]]},{"id":"7efa8d72e0ac75c3","type":"switch","z":"b12af926a1d7a0d3","name":"Up/Down?","property":"payload.heartbeat.status","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":2030,"y":2280,"wires":[["c151a12a21f3c77b"],["16331fdb5f779c75"]]},{"id":"c151a12a21f3c77b","type":"change","z":"b12af926a1d7a0d3","name":"Down","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":2260,"wires":[[]]},{"id":"16331fdb5f779c75","type":"change","z":"b12af926a1d7a0d3","name":"Up","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":2300,"wires":[[]]}]

Pud a debug node on your uptime kuma node
You need that debug node so you know what your monitor id is. 6 is not correct. Don’t change the format of the debug. You just need msg.payload to get the data that you need.

Enter your number from the output into the monitor id node. deploy.

image

:wink:

1 Like

I am doing as you suggest above.
On the dashboard I can see this, which I think means it is working.

Unfortunately the debug node is giving me this when I hit the test button on the dashboard.
image

What are you trying to monitor?
Can you post some screens of your settings oage. And your node red setting in uptime kuma

Not sure what’s happening here but if I change upside down mode to ‘off’ I now get the desired O/P. (I think). :wink:
image

1 Like

Oh yah. It’ll only post if it changes. You have it working!
YAY!

1 Like

Now build from that

1 Like

Perfect. Done some testing using the upside down mode and I get Pushover messages for Internet being ‘UP’ and ‘DOWN’.
Perfecto!!!
Thanks again.

1 Like

You’re welcome! Glad you can use it.

1 Like

Yes I also had the same ‘problem’, nothing until you flip it to off all appears, as usual until you see what to do it is baffling, but then we have @april.brandt , priceless

2 Likes