Menu

A /api/health Endpoint: The Cheapest Uptime Monitoring There Is
πŸ“°

A /api/health Endpoint: The Cheapest Uptime Monitoring There Is

DEV Community: phpΒ·Mobeen AhmedΒ·6 days ago
#4VH2ldk4
#devto#dev#health#file#endpoint
Reading 0:00
15s threshold

I do not pay for uptime monitoring. I have a tiny file called health.php sitting in the api/ folder of ramrom.io, and it tells me more about the health of the site than a dashboard full of charts ever did. It is about twenty lines of PHP, it costs nothing to run, and it has caught problems before my visitors did.

The idea is simple. A health endpoint is a URL whose only job is to answer one question: is this site actually working right now? Not "is the server up", not "did the homepage return a 200", but "can the site do the thing it exists to do?" For a downloader, that means: can PHP run, can the config file be read, and is there a network route out to the providers? If any of those fail, the site is down in every way that matters, even if the homepage loads beautifully.

Here is roughly what mine does. It starts by setting the content type to JSON.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.