Chef Blogs

Tracking Application Health with Splunk

Chris Nunciato | Posted on | Chef Habitat

One of the many useful features of Habitat is its built-in support for health checks. Every application defines what it means to be healthy in its own way, but common to most of them (or more accurately, to those of us who maintain them) is the need to know how they’re performing over time, and the health-check hook is a great way to do that.

There are generally a few steps involved in setting up application health monitoring. If you were interested in tracking the health of a web application, for example, you might begin by giving it an API endpoint to respond with some indication of uptime, connectivity to other services, or the like. Such an API might look something like this:

$ curl -v http://your-service.com/health
> GET / HTTP/1.1
...
< HTTP/1.1 200 OK
< Content-Type: application/json
...
{
  "status": 200,
  "message": "♬ Everything is awesome. ♬"
}