healthcheck

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationMySQLRepo added in v1.1.0

type ApplicationMySQLRepo interface {
	// Close closes the mysql connection
	Close() error
	// GetVariables gets the database variables by items
	GetVariables(items []string) ([]Variable, error)
	// GetMySQLDirs gets the mysql data directory and binlog directory
	GetMySQLDirs() ([]string, error)
	// GetLargeTables gets the tables
	GetLargeTables() ([]Table, error)
	// GetDBName gets the db name of given table names
	GetDBName(tableNames []string) (string, error)
}

type DASRepo added in v1.1.0

type DASRepo interface {
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (middleware.Result, error)
	// Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
	Transaction() (middleware.Transaction, error)
	// GetOperationHistories gets operation histories from the middleware
	GetHealthCheckHistories(mysqlServerIDList []int, limit int) ([]OperationHistory, error)
	// LoadEngineConfig loads engine config from the middleware
	LoadEngineConfig() (EngineConfig, error)
	// GetResultByOperationID returns the result
	GetResultByOperationID(operationID int) (Result, error)
	// IsRunning returns if the healthcheck of given mysql server is still running
	IsRunning(mysqlServerID int) (bool, error)
	// InitOperation initiates the operation
	InitOperation(userID, mysqlServerID int, startTime, endTime time.Time, step time.Duration) (int, error)
	// UpdateOperationStatus updates operation status
	UpdateOperationStatus(operationID int, status int, message string) error
	// SaveResult saves result into the middleware
	SaveResult(result Result) error
	// UpdateAccuracyReviewByOperationID updates the accuracy review
	UpdateAccuracyReviewByOperationID(operationID int, review int) error
}

type Engine

type Engine interface {
	// GetOperationInfo returns the operation information
	GetOperationInfo() OperationInfo
	// Run checks the server health status
	Run()
}

type EngineConfig added in v1.1.0

type EngineConfig interface {
	// GetItemConfig returns the item config
	GetItemConfig(item string) ItemConfig
	// SetItemConfig sets item config with given item and config
	SetItemConfig(item string, config ItemConfig)
	// Validate validates if engine configuration is valid
	Validate() error
}

type FileSystem added in v1.1.0

type FileSystem interface {
	GetMountPoint() string
	GetDevice() string
}

type ItemConfig added in v1.1.0

type ItemConfig interface {
	// GetID returns the identity
	GetID() int
	// GetItemName returns the item name
	GetItemName() string
	// GetItemWeight returns the item weight
	GetItemWeight() int
	// GetLowWatermark returns the low watermark
	GetLowWatermark() float64
	// GetHighWatermark returns the high watermark
	GetHighWatermark() float64
	// GetUnit returns the unit
	GetUnit() float64
	// GetScoreDeductionPerUnitHigh returns the score deduction per unit high
	GetScoreDeductionPerUnitHigh() float64
	// GetMaxScoreDeductionHigh returns the max score deduction high
	GetMaxScoreDeductionHigh() float64
	// GetScoreDeductionPerUnitMedium returns the score deduction per unit medium
	GetScoreDeductionPerUnitMedium() float64
	// GetMaxScoreDeductionMedium returns the max score deduction medium
	GetMaxScoreDeductionMedium() float64
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
}

type OperationHistory added in v1.1.1

type OperationHistory interface {
	// GetID returns the identity
	GetID() int
	// GetUserID returns the user id
	GetUserID() int
	// GetAccountName returns the user account name
	GetAccountName() string
	// GetMySQLServerID returns the mysql server id
	GetMySQLServerID() int
	// GetHostIP returns the host ip of mysql server
	GetHostIP() string
	// GetPortNum returns the port number of mysql server
	GetPortNum() int
	// GetStartTime returns the start time
	GetStartTime() time.Time
	// GetEndTime returns the end time
	GetEndTime() time.Time
	// GetStep returns the step, the unit is seconds
	GetStep() int
	// GetStatus returns the status
	GetStatus() int
	// GetMessage returns the message
	GetMessage() string
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
}

type OperationInfo added in v1.1.0

type OperationInfo interface {
	// GetOperationID returns the operation identity
	GetOperationID() int
	// GetUser returns the user
	GetUser() metadata.User
	// GetApps returns the apps
	GetApps() []metadata.App
	// GetMySQLServer returns the mysql server
	GetMySQLServer() metadata.MySQLServer
	// GetMonitorSystem returns the monitor system
	GetMonitorSystem() metadata.MonitorSystem
	// GetStartTime returns the start time
	GetStartTime() time.Time
	// GetEndTime returns the end time
	GetEndTime() time.Time
	// GetStep returns the step
	GetStep() time.Duration
	// GetAppName returns the app name in string, it will concat all the app names with comma
	GetAppName() string
}

type PrometheusData added in v1.1.0

type PrometheusData interface {
	// GetTimestamp returns the timestamp
	GetTimestamp() string
	// GetValue returns the value
	GetValue() float64
}

type PrometheusRepo added in v1.1.0

type PrometheusRepo interface {
	// GetFileSystems gets the file systems from the prometheus
	GetFileSystems() ([]FileSystem, error)
	// GetAvgBackupFailedRatio gets the average backup failed ratio
	GetAvgBackupFailedRatio() ([]PrometheusData, error)
	// GetStatisticFailedRatio gets the statistic failed ratio
	GetStatisticFailedRatio() ([]PrometheusData, error)
	// GetCPUUsage gets the cpu usage
	GetCPUUsage() ([]PrometheusData, error)
	// GetIOUtil gets the io util
	GetIOUtil() ([]PrometheusData, error)
	// GetDiskCapacityUsage gets the disk capacity usage
	GetDiskCapacityUsage(mountPoints []string) ([]PrometheusData, error)
	// GetConnectionUsage gets the connection usage
	GetConnectionUsage() ([]PrometheusData, error)
	// GetAverageActiveSessionPercents gets the average active session percents
	GetAverageActiveSessionPercents() ([]PrometheusData, error)
	// GetCacheMissRatio gets the cache miss ratio
	GetCacheMissRatio() ([]PrometheusData, error)
}

type QueryRepo added in v1.1.0

type QueryRepo interface {
	// Close closes the mysql or clickhouse connection
	Close() error
	// GetSlowQuery gets the slow query
	GetSlowQuery() ([]depquery.Query, error)
}

type Result

type Result interface {
	// Identity returns the identity
	Identity() int
	// GetOperationID returns the operation id
	GetOperationID() int
	// GetHostIP returns the host ip
	GetHostIP() string
	// GetPortNum returns the port number
	GetPortNum() int
	// GetWeightedAverageScore returns the weighted average score
	GetWeightedAverageScore() int
	// GetDBConfigScore returns the database configuration score
	GetDBConfigScore() int
	// GetDBConfigData returns the database configuration data
	GetDBConfigData() string
	// GetDBConfigAdvice returns the database configuration advice
	GetDBConfigAdvice() string
	// GetAvgBackupFailedRatioScore returns the average backup failed ratio score
	GetAvgBackupFailedRatioScore() int
	// GetAvgBackupFailedRatioData returns the average backup failed ratio data
	GetAvgBackupFailedRatioData() string
	// GetAvgBackupFailedRatioHigh returns the high average backup failed ratio data
	GetAvgBackupFailedRatioHigh() string
	// GetStatisticFailedRatioScore returns the statistic failed ratio score
	GetStatisticFailedRatioScore() int
	// GetStatisticFailedRatioData returns the statistic failed ratio data
	GetStatisticFailedRatioData() string
	// GetStatisticFailedRatioHigh returns the high statistic failed ratio data
	GetStatisticFailedRatioHigh() string
	// GetCPUUsageScore returns the cpu usage score
	GetCPUUsageScore() int
	// GetCPUUsageData returns the cpu usage data
	GetCPUUsageData() string
	// GetCPUUsageHigh returns the high cpu usage data
	GetCPUUsageHigh() string
	// GetIOUtilScore returns the io util score
	GetIOUtilScore() int
	// GetIOUtilData returns the io util data
	GetIOUtilData() string
	// GetIOUtilHigh returns the high io util data
	GetIOUtilHigh() string
	// GetDiskCapacityUsageScore returns the disk capacity usage score
	GetDiskCapacityUsageScore() int
	// GetDiskCapacityUsageData returns the disk capacity usage data
	GetDiskCapacityUsageData() string
	// GetDiskCapacityUsageHigh returns the high disk capacity usage data
	GetDiskCapacityUsageHigh() string
	// GetConnectionUsageScore returns the connection usage score
	GetConnectionUsageScore() int
	// GetConnectionUsageData returns the connection usage data
	GetConnectionUsageData() string
	// GetConnectionUsageHigh returns the high connection usage data
	GetConnectionUsageHigh() string
	// GetAverageActiveSessionPercentsScore returns the average active session number score
	GetAverageActiveSessionPercentsScore() int
	// GetAverageActiveSessionPercentsData returns the average active session number data
	GetAverageActiveSessionPercentsData() string
	// GetAverageActiveSessionPercentsHigh returns the high average active session number data
	GetAverageActiveSessionPercentsHigh() string
	// GetCacheHitRatioScore returns the cache miss ratio score
	GetCacheMissRatioScore() int
	// GetCacheHitRatioData returns the cache miss ratio data
	GetCacheMissRatioData() string
	// GetCacheMissRatioHigh returns the high cache miss ratio data
	GetCacheMissRatioHigh() string
	// GetTableRowsScore returns the table rows score
	GetTableRowsScore() int
	// GetTableRowsData returns the table rows data
	GetTableRowsData() string
	// GetTableRowsHigh returns the high table rows data
	GetTableRowsHigh() string
	// GetTableSizeScore returns the table size score
	GetTableSizeScore() int
	// GetTableSizeData returns the table size data
	GetTableSizeData() string
	// GetTableSizeHigh returns the high table size data
	GetTableSizeHigh() string
	// GetSlowQueryScore returns the slow query score
	GetSlowQueryScore() int
	// GetSlowQueryData returns the slow query data
	GetSlowQueryData() string
	// GetSlowQueryAdvice returns the slow query advice
	GetSlowQueryAdvice() string
	// GetAccuracyReview returns the accuracy review
	GetAccuracyReview() int
	// GetDelFlag returns the delete flag
	GetDelFlag() int
	// GetCreateTime returns the create time
	GetCreateTime() time.Time
	// GetLastUpdateTime returns the last update time
	GetLastUpdateTime() time.Time
	// String returns the string value of the result
	String() string
	// Set sets health check with given fields, key is the field name and value is the relevant value of the key
	Set(fields map[string]interface{}) error
	// MarshalJSON marshals Result to json string
	MarshalJSON() ([]byte, error)
	// MarshalJSON marshals only specified field of the Result to json string
	MarshalJSONWithFields(fields ...string) ([]byte, error)
}

type Service

type Service interface {
	// GetDASRepo returns the das repository
	GetDASRepo() DASRepo
	// GetOperationInfo returns the operation information
	GetOperationInfo() OperationInfo
	// GetEngine returns the healthcheck engine
	GetEngine() Engine
	// GetOperationHistories returns the operation histories
	GetOperationHistories() []OperationHistory
	// GetResult returns the result
	GetResult() Result
	// GetOperationHistoriesByLoginName returns the operation histories by login name
	GetOperationHistoriesByLoginName(loginName string) error
	// GetResultByOperationID gets the result by operation id from the middleware
	GetResultByOperationID(id int) error
	// Check checks the server health status
	Check(mysqlServerID int, startTime, endTime time.Time, step time.Duration, loginName string) (int, error)
	// Check checks the server health status
	CheckByHostInfo(hostIP string, portNum int, startTime, endTime time.Time, step time.Duration, loginName string) (int, error)
	// ReviewAccuracy reviews the accuracy of the check
	ReviewAccuracy(id, review int) error
	// Marshal marshals Service to json string
	Marshal() ([]byte, error)
	// MarshalWithFields marshals only specified field of the Service to json string
	MarshalWithFields(fields ...string) ([]byte, error)
}

type Table added in v1.1.0

type Table interface {
	// GetSchema returns the table schema
	GetSchema() string
	// GetName returns the table name
	GetName() string
	// GetRows returns the table rows
	GetRows() int
	// GetSize returns the table size
	GetSize() float64
}

type Variable added in v1.1.0

type Variable interface {
	// GetName returns the name of the variable
	GetName() string
	// GetName returns the value of the variable
	GetValue() string
}

Jump to

Keyboard shortcuts

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