config

package
v2.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package config provides access to pmm-agent configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application

func Application(cfg *Config) (*kingpin.Application, *string)

Application returns kingpin application that will parse command-line flags and environment variables (but not configuration file) into cfg except --config-file/PMM_AGENT_CONFIG_FILE that is returned separately.

func ConfigureLogger

func ConfigureLogger(cfg *Config)

ConfigureLogger configures standard Logrus logger.

func SaveToFile

func SaveToFile(path string, cfg *Config, comment string) error

SaveToFile saves configuration to file. No special cases.

Types

type Config

type Config struct {
	ID         string `yaml:"id"`
	ListenPort uint16 `yaml:"listen-port"`

	Server Server `yaml:"server"`
	Paths  Paths  `yaml:"paths"`
	Ports  Ports  `yaml:"ports"`

	Debug bool `yaml:"debug"`
	Trace bool `yaml:"trace"`

	Setup Setup `yaml:"-"`
}

Config represents pmm-agent's configuration.

func Get

func Get(l *logrus.Entry) (*Config, string, error)

Get parses command-line flags, environment variables and configuration file (if --config-file/PMM_AGENT_CONFIG_FILE is defined). It returns configuration, configuration file path (value of -config-file/PMM_AGENT_CONFIG_FILE, may be empty), and any encountered error. That error may be ErrConfigFileDoesNotExist if configuration file path is not empty, but file itself does not exist. Configuration from command-line flags and environment variables is still returned in this case.

type ErrConfigFileDoesNotExist

type ErrConfigFileDoesNotExist string

ErrConfigFileDoesNotExist error is returned from Get method if configuration file is expected, but does not exist.

func (ErrConfigFileDoesNotExist) Error

type Paths

type Paths struct {
	ExportersBase    string `yaml:"exporters_base"`
	NodeExporter     string `yaml:"node_exporter"`
	MySQLdExporter   string `yaml:"mysqld_exporter"`
	MongoDBExporter  string `yaml:"mongodb_exporter"`
	PostgresExporter string `yaml:"postgres_exporter"`
	ProxySQLExporter string `yaml:"proxysql_exporter"`
	RDSExporter      string `yaml:"rds_exporter"`

	TempDir string `yaml:"tempdir"`

	PTSummary string `yaml:"pt_summary"`

	SlowLogFilePrefix string `yaml:"slowlog_file_prefix,omitempty"` // for development and testing
}

Paths represents binaries paths configuration.

type Ports

type Ports struct {
	Min uint16 `yaml:"min"`
	Max uint16 `yaml:"max"`
}

Ports represents ports configuration.

type Server

type Server struct {
	Address     string `yaml:"address"`
	Username    string `yaml:"username"`
	Password    string `yaml:"password"`
	InsecureTLS bool   `yaml:"insecure-tls"`

	WithoutTLS bool `yaml:"without-tls,omitempty"` // for development and testing
}

Server represents PMM Server configuration.

func (*Server) FilteredURL

func (s *Server) FilteredURL() string

FilteredURL returns URL with redacted password.

func (*Server) URL

func (s *Server) URL() *url.URL

URL returns base PMM Server URL for JSON APIs.

type Setup

type Setup struct {
	NodeType      string
	NodeName      string
	MachineID     string
	Distro        string
	ContainerID   string
	ContainerName string
	NodeModel     string
	Region        string
	Az            string
	Address       string

	Force            bool
	SkipRegistration bool
}

Setup contains `pmm-agent setup` flag and argument values. It is never stored in configuration file.

Jump to

Keyboard shortcuts

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