Documentation ¶
Index ¶
- Variables
- type BasicAuth
- type ClientCert
- type Config
- type ConsulSDConfig
- type DNSSDConfig
- type Duration
- type FileSDConfig
- type GlobalConfig
- type KubernetesSDConfig
- type MarathonSDConfig
- type Regexp
- type RelabelAction
- type RelabelConfig
- type ScrapeConfig
- type ServersetSDConfig
- type TargetGroup
- type URL
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConfig is the default top-level configuration. DefaultConfig = Config{ GlobalConfig: DefaultGlobalConfig, } // DefaultGlobalConfig is the default global configuration. DefaultGlobalConfig = GlobalConfig{ ScrapeInterval: Duration(1 * time.Minute), ScrapeTimeout: Duration(10 * time.Second), EvaluationInterval: 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: ";", } // DefaultDNSSDConfig is the default DNS SD configuration. DefaultDNSSDConfig = DNSSDConfig{ RefreshInterval: Duration(30 * time.Second), Type: "SRV", } // DefaultFileSDConfig is the default file SD configuration. DefaultFileSDConfig = FileSDConfig{ RefreshInterval: 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: Duration(10 * time.Second), } // DefaultMarathonSDConfig is the default Marathon SD configuration. DefaultMarathonSDConfig = MarathonSDConfig{ RefreshInterval: Duration(30 * time.Second), } // DefaultKubernetesSDConfig is the default Kubernetes SD configuration DefaultKubernetesSDConfig = KubernetesSDConfig{ KubeletPort: 10255, RequestTimeout: Duration(10 * time.Second), RetryInterval: Duration(1 * time.Second), } )
The defaults applied before parsing the respective config sections.
Functions ¶
This section is empty.
Types ¶
type BasicAuth ¶
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 ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ClientCert ¶
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 ¶
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 ¶
func (c *ConsulSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type DNSSDConfig ¶
type DNSSDConfig struct { Names []string `yaml:"names"` RefreshInterval 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 ¶
func (c *DNSSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Duration ¶
Duration encapsulates a time.Duration and makes it YAML marshallable.
TODO(fabxc): Since we have custom types for most things, including timestamps, we might want to move this into our model as well, eventually.
func (Duration) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type FileSDConfig ¶
type FileSDConfig struct { Names []string `yaml:"names"` RefreshInterval 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 ¶
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 Duration `yaml:"scrape_interval,omitempty"` // The default timeout when scraping targets. ScrapeTimeout Duration `yaml:"scrape_timeout,omitempty"` // How frequently to evaluate rules by default. EvaluationInterval Duration `yaml:"evaluation_interval,omitempty"` // The labels to add to any timeseries that this Prometheus instance scrapes. Labels model.LabelSet `yaml:"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 KubernetesSDConfig ¶
type KubernetesSDConfig struct { Server string `yaml:"server"` KubeletPort int `yaml:"kubelet_port,omitempty"` InCluster bool `yaml:"in_cluster,omitempty"` BearerTokenFile string `yaml:"bearer_token_file,omitempty"` Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` Insecure bool `yaml:"insecure,omitempty"` CertFile string `yaml:"cert_file,omitempty"` KeyFile string `yaml:"key_file,omitempty"` CAFile string `yaml:"ca_file,omitempty"` RetryInterval Duration `yaml:"retry_interval,omitempty"` RequestTimeout Duration `yaml:"request_timeout,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 ¶
func (c *KubernetesSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type MarathonSDConfig ¶
type MarathonSDConfig struct { Servers []string `yaml:"servers,omitempty"` RefreshInterval 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 ¶
func (c *MarathonSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.
func (*Regexp) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RelabelAction ¶
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 ¶
func (a *RelabelAction) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type RelabelConfig ¶
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 ¶
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 Duration `yaml:"scrape_interval,omitempty"` // The timeout for scraping targets of this config. ScrapeTimeout 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"` // The ca cert to use for the targets. CACert string `yaml:"ca_cert,omitempty"` // The client cert authentication credentials for the targets. ClientCert *ClientCert `yaml:"client_cert,omitempty"` // HTTP proxy server to use to connect to the targets. ProxyURL URL `yaml:"proxy_url,omitempty"` // List of labeled target groups for this job. TargetGroups []*TargetGroup `yaml:"target_groups,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"` // 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 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 ¶
type ServersetSDConfig struct { Servers []string `yaml:"servers"` Paths []string `yaml:"paths"` Timeout 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 ¶
func (c *ServersetSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type TargetGroup ¶
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 ¶
func (tg TargetGroup) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface.
func (TargetGroup) String ¶
func (tg TargetGroup) String() string
func (*TargetGroup) UnmarshalJSON ¶
func (tg *TargetGroup) UnmarshalJSON(b []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*TargetGroup) UnmarshalYAML ¶
func (tg *TargetGroup) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type URL ¶
URL is a custom URL type that allows validation at configuration load time.
func (URL) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for URLs.
func (*URL) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface for URLs.