An Easy Way to Monitor a Website's Health

An Easy Way to Monitor a Website's Health


3 min read

This article is part of the series on making a wiki, but in fact, it can be applied to any website or service.

The problem

Recently the docker daemon running the wiki I host got into a bad state. My wiki ended up returning an HTTP error 403 for 3 days until I get poked by users.


To avoid such a situation in the future, I decided to look for an automated health check.

The solution

I found an easy and quick solution using the website

They even have a free tier for hobbyists with up to 20 jobs.

I created an account and a job there. Got my ping URL!

After I wrote a script that I ended up running on the server hosting my wiki:


status=$(curl -o /dev/null -Isw '%{http_code}\n'

if [ "$status" -eq "200" ]; then
    curl -fsS -m 10 --retry 5 -o /dev/null
    echo "Wiki up"
    curl --retry 3$status
    echo "Wiki down: $status"

In short, I retrieve first the HTTP return status of the homepage. If it is 200, then all is good. Else I ping my job with the failing return status.

Then this script is executed daily with a cron defined like that:

0 0 * * * /wiki/

From now on, if my website is down, I will receive an automated email from notifying me about the situation!


Note that in the case my server is fully down, which means both my wiki and my health check are not going to be able to run, the website will automatically throw me a notification email too after a day and 1 hour. Because they expect a regular daily ping. The period and grace time before considering a job is failing are configurable.


Photo by Hush Naidoo on Unsplash

Did you find this article valuable?

Support Sonny Alves Dias by becoming a sponsor. Any amount is appreciated!