Skip to content

HTTP health checker implemented in Rust

Notifications You must be signed in to change notification settings

greyblake/hellcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hellcheck

HTTP health checker.

Installation

Install with cargo

Install system dependencies.

On Debian/Ubuntu:

apt-get install libssl-dev pkg-config

Install hellcheck crate:

cargo install hellcheck

Configuration

Basic configuration example

Configuration file hellcheck.yml may have the following format:

# Declare what has to be watched
checkers:
  example:
    url: https://www.example.com
    notifiers: [my_team]
  localhost8000:
    url: http://localhost:8000
    interval: 1500ms
    notifiers: [my_team, sound_alarm]
    basic_auth:
      username: "foo"
      password: "bar"

# Declare notification channels
notifiers:
  my_team:
    type: slack
    token: <WEBHOOK_URL>
  sound_alarm:
    type: command
    command: ["./custom.sh", "arg1", "arg2"]

Notifiers

Slack notifier

Create an incoming webhook in Slack. Then define your notifier with type slack and webhook_url:

notifiers:
  notifier_name:
    type: slack
    webhook_url: <WEBHOOK_URL>

Telegram notifier

For telegram notifier you have to create a bot with BotFather and obtain the bot token.

Chat ID can be found out with GetidsBot.

notifiers:
  notifier_name:
    type: telegram
    token: <BOT-TOKEN>
    chat_id: <CHAT-ID>

HipChat notifier

notifiers:
  notifier_name:
    type: hipchat
    base_url: https://hipchat.com
    token: <AUTH_TOKEN>
    room_id: <ROOM_NAME_OR_ID>

Command notifier

Command notifier allows you to invoke any shell command or custom script as notifier.

Example:

notifiers:
  custom:
    type: command
    command: ["/path/to/custom-notifier.sh", "arg1", "arg2"]

Within the script the following environment variables are accessible:

  • HELLCHECK_ID - checker id
  • HELLCHECK_URL - checker URL
  • HELLCHECK_OK
    • true - when service is up
    • false - when service is down

Start

Assuming, you have ./hellcheck.yml in your current directory, this will start monitoring of the services, described in checkers configuration sections:

hellcheck watch --file ./hellcheck.yml

Roadmap

  • Support notifiers
    • Command customer notifier
    • Telegram
    • HipChat
    • Slack
  • Checkers
    • Custom intervals
    • Verify body (presence of some given text)
    • Custom OKish HTTP status
  • Use structopt/clap for nice command line interface
  • Implement hellcheck test command to test notifiers
  • Configure CI
    • Run build/tests
    • Setup clippy lint
    • Setup rusmft
  • Ensure endpoints with http basic authentication can be health checked
  • Inject credentials with env variables into yaml file
  • Allow customizable messages for notifiers
  • Allow custom scripts as checkers
  • Make pretty colorized output for console
  • Validate for unexpected panics in the code (unwrap, panic, expect, etc..)
  • Add logging

License

MIT © Sergey Potapov

Contributors

  • greyblake Potapov Sergey - creator, maintainer.