23 lines
356 B
Elixir
23 lines
356 B
Elixir
defmodule HAHandler.Web do
|
|
import Plug.Conn
|
|
|
|
alias HAHandler.HAProxy
|
|
|
|
def init(opts) do
|
|
opts
|
|
end
|
|
|
|
def call(conn, _opts) do
|
|
{:ok, hostname} = :inet.gethostname()
|
|
|
|
stats = HAProxy.get_stats()
|
|
reply = "OK #{hostname}"
|
|
<> "\nPROXY: "
|
|
<> inspect(stats)
|
|
|
|
conn
|
|
|> put_resp_content_type("text/plain")
|
|
|> send_resp(200, reply)
|
|
end
|
|
end
|