prometheus

package
v5.1.8-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STARTING = iota
	STARTED
	STOPPED
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertingConfig

type AlertingConfig struct {
	AlertRelabelConfigs []*RelabelConfig      `yaml:"alert_relabel_configs,omitempty"`
	AlertmanagerConfigs []*AlertmanagerConfig `yaml:"alertmanagers,omitempty"`
}

AlertingConfig configures alerting and alertmanager related configs.

type AlertingNameConfig

type AlertingNameConfig struct {
	Name  string         `yaml:"name" json:"name"`
	Rules []*RulesConfig `yaml:"rules" json:"rules"`
}

AlertingNameConfig alerting config

type AlertingRulesConfig

type AlertingRulesConfig struct {
	Groups []*AlertingNameConfig `yaml:"groups" json:"groups"`
}

AlertingRulesConfig alerting rule config

type AlertingRulesManager

type AlertingRulesManager struct {
	RulesConfig *AlertingRulesConfig
	// contains filtered or unexported fields
}

AlertingRulesManager alerting rule manage

func NewRulesManager

func NewRulesManager(config *option.Config) *AlertingRulesManager

NewRulesManager new rule manager

func (*AlertingRulesManager) AddRules

AddRules add rule

func (*AlertingRulesManager) InitRulesConfig

func (a *AlertingRulesManager) InitRulesConfig()

InitRulesConfig init rule config

func (*AlertingRulesManager) LoadAlertingRulesConfig

func (a *AlertingRulesManager) LoadAlertingRulesConfig() error

LoadAlertingRulesConfig load alerting rule config

func (*AlertingRulesManager) SaveAlertingRulesConfig

func (a *AlertingRulesManager) SaveAlertingRulesConfig() error

SaveAlertingRulesConfig save alerting rule config

type AlertmanagerConfig

type AlertmanagerConfig struct {
	ServiceDiscoveryConfig ServiceDiscoveryConfig `yaml:",inline"`
	HTTPClientConfig       HTTPClientConfig       `yaml:",inline"`

	// The URL scheme to use when talking to Alertmanagers.
	Scheme string `yaml:"scheme,omitempty"`
	// Path prefix to add in front of the push endpoint path.
	PathPrefix string `yaml:"path_prefix,omitempty"`
	// The timeout used when sending alerts.
	Timeout time.Duration `yaml:"timeout,omitempty"`

	// List of Alertmanager relabel configurations.
	RelabelConfigs []*RelabelConfig `yaml:"relabel_configs,omitempty"`
}

AlertmanagerConfig configures how Alertmanagers can be discovered and communicated with.

type BasicAuth

type BasicAuth struct {
	Username     string `yaml:"username"`
	Password     Secret `yaml:"password,omitempty"`
	PasswordFile string `yaml:"password_file,omitempty"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline"`
}

BasicAuth contains basic HTTP authentication credentials.

type Config

type Config struct {
	GlobalConfig   GlobalConfig    `yaml:"global"`
	AlertingConfig AlertingConfig  `yaml:"alerting,omitempty"`
	RuleFiles      []string        `yaml:"rule_files,omitempty"`
	ScrapeConfigs  []*ScrapeConfig `yaml:"scrape_configs,omitempty"`

	RemoteWriteConfigs []*RemoteWriteConfig `yaml:"remote_write,omitempty"`
	RemoteReadConfigs  []*RemoteReadConfig  `yaml:"remote_read,omitempty"`
	// contains filtered or unexported fields
}

Config is the top-level configuration for Prometheus's config files.

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"`
}

GlobalConfig configures values that are used across other configuration objects.

type Group

type Group 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 []string `yaml:"targets,flow"`
	// Labels is a set of labels that is common across all targets in the group.
	Labels model.LabelSet `yaml:"labels,omitempty"`

	// Source is an identifier that describes a group of targets.
	Source string `yaml:"source,omitempty"`
}

type HTTPClientConfig

type HTTPClientConfig struct {
	// The HTTP basic authentication credentials for the targets.
	BasicAuth *BasicAuth `yaml:"basic_auth,omitempty"`
	// The bearer token for the targets.
	BearerToken Secret `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"`

	// Catches all undefined fields and must be empty after parsing.
	XXX map[string]interface{} `yaml:",inline"`
}

HTTPClientConfig configures an HTTP client.

type Manager

type Manager struct {
	Opt      *option.Config
	Config   *Config
	Process  *os.Process
	Status   int
	Registry *discover.KeepAlive
	// contains filtered or unexported fields
}

func NewManager

func NewManager(config *option.Config, a *AlertingRulesManager) *Manager

func (*Manager) LoadConfig

func (p *Manager) LoadConfig() error

func (*Manager) RestartDaemon

func (p *Manager) RestartDaemon() error

func (*Manager) SaveConfig

func (p *Manager) SaveConfig() error

func (*Manager) StartDaemon

func (p *Manager) StartDaemon(errchan chan error)

func (*Manager) StopDaemon

func (p *Manager) StopDaemon()

func (*Manager) UpdateScrape

func (p *Manager) UpdateScrape(scrape *ScrapeConfig)

type QueueConfig

type QueueConfig struct {
	// Number of samples to buffer per shard before we start dropping them.
	Capacity int `yaml:"capacity,omitempty"`

	// Max number of shards, i.e. amount of concurrency.
	MaxShards int `yaml:"max_shards,omitempty"`

	// Maximum number of samples per send.
	MaxSamplesPerSend int `yaml:"max_samples_per_send,omitempty"`

	// Maximum time sample will wait in buffer.
	BatchSendDeadline time.Duration `yaml:"batch_send_deadline,omitempty"`

	// Max number of times to retry a batch on recoverable errors.
	MaxRetries int `yaml:"max_retries,omitempty"`

	// On recoverable errors, backoff exponentially.
	MinBackoff time.Duration `yaml:"min_backoff,omitempty"`
	MaxBackoff time.Duration `yaml:"max_backoff,omitempty"`
}

QueueConfig is the configuration for the queue used to write to remote storage.

type Regexp

type Regexp struct {
	*regexp.Regexp
	// contains filtered or unexported fields
}

Regexp encapsulates a regexp.Regexp and makes it YAML marshallable.

type RelabelAction

type RelabelAction string

RelabelAction is the action to be performed on relabeling.

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,omitempty"`
	// 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"`
	// TargetLabel is the label to which the resulting string is written in a replacement.
	// Regexp interpolation is allowed for the replace action.
	TargetLabel string `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"`
}

RelabelConfig is the configuration for relabeling of target label sets.

type RemoteReadConfig

type RemoteReadConfig struct {
	URL           *URL           `yaml:"url"`
	RemoteTimeout model.Duration `yaml:"remote_timeout,omitempty"`
	ReadRecent    bool           `yaml:"read_recent,omitempty"`
	// We cannot do proper Go type embedding below as the parser will then parse
	// values arbitrarily into the overflow maps of further-down types.
	HTTPClientConfig HTTPClientConfig `yaml:",inline"`

	// RequiredMatchers is an optional list of equality matchers which have to
	// be present in a selector to query the remote read endpoint.
	RequiredMatchers model.LabelSet `yaml:"required_matchers,omitempty"`
}

RemoteReadConfig is the configuration for reading from remote storage.

type RemoteWriteConfig

type RemoteWriteConfig struct {
	URL                 *URL             `yaml:"url"`
	RemoteTimeout       model.Duration   `yaml:"remote_timeout,omitempty"`
	WriteRelabelConfigs []*RelabelConfig `yaml:"write_relabel_configs,omitempty"`

	// We cannot do proper Go type embedding below as the parser will then parse
	// values arbitrarily into the overflow maps of further-down types.
	HTTPClientConfig HTTPClientConfig `yaml:",inline"`
	QueueConfig      QueueConfig      `yaml:"queue_config,omitempty"`
}

RemoteWriteConfig is the configuration for writing to remote storage.

type RulesConfig

type RulesConfig struct {
	Alert       string            `yaml:"alert" json:"alert"`
	Expr        string            `yaml:"expr" json:"expr"`
	For         string            `yaml:"for" json:"for"`
	Labels      map[string]string `yaml:"labels" json:"labels"`
	Annotations map[string]string `yaml:"annotations" json:"annotations"`
}

RulesConfig rule config

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"`
	// More than this many samples post metric-relabelling will cause the scrape to fail.
	SampleLimit uint `yaml:"sample_limit,omitempty"`

	ServiceDiscoveryConfig ServiceDiscoveryConfig `yaml:",inline"`
	HTTPClientConfig       HTTPClientConfig       `yaml:",inline"`

	// List of target relabel configurations.
	RelabelConfigs []*RelabelConfig `yaml:"relabel_configs,omitempty"`
	// List of metric relabel configurations.
	MetricRelabelConfigs []*RelabelConfig `yaml:"metric_relabel_configs,omitempty"`
}

ScrapeConfig configures a scraping unit for Prometheus.

type Secret

type Secret string

Secret special type for storing secrets.

type ServiceDiscoveryConfig

type ServiceDiscoveryConfig struct {
	// List of labeled target groups for this job.
	StaticConfigs []*Group `yaml:"static_configs,omitempty"`
}

ServiceDiscoveryConfig configures lists of different service discovery mechanisms.

type TLSConfig

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.

type URL

type URL struct {
	*url.URL
}

URL is a custom URL type that allows validation at configuration load time.

Jump to

Keyboard shortcuts

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