Checkup is a siteuptime like alternative that will monitor the response times of your website and a bunch of other things.

Setting up the project is a little tricky if you’re new to go, but if you read the Readme and google the error messages you get, you should be perfectly fine.

You can clone the most recent version from their github repository and run it with:

go run cmd/checkup/main.go --store

Using the checkup fs provider

Sadly the documentation is not super awesome yet, but I quickly diffed the changes I made to make the project use the local storage provider instead of relying on aws s3.

diff --git a/httpchecker.go b/httpchecker.go index bd075b7..3ab134e 100644 --- a/httpchecker.go +++ b/httpchecker.go @@ -174,7 +174,7 @@ var DefaultHTTPClient = &http.Client{ ResponseHeaderTimeout: 5 * time.Second, }, CheckRedirect: func(req *http.Request, via []*http.Request) error { - return http.ErrUseLastResponse + return fmt.Errorf("error!") }, Timeout: 10 * time.Second, }

This change just unbroke my go build .

diff --git a/statuspage/index.html b/statuspage/index.html index a8979b4..2e25ecd 100644 --- a/statuspage/index.html +++ b/statuspage/index.html @@ -5,7 +5,7 @@ <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="js/d3.v3.min.js" charset="utf-8"></script> - <script src="js/s3.js"></script> + <script src="js/fs.js"></script> <script src="js/checkup.js"></script> <script src="js/config.js"></script> <script src="js/statuspage.js"></script>

This modifies the status page to make request to the json files that contain the actual data.

diff --git a/statuspage/js/config.js b/statuspage/js/config.js index 6d042c5..4e6ed58 100644 --- a/statuspage/js/config.js +++ b/statuspage/js/config.js @@ -1 +1,22 @@ -checkup.config = {}; // You MUST fill this out! Use config_template.js as a starting point. \ No newline at end of file +checkup.config = { + // How much history to show on the status page. Long durations and + // frequent checks make for slow loading, so be conservative. + "timeframe": 1 * time.Day, + + // How often, in seconds, to pull new checks and update the page. + "refresh_interval": 60, + + // Configure read-only access to stored checks. Currently, S3 is + // supported. These credentials will be visible to everyone, so + // use keys with ONLY read access! + "storage": { + "url": "http://127.0.0.1:2015/data" + }, + + // The text to display along the top bar depending on overall status. + "status_text": { + "healthy": "Situation Normal", + "degraded": "Degraded Service", + "down": "Service Disruption" + } +};

The last section is just the config for the status page.

Lastly I present my example (local development, don’t use for production without looking at it in a sober state of mind) checkup.json file:

{ "checkers": [ { "type": "http", "endpoint_name": "JonathanMH", "endpoint_url": "http://jonathanmh.com", "attempts": 5 }, { "type": "http", "endpoint_name": "Vollzeitblogger", "endpoint_url": "http://vollzeitblogger.de", "attempts": 5 }, { "type": "http", "endpoint_name": "GegenWind", "endpoint_url": "http://gegenwind.dk", "attempts": 5 } ], "storage": { "provider": "fs", "dir": "statuspage/data", "url": "http://127.0.0.1:2015/data" } }

So this project appears pretty cool so far as a monitoring tool. I’ll play with it some more and hook it up to Nagios when I get the chance!

The source is pretty well documented, so check it out if you’re looking for a cool go project to read!