Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTargetAddress(address model.LabelValue) error
- type AzureSDConfig
- type BasicAuth
- type ClientCert
- type Config
- type ConsulSDConfig
- type DNSSDConfig
- type EC2SDConfig
- type FileSDConfig
- type GlobalConfig
- type KubernetesRole
- type KubernetesSDConfig
- type MarathonSDConfig
- type NerveSDConfig
- type Regexp
- type RelabelAction
- type RelabelConfig
- type ScrapeConfig
- type ServersetSDConfig
- type TLSConfig
- type TargetGroup
- type URL
Constants ¶
const ( KubernetesRoleNode = "node" KubernetesRolePod = "pod" KubernetesRoleContainer = "container" KubernetesRoleService = "service" KubernetesRoleEndpoint = "endpoint" KubernetesRoleAPIServer = "apiserver" )
Variables ¶
var ( // DefaultConfig is the default top-level configuration. DefaultConfig = Config{ GlobalConfig: DefaultGlobalConfig, } // DefaultGlobalConfig is the default global configuration. DefaultGlobalConfig = GlobalConfig{ ScrapeInterval: model.Duration(1 * time.Minute), ScrapeTimeout: model.Duration(10 * time.Second), EvaluationInterval: model.Duration(1 * time.Minute), } // DefaultScrapeConfig is the default scrape configuration. DefaultScrapeConfig = ScrapeConfig{ MetricsPath: "/metrics", Scheme: "http", HonorLabels: false, } // DefaultRelabelConfig is the default Relabel configuration. DefaultRelabelConfig = RelabelConfig{ Action: RelabelReplace, Separator: ";", Regex: MustNewRegexp("(.*)"), Replacement: "$1", } // DefaultDNSSDConfig is the default DNS SD configuration. DefaultDNSSDConfig = DNSSDConfig{ RefreshInterval: model.Duration(30 * time.Second), Type: "SRV", } // DefaultFileSDConfig is the default file SD configuration. DefaultFileSDConfig = FileSDConfig{ RefreshInterval: model.Duration(5 * time.Minute), } // DefaultConsulSDConfig is the default Consul SD configuration. DefaultConsulSDConfig = ConsulSDConfig{ TagSeparator: ",", Scheme: "http", } // DefaultServersetSDConfig is the default Serverset SD configuration. DefaultServersetSDConfig = ServersetSDConfig{ Timeout: model.Duration(10 * time.Second), } // DefaultNerveSDConfig is the default Nerve SD configuration. DefaultNerveSDConfig = NerveSDConfig{ Timeout: model.Duration(10 * time.Second), } // DefaultMarathonSDConfig is the default Marathon SD configuration. DefaultMarathonSDConfig = MarathonSDConfig{ RefreshInterval: model.Duration(30 * time.Second), } // DefaultKubernetesSDConfig is the default Kubernetes SD configuration DefaultKubernetesSDConfig = KubernetesSDConfig{ RequestTimeout: model.Duration(10 * time.Second), RetryInterval: model.Duration(1 * time.Second), } // DefaultEC2SDConfig is the default EC2 SD configuration. DefaultEC2SDConfig = EC2SDConfig{ Port: 80, RefreshInterval: model.Duration(60 * time.Second), } // DefaultAzureSDConfig is the default Azure SD configuration. DefaultAzureSDConfig = AzureSDConfig{ Port: 80, RefreshInterval: model.Duration(5 * time.Minute), } )
The defaults applied before parsing the respective config sections.
Functions ¶
func CheckTargetAddress ¶
func CheckTargetAddress(address model.LabelValue) error
CheckTargetAddress checks if target address is valid.
Types ¶
type AzureSDConfig ¶ added in v1.0.0
type AzureSDConfig struct { Port int `yaml:"port"` SubscriptionID string `yaml:"subscription_id"` TenantID string `yaml:"tenant_id,omitempty"` ClientID string `yaml:"client_id,omitempty"` ClientSecret string `yaml:"client_secret,omitempty"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
AzureSDConfig is the configuration for Azure based service discovery.
func (*AzureSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *AzureSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type BasicAuth ¶ added in v1.0.0
type BasicAuth struct { Username string `yaml:"username"` Password string `yaml:"password"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
BasicAuth contains basic HTTP authentication credentials.
func (*BasicAuth) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ClientCert ¶ added in v1.0.0
type ClientCert struct { Cert string `yaml:"cert"` Key string `yaml:"key"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
ClientCert contains client cert credentials.
type Config ¶
type Config struct { GlobalConfig GlobalConfig `yaml:"global"` RuleFiles []string `yaml:"rule_files,omitempty"` ScrapeConfigs []*ScrapeConfig `yaml:"scrape_configs,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` // contains filtered or unexported fields }
Config is the top-level configuration for Prometheus's config files.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ConsulSDConfig ¶ added in v1.0.0
type ConsulSDConfig struct { Server string `yaml:"server"` Token string `yaml:"token,omitempty"` Datacenter string `yaml:"datacenter,omitempty"` TagSeparator string `yaml:"tag_separator,omitempty"` Scheme string `yaml:"scheme,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` // The list of services for which targets are discovered. // Defaults to all services if empty. Services []string `yaml:"services"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
ConsulSDConfig is the configuration for Consul service discovery.
func (*ConsulSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *ConsulSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type DNSSDConfig ¶ added in v1.0.0
type DNSSDConfig struct { Names []string `yaml:"names"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` Type string `yaml:"type"` Port int `yaml:"port"` // Ignored for SRV records // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
DNSSDConfig is the configuration for DNS based service discovery.
func (*DNSSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *DNSSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type EC2SDConfig ¶ added in v1.0.0
type EC2SDConfig struct { Region string `yaml:"region"` AccessKey string `yaml:"access_key,omitempty"` SecretKey string `yaml:"secret_key,omitempty"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` Port int `yaml:"port"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
EC2SDConfig is the configuration for EC2 based service discovery.
func (*EC2SDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *EC2SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type FileSDConfig ¶ added in v1.0.0
type FileSDConfig struct { Files []string `yaml:"files"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
FileSDConfig is the configuration for file based discovery.
func (*FileSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *FileSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type GlobalConfig ¶
type GlobalConfig struct { // How frequently to scrape targets by default. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // The default timeout when scraping targets. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // How frequently to evaluate rules by default. EvaluationInterval model.Duration `yaml:"evaluation_interval,omitempty"` // The labels to add to any timeseries that this Prometheus instance scrapes. ExternalLabels model.LabelSet `yaml:"external_labels,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
GlobalConfig configures values that are used across other configuration objects.
func (*GlobalConfig) UnmarshalYAML ¶
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type KubernetesRole ¶ added in v1.0.0
type KubernetesRole string
func (*KubernetesRole) UnmarshalYAML ¶ added in v1.0.0
func (c *KubernetesRole) UnmarshalYAML(unmarshal func(interface{}) error) error
type KubernetesSDConfig ¶ added in v1.0.0
type KubernetesSDConfig struct { APIServers []URL `yaml:"api_servers"` Role KubernetesRole `yaml:"role"` InCluster bool `yaml:"in_cluster,omitempty"` BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"` BearerToken string `yaml:"bearer_token,omitempty"` BearerTokenFile string `yaml:"bearer_token_file,omitempty"` RetryInterval model.Duration `yaml:"retry_interval,omitempty"` RequestTimeout model.Duration `yaml:"request_timeout,omitempty"` TLSConfig TLSConfig `yaml:"tls_config,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
KubernetesSDConfig is the configuration for Kubernetes service discovery.
func (*KubernetesSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *KubernetesSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type MarathonSDConfig ¶ added in v1.0.0
type MarathonSDConfig struct { Servers []string `yaml:"servers,omitempty"` RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
MarathonSDConfig is the configuration for services running on Marathon.
func (*MarathonSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *MarathonSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type NerveSDConfig ¶ added in v1.0.0
type NerveSDConfig struct { Servers []string `yaml:"servers"` Paths []string `yaml:"paths"` Timeout model.Duration `yaml:"timeout,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
NerveSDConfig is the configuration for AirBnB's Nerve in Zookeeper based discovery.
func (*NerveSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *NerveSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Regexp ¶ added in v1.0.0
Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
func MustNewRegexp ¶ added in v1.0.0
MustNewRegexp works like NewRegexp, but panics if the regular expression does not compile.
func NewRegexp ¶ added in v1.0.0
NewRegexp creates a new anchored Regexp and returns an error if the passed-in regular expression does not compile.
func (Regexp) MarshalYAML ¶ added in v1.0.0
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RelabelAction ¶ added in v1.0.0
type RelabelAction string
RelabelAction is the action to be performed on relabeling.
const ( // RelabelReplace performs a regex replacement. RelabelReplace RelabelAction = "replace" // RelabelKeep drops targets for which the input does not match the regex. RelabelKeep RelabelAction = "keep" // RelabelDrop drops targets for which the input does match the regex. RelabelDrop RelabelAction = "drop" // RelabelHashMod sets a label to the modulus of a hash of labels. RelabelHashMod RelabelAction = "hashmod" // RelabelLabelMap copies labels to other labelnames based on a regex. RelabelLabelMap RelabelAction = "labelmap" )
func (*RelabelAction) UnmarshalYAML ¶ added in v1.0.0
func (a *RelabelAction) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RelabelConfig ¶ added in v1.0.0
type RelabelConfig struct { // A list of labels from which values are taken and concatenated // with the configured separator in order. SourceLabels model.LabelNames `yaml:"source_labels,flow"` // Separator is the string between concatenated values from the source labels. Separator string `yaml:"separator,omitempty"` // Regex against which the concatenation is matched. Regex Regexp `yaml:"regex,omitempty"` // Modulus to take of the hash of concatenated values from the source labels. Modulus uint64 `yaml:"modulus,omitempty"` // The label to which the resulting string is written in a replacement. TargetLabel model.LabelName `yaml:"target_label,omitempty"` // Replacement is the regex replacement pattern to be used. Replacement string `yaml:"replacement,omitempty"` // Action is the action to be performed for the relabeling. Action RelabelAction `yaml:"action,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
RelabelConfig is the configuration for relabeling of target label sets.
func (*RelabelConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *RelabelConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ScrapeConfig ¶
type ScrapeConfig struct { // The job name to which the job label is set by default. JobName string `yaml:"job_name"` // Indicator whether the scraped metrics should remain unmodified. HonorLabels bool `yaml:"honor_labels,omitempty"` // A set of query parameters with which the target is scraped. Params url.Values `yaml:"params,omitempty"` // How frequently to scrape the targets of this scrape config. ScrapeInterval model.Duration `yaml:"scrape_interval,omitempty"` // The timeout for scraping targets of this config. ScrapeTimeout model.Duration `yaml:"scrape_timeout,omitempty"` // The HTTP resource path on which to fetch metrics from targets. MetricsPath string `yaml:"metrics_path,omitempty"` // The URL scheme with which to fetch metrics from targets. Scheme string `yaml:"scheme,omitempty"` // The HTTP basic authentication credentials for the targets. BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"` // The bearer token for the targets. BearerToken string `yaml:"bearer_token,omitempty"` // The bearer token file for the targets. BearerTokenFile string `yaml:"bearer_token_file,omitempty"` // HTTP proxy server to use to connect to the targets. ProxyURL URL `yaml:"proxy_url,omitempty"` // TLSConfig to use to connect to the targets. TLSConfig TLSConfig `yaml:"tls_config,omitempty"` // List of labeled target groups for this job. StaticConfigs []*TargetGroup `yaml:"static_configs,omitempty"` // List of DNS service discovery configurations. DNSSDConfigs []*DNSSDConfig `yaml:"dns_sd_configs,omitempty"` // List of file service discovery configurations. FileSDConfigs []*FileSDConfig `yaml:"file_sd_configs,omitempty"` // List of Consul service discovery configurations. ConsulSDConfigs []*ConsulSDConfig `yaml:"consul_sd_configs,omitempty"` // List of Serverset service discovery configurations. ServersetSDConfigs []*ServersetSDConfig `yaml:"serverset_sd_configs,omitempty"` // NerveSDConfigs is a list of Nerve service discovery configurations. NerveSDConfigs []*NerveSDConfig `yaml:"nerve_sd_configs,omitempty"` // MarathonSDConfigs is a list of Marathon service discovery configurations. MarathonSDConfigs []*MarathonSDConfig `yaml:"marathon_sd_configs,omitempty"` // List of Kubernetes service discovery configurations. KubernetesSDConfigs []*KubernetesSDConfig `yaml:"kubernetes_sd_configs,omitempty"` // List of EC2 service discovery configurations. EC2SDConfigs []*EC2SDConfig `yaml:"ec2_sd_configs,omitempty"` // List of Azure service discovery configurations. AzureSDConfigs []*AzureSDConfig `yaml:"azure_sd_configs,omitempty"` // List of target relabel configurations. RelabelConfigs []*RelabelConfig `yaml:"relabel_configs,omitempty"` // List of metric relabel configurations. MetricRelabelConfigs []*RelabelConfig `yaml:"metric_relabel_configs,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
ScrapeConfig configures a scraping unit for Prometheus.
func (*ScrapeConfig) UnmarshalYAML ¶
func (c *ScrapeConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ServersetSDConfig ¶ added in v1.0.0
type ServersetSDConfig struct { Servers []string `yaml:"servers"` Paths []string `yaml:"paths"` Timeout model.Duration `yaml:"timeout,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
ServersetSDConfig is the configuration for Twitter serversets in Zookeeper based discovery.
func (*ServersetSDConfig) UnmarshalYAML ¶ added in v1.0.0
func (c *ServersetSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type TLSConfig ¶ added in v1.0.0
type TLSConfig struct { // The CA cert to use for the targets. CAFile string `yaml:"ca_file,omitempty"` // The client cert file for the targets. CertFile string `yaml:"cert_file,omitempty"` // The client key file for the targets. KeyFile string `yaml:"key_file,omitempty"` // Used to verify the hostname for the targets. ServerName string `yaml:"server_name,omitempty"` // Disable target certificate validation. InsecureSkipVerify bool `yaml:"insecure_skip_verify"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
TLSConfig configures the options for TLS connections.
func (*TLSConfig) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML implements the yaml.Unmarshaler interface.
type TargetGroup ¶ added in v1.0.0
type TargetGroup struct { // Targets is a list of targets identified by a label set. Each target is // uniquely identifiable in the group by its address label. Targets []model.LabelSet // Labels is a set of labels that is common across all targets in the group. Labels model.LabelSet // Source is an identifier that describes a group of targets. Source string }
TargetGroup is a set of targets with a common label set.
func (TargetGroup) MarshalYAML ¶ added in v1.0.0
func (tg TargetGroup) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (TargetGroup) String ¶ added in v1.0.0
func (tg TargetGroup) String() string
func (*TargetGroup) UnmarshalJSON ¶ added in v1.0.0
func (tg *TargetGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*TargetGroup) UnmarshalYAML ¶ added in v1.0.0
func (tg *TargetGroup) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type URL ¶ added in v1.0.0
URL is a custom URL type that allows validation at configuration load time.
func (URL) MarshalYAML ¶ added in v1.0.0
MarshalYAML implements the yaml.Marshaler interface for URLs.
func (*URL) UnmarshalYAML ¶ added in v1.0.0
UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.