Lightweight uptime monitor for web services, with support for sending alerts through Slack and email (using Mailgun)
On both Docker and your local machine, you need to first make a checks.yml
(see section below) to define the uptime checks you want to run, along with settings and reporters.
The simplest way to run bantay
is with Docker.
$ make package
$ docker run -v "$(pwd)/checks.yml":/opt/bantay/bin/checks.yml fipanganiban/bantay:local bantay check
This project requires Go to be installed. On OS X with Homebrew you can just run brew install go
.
Then, running it then should be as simple as:
$ go get .
$ make build
$ ./bin/bantay check
to run the checks once, or
$ ./bin/bantay server
to run checks over and over, on the interval specified in checks.yml
as poll_interval
.
---
server:
poll_interval: 10
checks:
- name: Google
url: https://www.google.com/
valid_status: 200
- name: Hacker News
url: https://news.ycombinator.com/
valid_status: 200
body_match: Hacker News
reporters:
- type: log
- type: slack
options:
slack_channel: YOUR-SLACK-CHANNEL-HERE
slack_token: YOUR-SLACK-TOKEN-HERE
- type: mailgun
options:
mailgun_domain: YOUR-MAILGUN-DOMAIN
mailgun_private_key: YOUR-MAILGUN-PRIVATE-API-KEY
mailgun_sender: bantay@yourdomain.io
mailgun_recipients: [webmaster@yourdomain.io]
mailgun_exclude:
- Hacker News
Settings used when running bantay in server mode, ie ./bantay server
poll_interval
: How long to wait for each check of all microservices (in seconds)
List of items that bantay will run, with their check settings.
name
: Unique identifier for each check (case sensitive), used for reporting and alertsurl
: Absolute URL that bantay will poll each time a check is runvalid_status
: HTTP status code to expect from the HTTP responsebody_match
(optional): String to search for in the HTTP response
List of reporters that bantay will use to report check results, each with their own set of options.
type
: Type of reporter to use. Currently supported:log
(stdout/stderr),slack
,mailgun
options
: Options specific for each reporter type (more below)
slack
- Sends went down/went up uptime alerts to Slackslack_channel
: ID of the Slack channel to send reports toslack_token
: Slack token of the bot/user to use
mailgun
- Sends went down/went up uptime alerts via email using Mailgunmailgun_domain
: Your Mailgun registered domainmailgun_private_key
: Private API key to access the Mailgun V3 APImailgun_sender
: Email address to show as sender of alertsmailgun_recipients
: List of email addresses to send emails tomailgun_exclude
: List of unique checkname
s to exclude from sending email alerts
influxdb
- Sends time-series metrics (up status and request latency) to InfluxDBinfluxdb_host
: Host URL of the InfluxDB 2.0 HTTP serverinfluxdb_token
: Token for authenticating with the InfluxDB serverinfluxdb_org
: InfluxDB org stringinfluxdb_bucket
: InfluxDB bucket to send metrics to