Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.12 KB

README.md

File metadata and controls

55 lines (37 loc) · 1.12 KB

Medex Build Status

Medical Examination - application for register health check callbacks and represent their state via HTTP.

Installation

  1. Add medex to your list of dependencies in mix.exs:

    def deps do
      [{:medex, github: "xerions/medex"}]
    end
  2. Ensure medex is started before your application:

    def application do
      [applications: [:medex]]
    end

Example

Register new check callback:

Medex.register "db", fn ->
    case :erlang.phash2(:erlang.now, 3) do
      0 -> :ok
      1 -> :warning
      2 -> :critical
    end
  end

and get state

$ curl -v http://localhost:4000/health/db

Consul

Medex suports pushing health check statutes to Consul. It is disabled by default but you can turn it on:

# use consul, false by default
config :medex, consul: true

# which service name will be using for consul health-checks (optional)
config :medex, service_id: "service_example"

And ensure start of consul application.