haproxyctl

package
v0.0.0-...-6d4fcb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2016 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is a set of actions that we can send to a HAProxy server

const (
	ActionSetStateToReady     Action = "ready"
	ActionSetStateToDrain     Action = "drain"
	ActionSetStateToMaint     Action = "maint"
	ActionHealthDisableChecks Action = "dhlth"
	ActionHealthEnableChecks  Action = "ehlth"
	ActionHealthForceUp       Action = "hrunn"
	ActionHealthForceNoLB     Action = "hnolb"
	ActionHealthForceDown     Action = "hdown"
	ActionAgentDisablechecks  Action = "dagent"
	ActionAgentEnablechecks   Action = "eagent"
	ActionAgentForceUp        Action = "arunn"
	ActionAgentForceDown      Action = "adown"
	ActionKillSessions        Action = "shutdown"
)

type Duration

type Duration struct {
	time.Duration
}

Duration is a type that we can attach CSV marshalling to for getting time.Duration

func (*Duration) String

func (date *Duration) String() string

You could also use the standard Stringer interface

func (*Duration) UnmarshalCSV

func (date *Duration) UnmarshalCSV(csv string) (err error)

UnmarshalCSV converts the seconds timestamp into a golang time.Duration

type EntryType

type EntryType int

EntryType can be a Frontend, Backend, Server or Socket

const (
	// Frontend indicates this is a front-end
	Frontend EntryType = iota
	// Backend indicates this is a back-end
	Backend
	// Server indicates this is a server
	Server
	// Socket indicates this is a socket
	Socket
)

type HAProxyConfig

type HAProxyConfig struct {
	URL      url.URL
	Username string
	Password string
	// contains filtered or unexported fields
}

HAProxyConfig holds the basic configuration options for haproxyctl

func (*HAProxyConfig) GetRequestURI

func (c *HAProxyConfig) GetRequestURI(csv bool) string

GetRequestURI returns the URL to be used when sending a request

func (*HAProxyConfig) GetStats

func (c *HAProxyConfig) GetStats() (*Statistics, error)

GetStats gets the latest set of statistics from HAProxy

func (*HAProxyConfig) SendAction

func (c *HAProxyConfig) SendAction(servers []string, backend string, action Action) (done bool, allok bool, err error)

SendAction sends an action to HAProxy to perform on a list of servers. For example, putting servers into maintenance mode, or disabling health checks. The return parameters indicate whether the request was serviced, whether everything was OK, and any resulting errors. For example, a request may have been applied to some of the nodes requested, but not others. In which case "done" will be true, but "allok" will be false, and the error will contain a brief text.

func (*HAProxyConfig) SetCredentialsFromAuthString

func (c *HAProxyConfig) SetCredentialsFromAuthString(authstring string) error

SetCredentialsFromAuthString is used when you have credentails in an auth string, but don't want to send the separate username/passwords

type Statistic

type Statistic struct {
	BackendName             string    `csv:"# pxname"`
	FrontendName            string    `csv:"svname"`
	QueueCurrent            uint64    `csv:"qcur"`
	QueueMax                uint64    `csv:"qmax"`
	SessionsCurrent         uint64    `csv:"scur"`
	SessionsMax             uint64    `csv:"smax"`
	SessionLimit            uint64    `csv:"slim"`
	SessionsTotal           uint64    `csv:"stot"`
	BytesIn                 uint64    `csv:"bin"`
	BytesOut                uint64    `csv:"bout"`
	DeniedRequests          uint64    `csv:"dreq"`
	DeniedResponses         uint64    `csv:"dresp"`
	ErrorsRequests          uint64    `csv:"ereq"`
	ErrorsConnections       uint64    `csv:"econ"`
	ErrorsResponses         uint64    `csv:"eresp"`
	WarningsRetries         uint64    `csv:"wretr"`
	WarningsDispatches      uint64    `csv:"wredis"`
	Status                  string    `csv:"status"`
	Weight                  uint64    `csv:"weight"`
	IsActive                uint64    `csv:"act"`
	IsBackup                uint64    `csv:"bck"`
	CheckFailed             uint64    `csv:"chkfail"`
	CheckDowned             uint64    `csv:"chkdown"`
	StatusLastChanged       Duration  `csv:"lastchg"`
	Downtime                Duration  `csv:"downtime"`
	QueueLimit              uint64    `csv:"qlimit"`
	ProcessID               uint64    `csv:"pid"`
	ProxyID                 uint64    `csv:"iid"`
	ServiceID               uint64    `csv:"sid"`
	Throttle                uint64    `csv:"throttle"`
	LBTotal                 uint64    `csv:"lbtot"`
	Tracked                 uint64    `csv:"tracked"`
	Type                    EntryType `csv:"type"`
	Rate                    uint64    `csv:"rate"`
	RateLimit               uint64    `csv:"rate_lim"`
	RateMax                 uint64    `csv:"rate_max"`
	CheckStatus             string    `csv:"check_status"`
	CheckCode               string    `csv:"check_code"`
	CheckDuration           uint64    `csv:"check_duration"`
	HTTPResponse1xx         uint64    `csv:"hrsp_1xx"`
	HTTPResponse2xx         uint64    `csv:"hrsp_2xx"`
	HTTPResponse3xx         uint64    `csv:"hrsp_3xx"`
	HTTPResponse4xx         uint64    `csv:"hrsp_4xx"`
	HTTPResponse5xx         uint64    `csv:"hrsp_5xx"`
	HTTPResponseOther       uint64    `csv:"hrsp_other"`
	CheckFailedDets         uint64    `csv:"hanafail"`
	RequestRate             uint64    `csv:"req_rate"`
	RequestRateMax          uint64    `csv:"req_rate_max"`
	RequestTotal            uint64    `csv:"req_tot"`
	AbortedByClient         uint64    `csv:"cli_abrt"`
	AbortedByServer         uint64    `csv:"srv_abrt"`
	CompressedBytesIn       uint64    `csv:"comp_in"`
	CompressedBytesOut      uint64    `csv:"comp_out"`
	CompressedBytesBypassed uint64    `csv:"comp_byp"`
	CompressedResponses     uint64    `csv:"comp_rsp"`
	LastSession             Duration  `csv:"lastsess"`
	LastCheck               string    `csv:"last_chk"`
	LastAgentCheck          string    `csv:"last_agt"`
	AvgQueueTime            uint64    `csv:"qtime"`
	AvgConnectTime          uint64    `csv:"ctime"`
	AvgResponseTime         uint64    `csv:"rtime"`
	AvgTotalTime            uint64    `csv:"ttime"`
}

Statistic contains a set of HAProxy Statistics

type Statistics

type Statistics []Statistic

Statistics is a slice of HAProxy Statistics

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL