agents

package
v2.17.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Overview

Package agents provides jobs functionality.

Package agents contains business logic of working with pmm-agent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobsService

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

JobsService provides methods for managing jobs.

func NewJobsService

func NewJobsService(db *reform.DB, registry *Registry) *JobsService

NewJobsService returns new jobs service.

func (*JobsService) StartEchoJob

func (s *JobsService) StartEchoJob(id, pmmAgentID string, timeout time.Duration, message string, delay time.Duration) error

StartEchoJob starts echo job on the pmm-agent.

func (*JobsService) StartMySQLBackupJob

func (s *JobsService) StartMySQLBackupJob(id, pmmAgentID string, timeout time.Duration, name string, dbConfig models.DBConfig, locationConfig models.BackupLocationConfig) error

StartMySQLBackupJob starts mysql backup job on the pmm-agent.

func (*JobsService) StartMySQLRestoreBackupJob

func (s *JobsService) StartMySQLRestoreBackupJob(
	jobID string,
	pmmAgentID string,
	serviceID string,
	timeout time.Duration,
	name string,
	locationConfig models.BackupLocationConfig,
) error

StartMySQLRestoreBackupJob starts mysql restore backup job on the pmm-agent.

func (*JobsService) StopJob

func (s *JobsService) StopJob(jobID string) error

StopJob stops job with given given id.

type Registry

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

Registry keeps track of all connected pmm-agents.

TODO Split into several types https://jira.percona.com/browse/PMM-4932

func NewRegistry

func NewRegistry(db *reform.DB, qanClient qanClient, vmdb prometheusService) *Registry

NewRegistry creates a new registry with given database connection.

func (*Registry) CheckConnectionToService

func (r *Registry) CheckConnectionToService(ctx context.Context, q *reform.Querier, service *models.Service, agent *models.Agent) error

CheckConnectionToService sends request to pmm-agent to check connection to service.

func (*Registry) Collect

func (r *Registry) Collect(ch chan<- prom.Metric)

Collect implement prometheus.Collector.

func (*Registry) Describe

func (r *Registry) Describe(ch chan<- *prom.Desc)

Describe implements prometheus.Collector.

func (*Registry) IsConnected

func (r *Registry) IsConnected(pmmAgentID string) bool

IsConnected returns true if pmm-agent with given ID is currently connected, false otherwise.

func (*Registry) Kick

func (r *Registry) Kick(ctx context.Context, pmmAgentID string)

Kick unregisters and forcefully disconnects pmm-agent with given ID.

func (*Registry) RequestStateUpdate

func (r *Registry) RequestStateUpdate(ctx context.Context, pmmAgentID string)

RequestStateUpdate requests state update on pmm-agent with given ID.

func (*Registry) Run

func (r *Registry) Run(stream agentpb.Agent_ConnectServer) error

Run takes over pmm-agent gRPC stream and runs it until completion.

func (*Registry) StartMongoDBExplainAction

func (r *Registry) StartMongoDBExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string, files map[string]string, tdp *models.DelimiterPair) error

StartMongoDBExplainAction starts MongoDB query explain action on pmm-agent.

func (*Registry) StartMongoDBQueryBuildInfoAction

func (r *Registry) StartMongoDBQueryBuildInfoAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error

StartMongoDBQueryBuildInfoAction starts MongoDB buildInfo query action on pmm-agent.

func (*Registry) StartMongoDBQueryGetCmdLineOptsAction

func (r *Registry) StartMongoDBQueryGetCmdLineOptsAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error

StartMongoDBQueryGetCmdLineOptsAction starts MongoDB getCmdLineOpts query action on pmm-agent.

func (*Registry) StartMongoDBQueryGetParameterAction

func (r *Registry) StartMongoDBQueryGetParameterAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, tdp *models.DelimiterPair) error

StartMongoDBQueryGetParameterAction starts MongoDB getParameter query action on pmm-agent.

func (*Registry) StartMySQLExplainAction

func (r *Registry) StartMySQLExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string, format agentpb.MysqlExplainOutputFormat, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLExplainAction starts MySQL EXPLAIN Action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StartMySQLQuerySelectAction

func (r *Registry) StartMySQLQuerySelectAction(ctx context.Context, id, pmmAgentID, dsn, query string, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLQuerySelectAction starts MySQL SELECT query action on pmm-agent.

func (*Registry) StartMySQLQueryShowAction

func (r *Registry) StartMySQLQueryShowAction(ctx context.Context, id, pmmAgentID, dsn, query string, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLQueryShowAction starts MySQL SHOW query action on pmm-agent.

func (*Registry) StartMySQLShowCreateTableAction

func (r *Registry) StartMySQLShowCreateTableAction(ctx context.Context, id, pmmAgentID, dsn, table string, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLShowCreateTableAction starts mysql-show-create-table action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StartMySQLShowIndexAction

func (r *Registry) StartMySQLShowIndexAction(ctx context.Context, id, pmmAgentID, dsn, table string, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLShowIndexAction starts mysql-show-index action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StartMySQLShowTableStatusAction

func (r *Registry) StartMySQLShowTableStatusAction(ctx context.Context, id, pmmAgentID, dsn, table string, files map[string]string, tdp *models.DelimiterPair, tlsSkipVerify bool) error

StartMySQLShowTableStatusAction starts mysql-show-table-status action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StartPTMongoDBSummaryAction

func (r *Registry) StartPTMongoDBSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, username, password string) error

StartPTMongoDBSummaryAction starts pt-mongodb-summary action on the pmm-agent. The function returns nil if ok, otherwise an error code

func (*Registry) StartPTMySQLSummaryAction

func (r *Registry) StartPTMySQLSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, socket, username, password string) error

StartPTMySQLSummaryAction starts pt-mysql-summary action on the pmm-agent. The pt-mysql-summary's execution may require some of the following params: host, port, socket, username, password.

func (*Registry) StartPTPgSummaryAction

func (r *Registry) StartPTPgSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, username, password string) error

StartPTPgSummaryAction starts pt-pg-summary action on the pmm-agent. The function returns nil if ok, otherwise an error code

func (*Registry) StartPTSummaryAction

func (r *Registry) StartPTSummaryAction(ctx context.Context, id, pmmAgentID string) error

StartPTSummaryAction starts pt-summary action on pmm-agent.

func (*Registry) StartPostgreSQLQuerySelectAction

func (r *Registry) StartPostgreSQLQuerySelectAction(ctx context.Context, id, pmmAgentID, dsn, query string) error

StartPostgreSQLQuerySelectAction starts PostgreSQL SELECT query action on pmm-agent.

func (*Registry) StartPostgreSQLQueryShowAction

func (r *Registry) StartPostgreSQLQueryShowAction(ctx context.Context, id, pmmAgentID, dsn string) error

StartPostgreSQLQueryShowAction starts PostgreSQL SHOW query action on pmm-agent.

func (*Registry) StartPostgreSQLShowCreateTableAction

func (r *Registry) StartPostgreSQLShowCreateTableAction(ctx context.Context, id, pmmAgentID, dsn, table string) error

StartPostgreSQLShowCreateTableAction starts postgresql-show-create-table action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StartPostgreSQLShowIndexAction

func (r *Registry) StartPostgreSQLShowIndexAction(ctx context.Context, id, pmmAgentID, dsn, table string) error

StartPostgreSQLShowIndexAction starts postgresql-show-index action on pmm-agent. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) StopAction

func (r *Registry) StopAction(ctx context.Context, actionID string) error

StopAction stops action with given given id. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932

func (*Registry) UpdateAgentsState

func (r *Registry) UpdateAgentsState(ctx context.Context) error

UpdateAgentsState sends SetStateRequest to all pmm-agents with push metrics agents.

Directories

Path Synopsis
Package channel contains protocol details of two-way communication channel between pmm-managed and pmm-agent.
Package channel contains protocol details of two-way communication channel between pmm-managed and pmm-agent.

Jump to

Keyboard shortcuts

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