2022-01-25 10:46:25 +01:00
|
|
|
defmodule HAHandler.Web.Controller do
|
2022-01-24 16:53:04 +01:00
|
|
|
import Plug.Conn
|
|
|
|
|
|
|
|
alias HAHandler.HAProxy
|
|
|
|
|
2022-01-25 10:46:25 +01:00
|
|
|
def index(conn) do
|
2022-01-24 16:53:04 +01:00
|
|
|
{: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
|