rainbond: github.com/goodrain/rainbond/monitor/prometheus Index | Files

package prometheus

import "github.com/goodrain/rainbond/monitor/prometheus"


Package Files

config.go manager.go rules_manager.go


const (
    STARTING = iota

type AlertingConfig Uses

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

AlertingConfig configures alerting and alertmanager related configs.

type AlertingNameConfig Uses

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

AlertingNameConfig alerting config

type AlertingRulesConfig Uses

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

AlertingRulesConfig alerting rule config

type AlertingRulesManager Uses

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

AlertingRulesManager alerting rule manage

func NewRulesManager Uses

func NewRulesManager(config *option.Config) *AlertingRulesManager

NewRulesManager new rule manager

func (*AlertingRulesManager) AddRules Uses

func (a *AlertingRulesManager) AddRules(val AlertingNameConfig) error

AddRules add rule

func (*AlertingRulesManager) InitRulesConfig Uses

func (a *AlertingRulesManager) InitRulesConfig()

InitRulesConfig init rule config

func (*AlertingRulesManager) LoadAlertingRulesConfig Uses

func (a *AlertingRulesManager) LoadAlertingRulesConfig() error

LoadAlertingRulesConfig load alerting rule config

func (*AlertingRulesManager) SaveAlertingRulesConfig Uses

func (a *AlertingRulesManager) SaveAlertingRulesConfig() error

SaveAlertingRulesConfig save alerting rule config

type AlertmanagerConfig Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

func NewManager Uses

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

func (*Manager) LoadConfig Uses

func (p *Manager) LoadConfig() error

func (*Manager) RestartDaemon Uses

func (p *Manager) RestartDaemon() error

func (*Manager) SaveConfig Uses

func (p *Manager) SaveConfig() error

func (*Manager) StartDaemon Uses

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

func (*Manager) StopDaemon Uses

func (p *Manager) StopDaemon()

func (*Manager) UpdateScrape Uses

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

type QueueConfig Uses

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 Uses

type Regexp struct {
    // contains filtered or unexported fields

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

type RelabelAction Uses

type RelabelAction string

RelabelAction is the action to be performed on relabeling.

type RelabelConfig Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

type Secret string

Secret special type for storing secrets.

type ServiceDiscoveryConfig Uses

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 Uses

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 Uses

type URL struct {

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

Package prometheus imports 17 packages (graph) and is imported by 5 packages. Updated 2019-08-29. Refresh now. Tools for package owners.