processone / go-haproxy

Go library for interacting with HAProxy via command socket

Home Page:https://godoc.org/github.com/bcicen/go-haproxy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoDoc codebeat badge

go-haproxy

Go library for interacting with HAProxys stats socket.

Usage

Initialize a client object. Supported address schemas are tcp:// and unix:///

client := &haproxy.HAProxyClient{
  Addr: "tcp://localhost:9999",
}

Fetch results for a built in command(currently supports show stats and show info):

stats, err := client.Stats()
for _, i := range stats {
	fmt.Printf("%s: %s\n", i.SvName, i.Status)
}

Or retrieve the result body from an arbitrary command string:

result, err := h.RunCommand("show info")
fmt.Println(result.String())

About

Go library for interacting with HAProxy via command socket

https://godoc.org/github.com/bcicen/go-haproxy

License:MIT License


Languages

Language:Go 100.0%