Documentation ¶
Index ¶
- Constants
- Variables
- func CheckBinaries() string
- func FileExists(file string) bool
- func GetLocalServices() (services []string)
- func GetServiceDirAndExtension() (dir, extension string)
- func SanitizeDSN(dsn string) 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) 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) AddLinuxMetrics(force bool) error
- func (a *Admin) AddMongoDBMetrics(uri, cluster string) error
- func (a *Admin) AddMongoDBQueries(buildInfo mgo.BuildInfo, uri string) error
- func (a *Admin) AddMySQLMetrics(info map[string]string, mf MySQLFlags) error
- func (a *Admin) AddMySQLQueries(info map[string]string) error
- func (a *Admin) AddProxySQLMetrics(dsn string) error
- func (a *Admin) CheckInstallation() (orphanedServices, missingServices []string)
- func (a *Admin) CheckNetwork() error
- func (a *Admin) DetectMongoDB(uri string) (mgo.BuildInfo, error)
- func (a *Admin) DetectMySQL(mf MySQLFlags) (map[string]string, error)
- func (a *Admin) DetectProxySQL(dsnString string) 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) (uint, 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) RemoveLinuxMetrics() error
- func (a *Admin) RemoveMongoDBMetrics() error
- func (a *Admin) RemoveMongoDBQueries() error
- func (a *Admin) RemoveMySQLMetrics() error
- func (a *Admin) RemoveMySQLQueries() error
- func (a *Admin) RemoveProxySQLMetrics() 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 Config
- type Errors
- type ExternalLabelPair
- type ExternalMetrics
- type ExternalTarget
- type List
- type MySQLFlags
- 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 = "EXPERIMENTAL" // 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.") ErrOneLinux = errors.New("there could be only one instance of linux metrics being monitored for this system.") )
Functions ¶
func CheckBinaries ¶ added in v1.0.4
func CheckBinaries() string
CheckBinaries check if all PMM Client binaries are at their paths
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
}
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 Format string // contains filtered or unexported fields }
Admin main class.
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 (*Admin) AddLinuxMetrics ¶ added in v1.0.4
AddLinuxMetrics add linux service to monitoring.
func (*Admin) AddMongoDBMetrics ¶ added in v1.0.4
AddMongoDBMetrics add mongodb metrics service to monitoring.
func (*Admin) AddMongoDBQueries ¶ added in v1.3.2
AddMongoDBQueries add mongodb instance to Query Analytics.
func (*Admin) AddMySQLMetrics ¶ added in v1.0.4
func (a *Admin) AddMySQLMetrics(info map[string]string, mf MySQLFlags) error
AddMySQLMetrics add mysql metrics service to monitoring.
func (*Admin) AddMySQLQueries ¶ added in v1.0.4
AddMySQLQueries add mysql instance to Query Analytics.
func (*Admin) AddProxySQLMetrics ¶ added in v1.0.5
AddProxySQLMetrics add proxysql service to monitoring.
func (*Admin) CheckInstallation ¶ added in v1.0.5
CheckInstallation check for broken installation.
func (*Admin) CheckNetwork ¶
CheckNetwork check connectivity between client and server.
func (*Admin) DetectMongoDB ¶ added in v1.0.4
DetectMongoDB verifies MongoDB connection.
func (*Admin) DetectMySQL ¶ added in v1.0.4
func (a *Admin) DetectMySQL(mf MySQLFlags) (map[string]string, error)
DetectMySQL detect MySQL, create user if needed, return DSN and MySQL info strings.
func (*Admin) DetectProxySQL ¶ added in v1.0.5
DetectProxySQL verify ProxySQL connection.
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 ¶
LoadConfig read PMM client config file.
func (*Admin) PurgeMetrics ¶ added in v1.0.6
PurgeMetrics purge metrics data on the server by its metric type and name.
func (*Admin) RemoveAllMonitoring ¶ added in v1.0.4
RemoveAllMonitoring remove all the monitoring services.
func (*Admin) RemoveExternalInstances ¶ added in v1.4.0
RemoveExternalInstances removes targets from existing scrape job.
func (*Admin) RemoveExternalMetrics ¶ added in v1.4.0
RemoveExternalMetrics removes external Prometheus scrape job and targets.
func (*Admin) RemoveLinuxMetrics ¶ added in v1.0.4
RemoveLinuxMetrics remove linux service from monitoring.
func (*Admin) RemoveMongoDBMetrics ¶ added in v1.0.4
RemoveMongoDBMetrics remove mongodb metrics service from monitoring.
func (*Admin) RemoveMongoDBQueries ¶ added in v1.3.2
RemoveMongoDBQueries remove mongodb instance from QAN.
func (*Admin) RemoveMySQLMetrics ¶ added in v1.0.4
RemoveMySQLMetrics remove mysql metrics service from monitoring.
func (*Admin) RemoveMySQLQueries ¶ added in v1.0.4
RemoveMySQLQueries remove mysql instance from QAN.
func (*Admin) RemoveProxySQLMetrics ¶ added in v1.0.5
RemoveProxySQLMetrics remove proxysql service from monitoring.
func (*Admin) RepairInstallation ¶ added in v1.0.5
RepairInstallation repair installation.
func (*Admin) ServerInfo ¶ added in v1.0.4
ServerInfo print server info.
func (*Admin) SetAPI ¶
SetAPI setups QAN, Consul, Prometheus, pmm-managed clients and verifies connections.
func (*Admin) ShowPasswords ¶ added in v1.0.7
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 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 ¶ added in v1.7.0
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
ExternalTable formats *List.ExternalServices as table and returns result as string.
type MySQLFlags ¶
type MySQLFlags struct { DefaultsFile string User string Password string Host string Port string Socket string QuerySource string CreateUser bool CreateUserPassword string MaxUserConn uint16 Force bool DisableTableStats bool DisableTableStatsLimit uint16 DisableUserStats bool DisableBinlogStats bool DisableProcesslist bool DisableQueryExamples bool }
MySQLFlags MySQL specific flags.