haproxy

package
v0.0.0-...-5655933 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 20 Imported by: 0

README

HAProxy

forked from haproxy_exporter

Note: since HAProxy 2.0.0, the official source includes a Prometheus exporter module that can be built into your binary with a single flag during build time and offers an exporter-free Prometheus endpoint.

haproxy configurations for /stats:

frontend stats
    bind *:8404
    stats enable
    stats uri /stats
    stats refresh 10s

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	URI string
	// contains filtered or unexported fields
}

Exporter collects HAProxy stats from the given URI and exports them using the prometheus metrics package.

func NewExporter

func NewExporter(uri string, sslVerify, proxyFromEnv bool, selectedServerMetrics map[int]metricInfo, excludedServerStates string, timeout time.Duration) (*Exporter, error)

NewExporter returns an initialized Exporter.

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect fetches the stats from configured HAProxy location and delivers them as Prometheus metrics. It implements prometheus.Collector.

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe describes all the metrics ever exported by the HAProxy exporter. It implements prometheus.Collector.

type HAProxy

type HAProxy struct {
	config.PluginConfig
	Instances []*Instance `toml:"instances"`
}

func (*HAProxy) Clone

func (r *HAProxy) Clone() inputs.Input

func (*HAProxy) GetInstances

func (r *HAProxy) GetInstances() []inputs.Instance

func (*HAProxy) Name

func (r *HAProxy) Name() string

type Instance

type Instance struct {
	config.InstanceConfig

	// URI on which to scrape HAProxy.
	URI string `toml:"uri"`

	// Flag that enables SSL certificate verification for the scrape URI
	SSLVerify bool `toml:"ssl_verify"`

	// Comma-separated list of exported server metrics. See http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.1
	ServerMetricFields string `toml:"server_metric_fields"`

	// Comma-separated list of exported server states to exclude. See https://cbonte.github.io/haproxy-dconv/1.8/management.html#9.1, field 17 status
	ServerExcludeStates string `toml:"server_exclude_states"`

	// Timeout for trying to get stats from HAProxy.
	Timeout config.Duration `toml:"timeout"`

	// Flag that enables using HTTP proxy settings from environment variables ($http_proxy, $https_proxy, $no_proxy)
	HTTPProxyFromEnv bool `toml:"proxy_from_env"`
	// contains filtered or unexported fields
}

func (*Instance) Gather

func (ins *Instance) Gather(slist *types.SampleList)

func (*Instance) Init

func (ins *Instance) Init() error

Jump to

Keyboard shortcuts

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