consul

package
v0.0.0-...-b274fa0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PortNames = struct {
	HTTP    string
	DNS     string
	SerfLAN string
	SerfWAN string
	Server  string
}{
	"http",
	"dns",
	"serf-lan",
	"serf-wan",
	"server",
}
View Source
var ServerScrapeConfig = prometheus.ScrapeConfig{
	JobName:     "consul",
	Params:      url.Values{"format": []string{"prometheus"}},
	MetricsPath: "/v1/agent/metrics",
	RelabelConfigs: []prometheus.RelabelConfig{
		{
			Action:       prometheus.Replace,
			SourceLabels: model.LabelNames{model.MetricNameLabel},
			Regex:        "consul_raft_replication_(appendEntries_rpc|appendEntries_logs|heartbeat|installSnapshot)_((\\w){36})((_sum)|(_count))?",
			TargetLabel:  model.MetricNameLabel,
			Replacement:  "consul_raft_replication_${1}${4}",
		},
		{
			Action:       prometheus.Replace,
			SourceLabels: model.LabelNames{model.MetricNameLabel},
			Regex:        "consul_raft_replication_(appendEntries_rpc|appendEntries_logs|heartbeat|installSnapshot)_((\\w){36})((_sum)|(_count))?",
			TargetLabel:  "raft_id",
			Replacement:  "${2}",
		},
	},
}
View Source
var ServiceScrapeConfig = prometheus.ScrapeConfig{
	JobName: "consul-services",
	ConsulServiceDiscoveryConfigs: []prometheus.ConsulServiceDiscoveryConfig{
		{
			Server: "127.0.0.1:8500",
		},
	},
	RelabelConfigs: []prometheus.RelabelConfig{
		{
			Action:       prometheus.Keep,
			SourceLabels: model.LabelNames{model.MetaLabelPrefix + "consul_tags"},
			Regex:        ".*,prom,.*",
		},
		{
			Action:       prometheus.Replace,
			SourceLabels: model.LabelNames{model.MetaLabelPrefix + "consul_service"},
			TargetLabel:  model.JobLabel,
		},
	},
}

Functions

func HarnessToAPI

func HarnessToAPI(r runner.Harness) (*consulapi.Client, error)

func HarnessToConfig

func HarnessToConfig(r runner.Harness) (*consulapi.Config, error)

func LeadersHealthy

func LeadersHealthy(ctx context.Context, servers []runner.Harness, expectedPeers []string) error

Types

type ConsulConfig

type ConsulConfig struct {
	Common runner.Config
	Server bool
	// JoinAddrs specifies the addresses of the Consul servers.  If they have
	// a :port suffix, it should be that of the SerfLAN port.
	JoinAddrs []string
}

ConsulConfig describes how to run a single Consul agent.

func NewConfig

func NewConfig(server bool, joinAddrs []string, tls *pki.TLSConfigPEM) ConsulConfig

func (ConsulConfig) Args

func (cc ConsulConfig) Args() []string

func (ConsulConfig) Config

func (cc ConsulConfig) Config() runner.Config

func (ConsulConfig) Env

func (cc ConsulConfig) Env() []string

func (ConsulConfig) Files

func (cc ConsulConfig) Files() map[string]string

func (ConsulConfig) Name

func (cc ConsulConfig) Name() string

func (ConsulConfig) WithConfig

func (cc ConsulConfig) WithConfig(cfg runner.Config) runner.Command

type Ports

type Ports struct {
	HTTP    int
	DNS     int
	SerfLAN int
	SerfWAN int
	Server  int
}

func DefPorts

func DefPorts() Ports

func (Ports) RunnerPorts

func (c Ports) RunnerPorts() yurt.Ports

Jump to

Keyboard shortcuts

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