Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBinaries() string
- func CheckMonitoredDBServices() []string
- func FileExists(file string) bool
- func GetLocalServices() (services []string)
- func GetServiceDirAndExtension() (dir, extension string)
- type API
- func (a *API) Delete(url string) (*http.Response, []byte, error)
- func (a *API) Error(method, url string, gotStatusCode, expectedStatusCode int, content []byte) error
- func (a *API) Get(url string) (*http.Response, []byte, error)
- func (a *API) Hostname() string
- func (a *API) NewClient() *http.Client
- func (a *API) Ping(url string) error
- func (a *API) Post(url string, data []byte) (*http.Response, []byte, error)
- func (a *API) Put(url string, data []byte) (*http.Response, []byte, error)
- func (a *API) URL(paths ...string) string
- type Admin
- func (a *Admin) AddAnnotation(ctx context.Context, text string, tags string) error
- func (a *Admin) AddExternalInstances(ctx context.Context, name string, targets []ExternalTarget, ...) error
- func (a *Admin) AddExternalMetrics(ctx context.Context, ext *ExternalMetrics, checkReachability bool) error
- func (a *Admin) AddExternalService(ctx context.Context, ext *ExternalMetrics, force bool) error
- func (a *Admin) AddMetrics(ctx context.Context, m plugin.Metrics, force bool, disableSSL bool) (*plugin.Info, error)
- func (a *Admin) AddQueries(ctx context.Context, q plugin.Queries) (*plugin.Info, error)
- func (a *Admin) CheckInstallation() (orphanedServices, missingServices []string)
- func (a *Admin) CheckNetwork() error
- func (a *Admin) CheckVersion(ctx context.Context) (fatal bool, err error)
- func (a *Admin) CollectSummary() error
- func (a *Admin) List() error
- func (a *Admin) ListExternalMetrics(ctx context.Context) ([]ExternalMetrics, error)
- func (a *Admin) LoadConfig() error
- func (a *Admin) PrintInfo()
- func (a *Admin) PurgeMetrics(svcType string) error
- func (a *Admin) RemoveAllMonitoring(ignoreErrors bool) (uint16, error)
- func (a *Admin) RemoveExternalInstances(ctx context.Context, name string, targets []string) error
- func (a *Admin) RemoveExternalMetrics(ctx context.Context, name string) error
- func (a *Admin) RemoveMetrics(name string) error
- func (a *Admin) RemoveQueries(name string) error
- func (a *Admin) RepairInstallation() error
- func (a *Admin) ServerInfo() error
- func (a *Admin) SetAPI() error
- func (a *Admin) SetConfig(cf Config, flagForce bool) error
- func (a *Admin) ShowPasswords()
- func (a *Admin) StartStopAllMonitoring(action string) (numOfAffected, numOfAll int, err error)
- func (a *Admin) StartStopMonitoring(action, svcType string) (affected bool, err error)
- func (a *Admin) Uninstall() uint16
- type Collector
- type Config
- type Errors
- type ExternalLabelPair
- type ExternalMetrics
- type ExternalTarget
- type List
- type ServerInfo
- type ServiceStatus
Constants ¶
const ( ServerInfoTemplate = `` /* 228-byte string literal not displayed */ DefaultServerInfoTemplate = `{{template "ServerInfo" .}} ` )
const (
DefaultListTemplate = `` /* 268-byte string literal not displayed */
)
each non-empty field value must end with newline
const (
NameRegex = `^[-\w:\.]{2,60}$`
)
Variables ¶
var ( // you can use `-ldflags -X github.com/percona/pmm-client/pmm.Version=` // to set build version number Version = "1.17.4" // 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.") )
Functions ¶
func CheckBinaries ¶
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 GetLocalServices ¶
func GetLocalServices() (services []string)
GetLocalServices finds any local PMM services
func GetServiceDirAndExtension ¶
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
}
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 ¶
AddAnnotation posts annotation to managed.
func (*Admin) AddExternalInstances ¶
func (a *Admin) AddExternalInstances(ctx context.Context, name string, targets []ExternalTarget, checkReachability bool) error
AddExternalInstances adds targets to existing scrape job.
func (*Admin) AddExternalMetrics ¶
func (a *Admin) AddExternalMetrics(ctx context.Context, ext *ExternalMetrics, checkReachability bool) error
AddExternalMetrics adds external Prometheus scrape job and targets.
func (*Admin) AddExternalService ¶
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 ¶
AddQueries add instance to Query Analytics.
func (*Admin) CheckInstallation ¶
CheckInstallation check for broken installation.
func (*Admin) CheckNetwork ¶
CheckNetwork check connectivity between client and server.
func (*Admin) CheckVersion ¶
CheckVersion check server and client versions and returns boolean and error; boolean is true if error is fatal.
func (*Admin) CollectSummary ¶
CollectSummary get output of system and pmm utilites.
func (*Admin) ListExternalMetrics ¶
func (a *Admin) ListExternalMetrics(ctx context.Context) ([]ExternalMetrics, error)
ListExternalMetrics returns external Prometheus exporters.
func (*Admin) LoadConfig ¶
LoadConfig read PMM client config file.
func (*Admin) PurgeMetrics ¶
PurgeMetrics purge metrics data on the server by its metric type and name.
func (*Admin) RemoveAllMonitoring ¶
RemoveAllMonitoring remove all the monitoring services.
func (*Admin) RemoveExternalInstances ¶
RemoveExternalInstances removes targets from existing scrape job.
func (*Admin) RemoveExternalMetrics ¶
RemoveExternalMetrics removes external Prometheus scrape job and targets.
func (*Admin) RemoveMetrics ¶
RemoveMetrics remove metrics service from monitoring.
func (*Admin) RemoveQueries ¶
RemoveQueries remove instance from QAN.
func (*Admin) RepairInstallation ¶
RepairInstallation repair installation.
func (*Admin) SetAPI ¶
SetAPI setups QAN, Consul, Prometheus, pmm-managed clients and verifies connections.
func (*Admin) ShowPasswords ¶
func (a *Admin) ShowPasswords()
ShowPasswords display passwords from config file.
func (*Admin) StartStopAllMonitoring ¶
StartStopAllMonitoring start/stop all metric services.
func (*Admin) StartStopMonitoring ¶
StartStopMonitoring start/stop system service by its metric type and name.
type Collector ¶
Collector parameters and description.
func (*Collector) CollectData ¶
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 ExternalLabelPair ¶
type ExternalMetrics ¶
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 ¶
type ExternalTarget struct { Target string Labels []ExternalLabelPair Health string }
type List ¶
type List struct { Version string ServerInfo Platform string Err string Services []ServiceStatus ExternalErr string ExternalServices []ExternalMetrics }
func (*List) ExternalTable ¶
ExternalTable formats *List.ExternalServices as table and returns result as string.