pmm

package
v1.7.1-0...-cd42b1d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: AGPL-3.0 Imports: 46 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ServerInfoTemplate = `` /* 228-byte string literal not displayed */

	DefaultServerInfoTemplate = `{{template "ServerInfo" .}}
`
)
View Source
const (
	DefaultListTemplate = `` /* 268-byte string literal not displayed */

)

each non-empty field value must end with newline

View Source
const (
	NameRegex = `^[-\w:\.]{2,60}$`
)

Variables

View Source
var (
	// you can use `-ldflags -X github.com/percona/pmm-client/pmm.Version=`
	// to set build version number
	Version = "1.17.5"

	// you can use `-ldflags -X github.com/percona/pmm-client/pmm.RootDir=`
	// to set root filesystem for pmm-admin
	RootDir = ""

	PMMBaseDir   = RootDir + "/usr/local/percona/pmm-client"
	AgentBaseDir = RootDir + "/usr/local/percona/qan-agent"

	ConfigFile  = fmt.Sprintf("%s/pmm.yml", PMMBaseDir)
	SSLCertFile = fmt.Sprintf("%s/server.crt", PMMBaseDir)
	SSLKeyFile  = fmt.Sprintf("%s/server.key", PMMBaseDir)

	ErrDuplicate = errors.New("there is already one instance with this name under monitoring.")
	ErrNoService = errors.New("no service found.")
)
View Source
var (
	NewService func(i service.Interface, c *service.Config) (service.Service, error) = service.New
)

Functions

func CheckBinaries added in v1.0.4

func CheckBinaries() string

CheckBinaries check if all PMM Client binaries are at their paths

func CheckMonitoredDBServices

func CheckMonitoredDBServices() []string

CheckMonitoredDBServices finds out what DB instances are monitored.

func FileExists

func FileExists(file string) bool

FileExists check if file exists.

func GetLocalServices added in v1.3.2

func GetLocalServices() (services []string)

GetLocalServices finds any local PMM services

func GetServiceDirAndExtension added in v1.3.2

func GetServiceDirAndExtension() (dir, extension string)

GetServiceDirAndExtension returns dir and extension used to create system service

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(insecureFlag bool, timeout time.Duration, debug bool) *API

func (*API) Delete

func (a *API) Delete(url string) (*http.Response, []byte, error)

func (*API) Error

func (a *API) Error(method, url string, gotStatusCode, expectedStatusCode int, content []byte) error

func (*API) Get

func (a *API) Get(url string) (*http.Response, []byte, error)

func (*API) Hostname

func (a *API) Hostname() string

func (*API) NewClient added in v1.3.2

func (a *API) NewClient() *http.Client

NewClient creates new *http.Client tailored for this API

func (*API) Ping

func (a *API) Ping(url string) error

func (*API) Post

func (a *API) Post(url string, data []byte) (*http.Response, []byte, error)

func (*API) Put

func (a *API) Put(url string, data []byte) (*http.Response, []byte, error)

func (*API) URL

func (a *API) URL(paths ...string) string

type Admin

type Admin struct {
	ServiceName string
	ServicePort int
	Args        []string // Args defines additional arguments to pass through to *_exporter or qan-agent
	Config      *Config
	Verbose     bool
	SkipAdmin   bool
	Format      string
	// contains filtered or unexported fields
}

Admin main class.

func (*Admin) AddAnnotation

func (a *Admin) AddAnnotation(ctx context.Context, text string, tags string) error

AddAnnotation posts annotation to managed.

func (*Admin) AddExternalInstances added in v1.4.0

func (a *Admin) AddExternalInstances(ctx context.Context, name string, targets []ExternalTarget, checkReachability bool) error

AddExternalInstances adds targets to existing scrape job.

func (*Admin) AddExternalMetrics added in v1.4.0

func (a *Admin) AddExternalMetrics(ctx context.Context, ext *ExternalMetrics, checkReachability bool) error

AddExternalMetrics adds external Prometheus scrape job and targets.

func (*Admin) AddExternalService added in v1.7.0

func (a *Admin) AddExternalService(ctx context.Context, ext *ExternalMetrics, force bool) error

func (*Admin) AddMetrics

func (a *Admin) AddMetrics(ctx context.Context, m plugin.Metrics, force bool, disableSSL bool) (*plugin.Info, error)

AddMetrics add metrics service to monitoring.

func (*Admin) AddQueries

func (a *Admin) AddQueries(ctx context.Context, q plugin.Queries) (*plugin.Info, error)

AddQueries add instance to Query Analytics.

func (*Admin) CheckInstallation added in v1.0.5

func (a *Admin) CheckInstallation() (orphanedServices, missingServices []string)

CheckInstallation check for broken installation.

func (*Admin) CheckNetwork

func (a *Admin) CheckNetwork() error

CheckNetwork check connectivity between client and server.

func (*Admin) CheckVersion

func (a *Admin) CheckVersion(ctx context.Context) (fatal bool, err error)

CheckVersion check server and client versions and returns boolean and error; boolean is true if error is fatal.

func (*Admin) CollectSummary

func (a *Admin) CollectSummary() error

CollectSummary get output of system and pmm utilites.

func (*Admin) List

func (a *Admin) List() error

List prints to stdout all services from Consul.

func (*Admin) ListExternalMetrics added in v1.4.0

func (a *Admin) ListExternalMetrics(ctx context.Context) ([]ExternalMetrics, error)

ListExternalMetrics returns external Prometheus exporters.

func (*Admin) LoadConfig

func (a *Admin) LoadConfig() error

LoadConfig read PMM client config file.

func (*Admin) PrintInfo

func (a *Admin) PrintInfo()

PrintInfo print PMM client info.

func (*Admin) PurgeMetrics added in v1.0.6

func (a *Admin) PurgeMetrics(svcType string) error

PurgeMetrics purge metrics data on the server by its metric type and name.

func (*Admin) RemoveAllMonitoring added in v1.0.4

func (a *Admin) RemoveAllMonitoring(ignoreErrors bool) (uint16, error)

RemoveAllMonitoring remove all the monitoring services.

func (*Admin) RemoveExternalInstances added in v1.4.0

func (a *Admin) RemoveExternalInstances(ctx context.Context, name string, targets []string) error

RemoveExternalInstances removes targets from existing scrape job.

func (*Admin) RemoveExternalMetrics added in v1.4.0

func (a *Admin) RemoveExternalMetrics(ctx context.Context, name string) error

RemoveExternalMetrics removes external Prometheus scrape job and targets.

func (*Admin) RemoveMetrics

func (a *Admin) RemoveMetrics(name string) error

RemoveMetrics remove metrics service from monitoring.

func (*Admin) RemoveQueries

func (a *Admin) RemoveQueries(name string) error

RemoveQueries remove instance from QAN.

func (*Admin) RepairInstallation added in v1.0.5

func (a *Admin) RepairInstallation() error

RepairInstallation repair installation.

func (*Admin) ServerInfo added in v1.0.4

func (a *Admin) ServerInfo() error

ServerInfo print server info.

func (*Admin) SetAPI

func (a *Admin) SetAPI() error

SetAPI setups QAN, Consul, Prometheus, pmm-managed clients and verifies connections.

func (*Admin) SetConfig

func (a *Admin) SetConfig(cf Config, flagForce bool) error

SetConfig configure PMM client, check connectivity and write the config.

func (*Admin) ShowPasswords added in v1.0.7

func (a *Admin) ShowPasswords()

ShowPasswords display passwords from config file.

func (*Admin) StartStopAllMonitoring

func (a *Admin) StartStopAllMonitoring(action string) (numOfAffected, numOfAll int, err error)

StartStopAllMonitoring start/stop all metric services.

func (*Admin) StartStopMonitoring

func (a *Admin) StartStopMonitoring(action, svcType string) (affected bool, err error)

StartStopMonitoring start/stop system service by its metric type and name.

func (*Admin) Uninstall added in v1.0.6

func (a *Admin) Uninstall() uint16

Uninstall remove all monitoring services with the best effort.

type Collector

type Collector struct {
	CollectorDescription string
	ExecCommand          []string
	OutputFileName       string
}

Collector parameters and description.

func (*Collector) CollectData

func (c *Collector) CollectData() error

CollectData runs a command and collects output into a file.

type Config

type Config struct {
	ServerAddress     string `yaml:"server_address"`
	ClientAddress     string `yaml:"client_address"`
	BindAddress       string `yaml:"bind_address"`
	ClientName        string `yaml:"client_name"`
	MySQLPassword     string `yaml:"mysql_password,omitempty"`
	ServerUser        string `yaml:"server_user,omitempty"`
	ServerPassword    string `yaml:"server_password,omitempty"`
	ServerSSL         bool   `yaml:"server_ssl,omitempty"`
	ServerInsecureSSL bool   `yaml:"server_insecure_ssl,omitempty"`
}

Config pmm.yml config file.

type Errors added in v1.1.2

type Errors []error

func (Errors) Error added in v1.1.2

func (e Errors) Error() string

type ExternalLabelPair added in v1.7.0

type ExternalLabelPair struct {
	Name  string
	Value string
}

type ExternalMetrics added in v1.4.0

type ExternalMetrics struct {
	JobName        string
	ScrapeInterval time.Duration // nanoseconds in JSON
	ScrapeTimeout  time.Duration // nanoseconds in JSON
	MetricsPath    string
	Scheme         string
	Targets        []ExternalTarget
}

ExternalMetrics represents external Prometheus exporter configuration: job and targets. Field names are used for JSON output, so do not rename them. JSON output uses Prometheus and pmm-managed API terms; TUI uses terms aligned with other commands.

type ExternalTarget added in v1.7.0

type ExternalTarget struct {
	Target string
	Labels []ExternalLabelPair
	Health string
}

type List added in v1.4.0

type List struct {
	Version string
	ServerInfo
	Platform         string
	Err              string
	Services         []ServiceStatus
	ExternalErr      string
	ExternalServices []ExternalMetrics
}

func (*List) ExternalTable added in v1.4.0

func (l *List) ExternalTable() string

ExternalTable formats *List.ExternalServices as table and returns result as string.

func (*List) Format added in v1.4.0

func (l *List) Format(format string) string

Format formats *List with provided format template and returns result as string.

func (*List) Table added in v1.4.0

func (l *List) Table() string

Table formats *List.Services as table and returns result as string.

type ServerInfo added in v1.4.0

type ServerInfo struct {
	ServerAddress     string
	ServerSecurity    string
	ClientName        string
	ClientAddress     string
	ClientBindAddress string
}

type ServiceStatus added in v1.4.0

type ServiceStatus struct {
	Type     string
	Name     string
	Port     string
	Running  bool
	DSN      string
	Options  string
	SSL      string
	Password string
}

Service status description.

Jump to

Keyboard shortcuts

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