API to check if a node is online

I’m working on an automation to monitor is a node is online or not. I’m currently looking for an API which would give online status. The closest thing I found is LastSeen in machine API. Unfortunately, this is not updated in regularly.

What are you doing the automation from? - can you run a tailscale shell command to get it to check the status for itself?

I’m running N8N workflows to alert me whenever a node goes down. Unfortunately, running shell command is not possible.

Funny, I’ve been working on n8n recently as well. You can execute a system command if you’re self-hosted (and if you’re running Tailscale, I assume you are). I would assume that would still be a problem if you were using the docker image, as the TS install would be isolated on the host I think.

Even on a docker container, you should be able to ping (system ping, not tailscale) the host:
ping -c 1 100.100.100.101 (obviously use the right address)

As another option though - a monitoring system may work better for this I think and give you more comprehensive info. Have a look at LibreNMS - I use that for system monitoring and it can send alert by quite a number of channels.

I’m currently running N8N on my own server via Docker. While pinging the host is a good way to check for online status, there’s a potential issue if the Tailscale client goes down for an unknown reason, even if the host is up. I recently experienced this after upgrading my OS, which is why I’m searching for a way to monitor node status via the Tailscale API.

I haven’t heard of LibreNMS before, but it seems intriguing. I’ll check it out later today.

Looks like there is a FR on Github for same thing FR: Devices API "Online" bool · Issue #7004 · tailscale/tailscale · GitHub