Poll octoprint server to determine if alive

Hi. Today when i was printing, i noticed my printer had stopped moving, and filament was piling up in the same spot.

I have my printer sitting on a philips hue smart plug, so that i can turn it off automatically after prints, or if somethings goes wrong. but it turned out the raspberry was not responding at all, couldn't even ssh into it.

this got me thinking, as i have another server at home, that if i can poll octoprint somehow at regular intervals from my other server, it can then shut the smart plug off if the raspberry somehow stops responding.

all that happened this time was a nasty clog, but i guess there are worse scenarios.

Any ideas on how to do something like this?

You can poll http://<your-octoprint>/online.txt to see if it is online/responding - a very lightweight request that should indicate that the server is connectable. Not necessarily that it is working fully, but it's most of the way there.

That's actually a really good suggestion. :slight_smile: thank you.

I did not know that one. Is it a feature of OctoPrint in general, or is it available with OctoPi only?

OctoPrint itself - there's also /online.gif, and /cached.gif which will show if the preemptive cache is done.

1 Like