consul

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: 11 Imported by: 0

README

Consul Input Plugin

This plugin will collect statistics about all health checks registered in the Consul. It uses Consul API to query the data. It will not report the telemetry but Consul can report those stats already using StatsD protocol if needed.

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the README.md for more details.

Configuration

# Gather health check statuses from services registered in Consul
[[instances]]
  ## Consul server address
  # address = "localhost:8500"

  ## URI scheme for the Consul server, one of "http", "https"
  # scheme = "http"

  ## ACL token used in every request
  # token = ""

  ## HTTP Basic Authentication username and password.
  # username = ""
  # password = ""

  ## Data center to query the health checks from
  # datacenter = ""

  ## Optional TLS Config
  # tls_ca = "/etc/categraf/ca.pem"
  # tls_cert = "/etc/categraf/cert.pem"
  # tls_key = "/etc/categraf/key.pem"
  ## Use TLS but skip chain & host verification
  # insecure_skip_verify = true

Metrics

name help
consul_up Was the last query of Consul successful.
consul_scrape_use_seconds scrape use seconds.
consul_raft_peers How many peers (servers) are in the Raft cluster.
consul_raft_leader Does Raft cluster have a leader (according to this node).
consul_serf_lan_members How many members are in the cluster.
consul_serf_lan_member_status Status of member in the cluster. 1=Alive, 2=Leaving, 3=Left, 4=Failed.
consul_serf_wan_member_status Status of member in the wan cluster. 1=Alive, 2=Leaving, 3=Left, 4=Failed.
consul_catalog_services How many services are in the cluster.
consul_service_tag Tags of a service.
consul_health_node_status Status of health checks associated with a node.
consul_health_service_status Status of health checks associated with a service.
consul_service_checks Link the service id and check name if available.
consul_catalog_kv The values for selected keys in Consul's key/value catalog. Keys with non-numeric values are omitted.
And some metrics with uncertain names, See the Agent Metrics for more details

Example Output

consul_up address=localhost:8500 agent_hostname=hostname 1

consul_scrape_use_seconds address=localhost:8500 agent_hostname=hostname 0.015674053

consul_raft_peers address=localhost:8500 agent_hostname=hostname 1

consul_raft_leader address=localhost:8500 agent_hostname=hostname 1

consul_serf_lan_members address=localhost:8500 agent_hostname=hostname 1

consul_serf_lan_member_status address=localhost:8500 agent_hostname=hostname member=localhost.localdomain 1

consul_serf_wan_member_status address=localhost:8500 agent_hostname=hostname dc=dc1 member=localhost.localdomain.dc1 1

consul_catalog_services address=localhost:8500 agent_hostname=hostname 1

consul_health_node_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain status=passing 1
consul_health_node_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain status=warning 0
consul_health_node_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain status=critical 0
consul_health_node_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain status=maintenance 0

consul_health_service_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo status=passing 1
consul_health_service_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo status=warning 0
consul_health_service_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo status=critical 0
consul_health_service_status address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo status=maintenance 0

consul_service_checks address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo status=critical 1

consul_service_tag address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo tag=tag1 1
consul_service_tag address=localhost:8500 agent_hostname=hostname check_id=service:demo check_name=Service 'demo' check node=localhost.localdomain service_id=demo service_name=demo tag=tag2 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consul

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

func (*Consul) Clone

func (c *Consul) Clone() inputs.Input

func (*Consul) GetInstances

func (c *Consul) GetInstances() []inputs.Instance

func (*Consul) Name

func (c *Consul) Name() string

type Instance

type Instance struct {
	Address           string `toml:"address"`
	Scheme            string `toml:"scheme"`
	Token             string `toml:"token"`
	Username          string `toml:"username"`
	Password          string `toml:"password"`
	Datacenter        string `toml:"datacenter"`
	AllowStale        *bool  `toml:"allow_stale"`
	RequireConsistent *bool  `toml:"require_consistent"`
	KVPrefix          string `toml:"kv_prefix"`
	KVFilter          string `toml:"kv_filter"`
	tls.ClientConfig

	config.InstanceConfig
	// contains filtered or unexported fields
}

func (*Instance) DefaultTags

func (ins *Instance) DefaultTags() map[string]string

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