config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandConfig

type CommandConfig struct {
	Command string                   `yaml:"command"`
	Debug   bool                     `yaml:"debug,omitempty"`
	Metrics map[string]*MetricConfig `yaml:"metrics"`
}

CommandConfig stores command specific configuration

type Config

type Config struct {
	Hosts map[string]*HostConfig `yaml:"hosts,omitempty"`
}

Config stores the ssh-exporter's configuration

func Read

func Read(reader io.Reader) (*Config, error)

Read reads a configuration from an io.Reader and returns either the Config or an error

type HostConfig

type HostConfig struct {
	Mutex          sync.Mutex
	HostName       string
	Port           int              `yaml:"port,omitempty"`
	Username       string           `yaml:"username"`
	KeyFile        string           `yaml:"key_file,omitempty"`
	Password       string           `yaml:"password,omitempty"`
	ConnectTimeout int              `yaml:"connect_timeout,omitempty"`
	CommandTimeout int              `yaml:"command_timeout,omitempty"`
	Commands       []*CommandConfig `yaml:"commands"`
}

HostConfig stores host specifc configuration

func (*HostConfig) GetSSHAuthMethods

func (host *HostConfig) GetSSHAuthMethods() ([]ssh.AuthMethod, error)

GetSSHAuthMethods returns a list of ssh.AuthMethod for a given host

func (*HostConfig) GetSSHConfig

func (host *HostConfig) GetSSHConfig() (*ssh.ClientConfig, error)

GetSSHConfig returns a ssh.ClientConfig for a given host

type MetricConfig

type MetricConfig struct {
	Regex         string `yaml:"regex"`
	RegexCompiled *regexp.Regexp
	Help          string            `yaml:"help,omitempty"`
	Labels        map[string]string `yaml:"labels,omitempty"`
	DynamicLabels []string          `yaml:"dynamic_labels,omitempty"`
	ValueAsLabel  string            `yaml:"value_as_label,omitempty"`
	ValueEnum     []string          `yaml:"value_enum,omitempty"`
	Desc          *prometheus.Desc
}

MetricConfig stores metrics to extract by regex matching command's stdout

Jump to

Keyboard shortcuts

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