Documentation ¶
Overview ¶
Package agents provides jobs functionality.
Package agents contains business logic of working with pmm-agent.
Index ¶
- type JobsService
- func (s *JobsService) StartEchoJob(id, pmmAgentID string, timeout time.Duration, message string, ...) error
- func (s *JobsService) StartMySQLBackupJob(id, pmmAgentID string, timeout time.Duration, name string, ...) error
- func (s *JobsService) StartMySQLRestoreBackupJob(jobID string, pmmAgentID string, serviceID string, timeout time.Duration, ...) error
- func (s *JobsService) StopJob(jobID string) error
- type Registry
- func (r *Registry) CheckConnectionToService(ctx context.Context, q *reform.Querier, service *models.Service, ...) error
- func (r *Registry) Collect(ch chan<- prom.Metric)
- func (r *Registry) Describe(ch chan<- *prom.Desc)
- func (r *Registry) IsConnected(pmmAgentID string) bool
- func (r *Registry) Kick(ctx context.Context, pmmAgentID string)
- func (r *Registry) RequestStateUpdate(ctx context.Context, pmmAgentID string)
- func (r *Registry) Run(stream agentpb.Agent_ConnectServer) error
- func (r *Registry) StartMongoDBExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string, ...) error
- func (r *Registry) StartMongoDBQueryBuildInfoAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, ...) error
- func (r *Registry) StartMongoDBQueryGetCmdLineOptsAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, ...) error
- func (r *Registry) StartMongoDBQueryGetParameterAction(ctx context.Context, id, pmmAgentID, dsn string, files map[string]string, ...) error
- func (r *Registry) StartMySQLExplainAction(ctx context.Context, id, pmmAgentID, dsn, query string, ...) error
- func (r *Registry) StartMySQLQuerySelectAction(ctx context.Context, id, pmmAgentID, dsn, query string, ...) error
- func (r *Registry) StartMySQLQueryShowAction(ctx context.Context, id, pmmAgentID, dsn, query string, ...) error
- func (r *Registry) StartMySQLShowCreateTableAction(ctx context.Context, id, pmmAgentID, dsn, table string, ...) error
- func (r *Registry) StartMySQLShowIndexAction(ctx context.Context, id, pmmAgentID, dsn, table string, ...) error
- func (r *Registry) StartMySQLShowTableStatusAction(ctx context.Context, id, pmmAgentID, dsn, table string, ...) error
- func (r *Registry) StartPTMongoDBSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, ...) error
- func (r *Registry) StartPTMySQLSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, ...) error
- func (r *Registry) StartPTPgSummaryAction(ctx context.Context, id, pmmAgentID, address string, port uint16, ...) error
- func (r *Registry) StartPTSummaryAction(ctx context.Context, id, pmmAgentID string) error
- func (r *Registry) StartPostgreSQLQuerySelectAction(ctx context.Context, id, pmmAgentID, dsn, query string) error
- func (r *Registry) StartPostgreSQLQueryShowAction(ctx context.Context, id, pmmAgentID, dsn string) error
- func (r *Registry) StartPostgreSQLShowCreateTableAction(ctx context.Context, id, pmmAgentID, dsn, table string) error
- func (r *Registry) StartPostgreSQLShowIndexAction(ctx context.Context, id, pmmAgentID, dsn, table string) error
- func (r *Registry) StopAction(ctx context.Context, actionID string) error
- func (r *Registry) UpdateAgentsState(ctx context.Context) error
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) IsConnected ¶
IsConnected returns true if pmm-agent with given ID is currently connected, false otherwise.
func (*Registry) RequestStateUpdate ¶
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 ¶
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 ¶
StopAction stops action with given given id. TODO: Extract it from here: https://jira.percona.com/browse/PMM-4932