service

package
v0.0.0-...-10febd9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPlugin

func RegisterPlugin(name string, plugin Plugin)

func SetupPlugins

func SetupPlugins(flagSet *pflag.FlagSet)

Types

type GlobalConfig

type GlobalConfig struct {
	ScrapeInterval     string `yaml:"scrape_interval,omitempty"`
	EvaluationInterval string `yaml:"evaluation_interval,omitempty"`
}

type KubernetesSDConfig

type KubernetesSDConfig struct {
	Role string `yaml:"role"`
}

type KubernetesSDConfigList

type KubernetesSDConfigList []KubernetesSDConfig

type Plugin

type Plugin interface {
	// Configure the command line flags needed by the plugin.
	Setup(flagSet *pflag.FlagSet)

	// Start the plugin. Send a value on the given channel to trigger an update of the configuration.
	// Use a go-routine internally since this method is blocking.
	Start(config ServiceConfig, trigger chan string) error

	// Update the data of the plugin so a new configuration can be build.
	Update() (PluginUpdate, error)
}

type PluginUpdate

type PluginUpdate interface {
	// CreateNodes creates all scrape configurations this plugin is aware of.
	CreateNodes() ([]ScrapeConfig, error)

	// CreateRules creates all rules this plugin is aware of.
	// The returns string list should contain the content of the various rules.
	CreateRules() ([]string, error)
}

type PrometheusConfig

type PrometheusConfig struct {
	Global        GlobalConfig     `yaml:"global"`
	RuleFiles     []string         `yaml:"rule_files,omitempty"`
	ScrapeConfigs ScrapeConfigList `yaml:"scrape_configs"`
}

func (*PrometheusConfig) Sort

func (pc *PrometheusConfig) Sort()

type RelabelConfig

type RelabelConfig struct {
	SourceLabels []string `yaml:"source_labels,omitempty"`
	Separator    string   `yaml:"separator,omitempty"`
	TargetLabel  string   `yaml:"target_label,omitempty"`
	Regex        string   `yaml:"regex,omitempty"`
	Modulus      uint64   `yaml:"modulus,omitempty"`
	Replacement  string   `yaml:"replacement,omitempty"`
	Action       string   `yaml:"action,omitempty"`
}

type RelabelConfigList

type RelabelConfigList []RelabelConfig

type ScrapeConfig

type ScrapeConfig struct {
	JobName           string                 `yaml:"job_name"`
	ScrapeInterval    string                 `yaml:"scrape_interval,omitempty"`
	HonorLabels       bool                   `yaml:"honor_labels,omitempty"`
	MetricsPath       string                 `yaml:"metrics_path,omitempty"`
	Scheme            string                 `yaml:"scheme,omitempty"`
	StaticConfigs     StaticConfigList       `yaml:"static_configs,omitempty"`
	KubernetesConfigs KubernetesSDConfigList `yaml:"kubernetes_sd_configs,omitempty"`
	TLSConfig         *TLSConfig             `yaml:"tls_config,omitempty"`
	RelabelConfigs    RelabelConfigList      `yaml:"relabel_configs,omitempty"`
}

func (*ScrapeConfig) Sort

func (sc *ScrapeConfig) Sort()

type ScrapeConfigList

type ScrapeConfigList []ScrapeConfig

func (ScrapeConfigList) Len

func (l ScrapeConfigList) Len() int

func (ScrapeConfigList) Less

func (l ScrapeConfigList) Less(i, j int) bool

func (ScrapeConfigList) Swap

func (l ScrapeConfigList) Swap(i, j int)

type Service

type Service struct {
	ServiceConfig
	ServiceDependencies
	// contains filtered or unexported fields
}

func NewService

func NewService(config ServiceConfig, deps ServiceDependencies) *Service

func (*Service) Run

func (s *Service) Run() error

Run builds the config once of continuously

type ServiceConfig

type ServiceConfig struct {
	LogLevel                string
	ConfigPath              string
	RulesPath               string
	Once                    bool
	LoopDelay               time.Duration
	PrometheusContainerName string
	PrometheusReloadURL     string
	NodeExporterPort        int
}

type ServiceDependencies

type ServiceDependencies struct {
	Log *logging.Logger
}

type StaticConfig

type StaticConfig struct {
	Targets []string          `yaml:"targets,omitempty"`
	Labels  map[string]string `yaml:"labels,omitempty"`
}

func (*StaticConfig) FullString

func (tg *StaticConfig) FullString() string

func (*StaticConfig) Label

func (tg *StaticConfig) Label(name, value string)

func (*StaticConfig) Sort

func (tg *StaticConfig) Sort()

type StaticConfigList

type StaticConfigList []StaticConfig

func (StaticConfigList) Len

func (l StaticConfigList) Len() int

func (StaticConfigList) Less

func (l StaticConfigList) Less(i, j int) bool

func (StaticConfigList) Swap

func (l StaticConfigList) Swap(i, j int)

type TLSConfig

type TLSConfig struct {
	CAFile             string `yaml:"ca_file,omitempty"`
	CertFile           string `yaml:"cert_file,omitempty"`
	KeyFile            string `yaml:"key_file,omitempty"`
	ServerName         string `yaml:"server_name,omitempty"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify,omitempty"`
}

func (TLSConfig) IsConfigured

func (t TLSConfig) IsConfigured() bool

IsConfigured returns true if there is a non-empty configuration in the given TLSConfig.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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