Documentation ¶
Index ¶
- Variables
- func AggregatedStatus(checks []Check) string
- func GetToken(token *promauth.Secret) (string, error)
- func ShouldCollectServiceByName(filterServices []string, serviceName string) bool
- type Agent
- type AgentConfig
- type AgentMember
- type Check
- type Node
- type SDConfig
- type Service
- type ServiceNode
- type ServiceTaggedAddress
Constants ¶
This section is empty.
Variables ¶
var SDCheckInterval = flag.Duration("promscrape.consulSDCheckInterval", 30*time.Second, "Interval for checking for changes in Consul. "+
"This works only if consul_sd_configs is configured in '-promscrape.config' file. "+
"See https://docs.victoriametrics.com/sd_configs/#consul_sd_configs for details")
SDCheckInterval is check interval for Consul service discovery.
Functions ¶
func AggregatedStatus ¶ added in v1.91.0
AggregatedStatus returns aggregated status of service node checks.
func ShouldCollectServiceByName ¶ added in v1.91.0
ShouldCollectServiceByName returns true if the given serviceName must be collected (present in filterServices).
Types ¶
type Agent ¶
type Agent struct { Config AgentConfig Member AgentMember Meta map[string]string }
Agent is Consul agent.
See https://www.consul.io/api/agent.html#read-configuration
func GetAgentInfo ¶ added in v1.91.0
func GetAgentInfo(client *discoveryutils.Client) (*Agent, error)
GetAgentInfo returns information about current consul agent.
func ParseAgent ¶ added in v1.91.0
ParseAgent parses Consul agent information from data.
type AgentConfig ¶
AgentConfig is Consul agent config.
type AgentMember ¶ added in v1.91.0
type AgentMember struct {
Addr string
}
AgentMember is Consul agent member info.
type Check ¶
Check is Consul check.
See https://www.consul.io/api/health.html#list-nodes-for-service
type Node ¶
type Node struct { Address string Datacenter string Node string Meta map[string]string TaggedAddresses map[string]string }
Node is Consul node.
See https://www.consul.io/api/health.html#list-nodes-for-service
type SDConfig ¶
type SDConfig struct { Server string `yaml:"server,omitempty"` Token *promauth.Secret `yaml:"token"` Datacenter string `yaml:"datacenter"` // Namespace only supported at enterprise consul. // https://www.consul.io/docs/enterprise/namespaces Namespace string `yaml:"namespace,omitempty"` // Partition only supported at enterprise consul. // https://developer.hashicorp.com/consul/docs/enterprise/admin-partitions Partition string `yaml:"partition,omitempty"` Scheme string `yaml:"scheme,omitempty"` Username string `yaml:"username"` Password *promauth.Secret `yaml:"password"` HTTPClientConfig promauth.HTTPClientConfig `yaml:",inline"` ProxyURL *proxy.URL `yaml:"proxy_url,omitempty"` ProxyClientConfig promauth.ProxyClientConfig `yaml:",inline"` Services []string `yaml:"services,omitempty"` Tags []string `yaml:"tags,omitempty"` NodeMeta map[string]string `yaml:"node_meta,omitempty"` TagSeparator *string `yaml:"tag_separator,omitempty"` AllowStale *bool `yaml:"allow_stale,omitempty"` // See https://developer.hashicorp.com/consul/api-docs/features/filtering // list of supported filters https://developer.hashicorp.com/consul/api-docs/catalog#filtering-1 Filter string `yaml:"filter,omitempty"` }
SDConfig represents service discovery config for Consul.
See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#consul_sd_config
type Service ¶
type Service struct { ID string Service string Address string Namespace string Partition string Port int Tags []string Meta map[string]string TaggedAddresses map[string]ServiceTaggedAddress Datacenter string }
Service is Consul service.
See https://www.consul.io/api/health.html#list-nodes-for-service
type ServiceNode ¶
ServiceNode is Consul service node.
See https://www.consul.io/api/health.html#list-nodes-for-service
func ParseServiceNodes ¶ added in v1.91.0
func ParseServiceNodes(data []byte) ([]ServiceNode, error)
ParseServiceNodes return parsed slice of ServiceNode by data.
type ServiceTaggedAddress ¶ added in v1.91.0
ServiceTaggedAddress is Consul service.
See https://www.consul.io/api/health.html#list-nodes-for-service