
Show HN: Gatus – Automated Service Health Dashboard Written in Go - TwinProduction
https://github.com/TwinProduction/gatus
======
TwinProduction
Gatus is a project that I started because I wanted to have an automated
service health dashboard, and I wanted it to be as low maintenance as
possible.

Originally, determining whether a service was healthy or not was going to be
very simple: is the status 5xx? If yes, the service is unhealthy, otherwise,
it's healthy.

After implementing that, however, I felt that it was bit too lacking. Sure, it
could've helped roughly determining the availability of a service, but it
wasn't able to make the difference between "everything is ok" and "everything
is not ok".

For instance, let's say you want to test an endpoint that should return a list
of recipes, and for whatever reason, the endpoint starts returning an empty
list of recipes. The endpoint would still return a 200, but there's no
content, so is it really accurate to call the service "healthy"?

That's why I implemented a way to supply conditions that Gatus will evaluate
in order to determine whether a service is healthy or not. These conditions
range from status code to body comparison with the help of a JSONPath-like
syntax. I also extended that by adding the ability to resolve the length of
the value of said JSON path, which allows even greater flexibility for when
you don't know exactly what the data is (or the data is bound to change), but
you know that this data should exist, or a certain number of elements should
be returned.

For the example I mentioned earlier, the solution would simply be to add the
following condition to the service configuration: `len([BODY].recipes) > 0`.
This condition would make sure that the response body has the field `recipes`
and it has a length of at least 1.

I wrote a short article on my website, if you want a bit more context:
[https://twinnation.org/articles/46/gatus-automated-health-
da...](https://twinnation.org/articles/46/gatus-automated-health-dashboard-
with-alerting)

Any feedback is greatly appreciated :)

