agent

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYSTEM_LOG_EXPIRATION_DAYS         = "system.log.expiration.days"
	DEFAULT_SYSTEM_LOG_EXPIRATION_DAYS = 30

	SYSTEM_ALERT_EXPIRATION_DAYS         = "system.alert.expiration.days"
	DEFAULT_SYSTEM_ALERT_EXPIRATION_DAYS = 30
)
View Source
const (
	ALERT_REQUEST_ID = "alert"

	CLEAR_ALERT_INTERVAL = 1 * time.Hour

	ALERT_CLUSTER               = "cluster"
	ALERT_SPACE                 = "space"
	ALERT_ETCD                  = "etcd"
	ALERT_MDS                   = "mds"
	ALERT_CHUNKSERVER           = "chunkserver"
	ALERT_SNAPSHOT_CLONE_SERVER = "snapshotcloneserver"

	UPDATE_ALERT_CONF_INTERVAL_SEC = 1 * 30

	CLUSTER_ALERT_INTERVAL_SEC  = 1 * 60
	CLUSTER_ALERT_TRIGGER_TIMES = 3
	CLUSTER_ALERT_RULE          = "cluster is not healthy"
	CLUSTER_ALERT_DESC          = "check cluster healthy"

	CAPACITY_ALERT_INTERVAL_SEC  = 1 * 60 * 60
	CAPACITY_ALERT_TRIGGER_TIMES = 1
	CAPACITY_ALERT_LIMIT_PERCENT = 80
	CAPACITY_ALERT_DESC          = "check cluster space used"

	SERVICE_ALERT_INTERVAL_SEC  = 1 * 60
	SERVICE_ALERT_TRIGGER_TIMES = 1
	SERVICE_ALERT_RULE          = "leaderNum != 1 or offlineNum > 0"
	SERVICE_ALERT_DESC          = "check service status"
)
View Source
const (
	// copyset status check result
	COPYSET_CHECK_HEALTHY               = "healthy"
	COPYSET_CHECK_PARSE_ERROR           = "parse_error"
	COPYSET_CHECK_NO_LEADER             = "no leader"
	COPYSET_CHECK_PEERS_NO_SUFFICIENT   = "peers_no_sufficient"
	COPYSET_CHECK_LOG_INDEX_TOO_BIG     = "log_index_gap_too_big"
	COPYSET_CHECK_INSTALLING_SNAPSHOT   = "installing_snapshot"
	COPYSET_CHECK_MINORITY_PEER_OFFLINE = "minority_peer_offline"
	COPYSET_CHECK_MAJORITY_PEER_OFFLINE = "majority_peer_offline"
	COPYSET_CHECK_INCONSISTENT          = "Three copies inconsistent"
	COPYSET_CHECK_OTHER_ERROR           = "other_error"
	COPYSET_TOTAL                       = "total"
)
View Source
const (
	CURVEADM_SERVICE_ADDRESS = "curveadm.service.address"

	CLUSTER_SERVICES_ADDRESS = "cluster.service.addr"

	METHOD_DEPLOY_CLUSTER   = "cluster.deploy"
	METHOD_CHECKOUT_CLUSTER = "cluster.checkout"
)
View Source
const (
	// node disk info
	DEVICE = "device"
	MODEL  = "model"

	// request
	GET_DISK_FILESYSTEM_INFO         = "GetDiskFileSystemInfo"
	GET_DISK_TYPE                    = "GetDiskType"
	GET_DISK_WRITE_CACHE_ENABLE_FLAG = "GetDiskWriteCacheEnableFlag"
)
View Source
const (
	// request
	GET_HOST_INFO             = "GetHostInfo"
	GET_HOST_CPU_INFO         = "GetHostCPUInfo"
	GET_HOST_MEM_INFO         = "GetHostMemoryInfo"
	LIST_DISK_INFO            = "ListDiskInfo"
	GET_HOST_CPU_UTILIZATION  = "GetHostCPUUtilization"
	GET_HOST_MEM_UTILIZATION  = "GetHostMemUtilization"
	GET_HOST_DISK_PERFORMANCE = "GetDiskPerformance"
	GET_HOST_NETWORK_TRAFFIC  = "GetNetWorkTraffic"
)
View Source
const (
	WRITE_SYSTEM_LOG_INTERVAL = 1 * time.Second
	CLEAR_SYSTEM_LOG_INTERVAL = 1 * time.Hour
)
View Source
const (
	SERVICE_ETCD                  = "etcd"
	SERVICE_MDS                   = "mds"
	SERVICE_CHUNKSERVER           = "chunkserver"
	SERVICE_SNAPSHOT_CLONE_SERVER = "snapshotcloneserver"
)
View Source
const (
	ROOT_DIR        = "/"
	RECYCLEBIN_NAME = "RecycleBin"
	CLONE_NAME      = "clone"

	ORDER_BY_ID              = "id"
	ORDER_BY_CTIME           = "ctime"
	ORDER_BY_LENGTH          = "length"
	ORDER_DIRECTION_INCREASE = 1
	ORDER_DIRECTION_DECREASE = -1

	FILE_NOT_EXIST = "kFileNotExists"
	PARAM_ERROR    = "kParaError"
)
View Source
const (
	ENABLE_MULTIPLE_WRITER_USER_LOGIN = "enable.multiple.write.user.login"
)

Variables

View Source
var (
	READ_PERM    = 4
	WRITE_PERM   = 2
	MANAGER_PERM = 1
)
View Source
var RECYCLEBIN_DIR = path.Join(ROOT_DIR, RECYCLEBIN_NAME)

Functions

func CancelSnapshot

func CancelSnapshot(r *pigeon.Request, snapshots []Snapshot) errno.Errno

func ChangePassWord

func ChangePassWord(r *pigeon.Request, oldPassword, newPassword string) errno.Errno

func CleanRecycleBin

func CleanRecycleBin(r *pigeon.Request, expiration uint64) errno.Errno

func CloneVolume

func CloneVolume(r *pigeon.Request, src, dest, user string, lazy bool) errno.Errno

func CreateNameSpace

func CreateNameSpace(r *pigeon.Request, name, user, passwrord string) errno.Errno

func CreateSnapshot

func CreateSnapshot(r *pigeon.Request, volumeName, user, snapshotName string) errno.Errno

func CreateUser

func CreateUser(r *pigeon.Request, name, passwd, email string, permission int) errno.Errno

func CreateVolume

func CreateVolume(r *pigeon.Request, name, user string, passwrord string, length, stripUnit, stripCount uint64) errno.Errno

func DeleteSnapshot

func DeleteSnapshot(r *pigeon.Request, fileName, user string, uuids []string, failed bool) errno.Errno

func DeleteUser

func DeleteUser(r *pigeon.Request, name string) errno.Errno

func DeleteVolume

func DeleteVolume(r *pigeon.Request, volumes map[string]string, force bool) errno.Errno

func ExtendVolume

func ExtendVolume(r *pigeon.Request, name string, length uint64) errno.Errno

func Flatten

func Flatten(r *pigeon.Request, volumeName, user string) errno.Errno

func GetAlertCandidate

func GetAlertCandidate(r *pigeon.Request) (interface{}, errno.Errno)

func GetAlertConf

func GetAlertConf(r *pigeon.Request) (interface{}, errno.Errno)

func GetChunkServerStatus

func GetChunkServerStatus(l *pigeon.Logger, rId string) (interface{}, errno.Errno)

func GetClusterPerformance

func GetClusterPerformance(r *pigeon.Request, start, end, interval uint64) (interface{}, errno.Errno)

func GetClusterSpace

func GetClusterSpace(l *pigeon.Logger, rId string) (interface{}, errno.Errno)

func GetClusterSpaceTrend

func GetClusterSpaceTrend(r *pigeon.Request, start, end, interval uint64) (interface{}, errno.Errno)

func GetClusterStatus

func GetClusterStatus(l *pigeon.Logger, rId string) interface{}

func GetCurrentClusterServicesAddr

func GetCurrentClusterServicesAddr() (clusterServicesAddr, error)

func GetEtcdStatus

func GetEtcdStatus(r *pigeon.Request) (interface{}, errno.Errno)

func GetHost

func GetHost(r *pigeon.Request, hostname string, start, end, interval uint64) (interface{}, errno.Errno)

func GetLogicalPool

func GetLogicalPool(r *pigeon.Request, poolId uint32, start, end, interval uint64) (interface{}, errno.Errno)

func GetMdsStatus

func GetMdsStatus(r *pigeon.Request) (interface{}, errno.Errno)

func GetSnapShotCloneServerStatus

func GetSnapShotCloneServerStatus(r *pigeon.Request) (interface{}, errno.Errno)

func GetSnapshot

func GetSnapshot(r *pigeon.Request, size, page uint32, uuid, user, fileName, status string) (interface{}, errno.Errno)

func GetSysAlert

func GetSysAlert(r *pigeon.Request, start, end int64, page, size uint32, name, level, content string) (interface{}, errno.Errno)

func GetSysLog

func GetSysLog(r *pigeon.Request, start, end int64, page, size uint32, filter string) (interface{}, errno.Errno)

func GetUnreadSysAlertNum

func GetUnreadSysAlertNum(r *pigeon.Request) (int64, errno.Errno)

func GetUser

func GetUser(r *pigeon.Request) (interface{}, errno.Errno)

func GetVolume

func GetVolume(r *pigeon.Request, volumeName string, start, end, interval uint64) (interface{}, errno.Errno)

func Init

func Init(cfg *pigeon.Configure, logger *pigeon.Logger) error

func InitClients

func InitClients(logger *pigeon.Logger) error

func ListDisk

func ListDisk(r *pigeon.Request, size, page uint32, hostname string) (interface{}, errno.Errno)

func ListHost

func ListHost(r *pigeon.Request, size, page uint32) (interface{}, errno.Errno)

func ListLogicalPool

func ListLogicalPool(r *pigeon.Request) (interface{}, errno.Errno)

func ListTopology

func ListTopology(r *pigeon.Request) (interface{}, errno.Errno)

func ListUser

func ListUser(r *pigeon.Request, size, page uint32, userName string) (interface{}, errno.Errno)

func ListVolume

func ListVolume(r *pigeon.Request, size, page uint32, path, key string, direction int) (interface{}, errno.Errno)

func Login

func Login(r *pigeon.Request, name, passwd string) (interface{}, errno.Errno)

func Logout

func Logout(r *pigeon.Request) errno.Errno

func ProxyPass

func ProxyPass(r *pigeon.Request, body interface{}, method string) bool

func RecoverVolume

func RecoverVolume(r *pigeon.Request, ids map[string]uint64) errno.Errno

func ResetPassWord

func ResetPassWord(r *pigeon.Request, name string) errno.Errno

func UpdateAlertConf

func UpdateAlertConf(r *pigeon.Request, enable bool, interval, times uint32,
	rule, name string, alertUsers []string) errno.Errno

func UpdateAlertUser

func UpdateAlertUser(r *pigeon.Request, alert string, users []string) errno.Errno

func UpdateReadSysAlertId

func UpdateReadSysAlertId(r *pigeon.Request, id int64) errno.Errno

func UpdateUserEmail

func UpdateUserEmail(r *pigeon.Request, email string) errno.Errno

func UpdateUserPermission

func UpdateUserPermission(r *pigeon.Request, name string, permission int) errno.Errno

func VolumeThrottle

func VolumeThrottle(r *pigeon.Request, name, throttleType string, limit, burst, burstLength uint64) errno.Errno

func WriteSystemLog

func WriteSystemLog(ip, user, module, method, error_msg, content string, error_code int)

Types

type Alert

type Alert interface {
	// contains filtered or unexported methods
}

type AlertConf

type AlertConf struct {
	Name       string   `json:"name"`
	Level      string   `json:"level"`
	Interval   uint32   `json:"interval"`
	Times      uint32   `json:"times"`
	Enable     bool     `json:"enable"`
	Rule       string   `json:"rule"`
	Desc       string   `json:"desc"`
	AlertUsers []string `json:"alertUsers"`
}

type AuthInfo

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

type ChunkServerStatus

type ChunkServerStatus struct {
	TotalNum   int          `json:"totalNum"`
	OnlineNum  int          `json:"onlineNum"`
	Versions   []VersionNum `json:"versions"`
	NotOnlines []string     `json:"-"`
}

type ClusterStatus

type ClusterStatus struct {
	Healthy    bool       `json:"healthy" binding:"required"`
	PoolNum    uint32     `json:"poolNum" binding:"required"`
	CopysetNum CopysetNum `json:"copysetNum" binding:"required"`
}

type Copyset

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

func NewCopyset

func NewCopyset() *Copyset

type CopysetNum

type CopysetNum struct {
	Total     uint32 `json:"total" binding:"required"`
	Unhealthy uint32 `json:"unhealthy" binding:"required"`
}

type DiskInfo

type DiskInfo struct {
	HostName   string `json:"hostName" binding:"required"`
	Device     string `json:"device" binding:"required"`
	DiskType   string `json:"diskType" binding:"required"`
	Model      string `json:"model" binding:"required"`
	WriteCache string `json:"writeCache"`
	MountPoint string `json:"mountPoint"`
	SpaceTotal uint32 `json:"spaceTotal"`
	SpaceUsed  uint32 `json:"spaceUsed"`
}

type HostInfo

type HostInfo struct {
	HostName string            `json:"hostName" binding:"required"`
	IP       string            `json:"ip" binding:"required"`
	Machine  string            `json:"machine" binding:"required"`
	Release  string            `json:"kernelRelease" binding:"required"`
	Version  string            `json:"kernelVersion" binding:"required"`
	System   string            `json:"operatingSystem" binding:"required"`
	CPUCores metricomm.CPUInfo `json:"cpuCores" binding:"required"`
	DiskNum  uint32            `json:"diskNum" binding:"required"`

	MemoryTotal uint64 `json:"memory" binding:"required"`
	// contains filtered or unexported fields
}

type HostInfoWithPerformance

type HostInfoWithPerformance struct {
	Host            HostInfo                           `json:"host" binding:"required"`
	CPUUtilization  []metricomm.RangeMetricItem        `json:"cpuUtilization" binding:"required"`
	MemUtilization  []metricomm.RangeMetricItem        `json:"memUtilization" binding:"required"`
	DiskPerformance map[string][]metricomm.Performance `json:"diskPerformance" binding:"required"`
	NetWorkTraffic  NetWorkTraffic                     `json:"networkTraffic" binding:"required"`
}

type ListDiskInfo

type ListDiskInfo struct {
	Total int        `json:"total" binding:"required"`
	Info  []DiskInfo `json:"info" binding:"required"`
}

type ListHostInfo

type ListHostInfo struct {
	Total int        `json:"total" binding:"required"`
	Info  []HostInfo `json:"info" binding:"required"`
}

type ListUserInfo

type ListUserInfo struct {
	Total int        `json:"total" binding:"required"`
	Info  []UserInfo `json:"info" binding:"required"`
}

type ListVolumeInfo

type ListVolumeInfo struct {
	Total int                `json:"total" binding:"required"`
	Info  []curvebs.FileInfo `json:"info" binding:"required"`
}

type NetWorkTraffic

type NetWorkTraffic struct {
	NetWorkReceive  map[string][]metricomm.RangeMetricItem `json:"receive" binding:"required"`
	NetWorkTransmit map[string][]metricomm.RangeMetricItem `json:"transmit" binding:"required"`
}

type Pool

type Pool struct {
	Id    uint32 `json:"id" binding:"required"`
	Name  string `json:"name" binding:"required"`
	Type  string `json:"type" binding:"required"`
	Zones []Zone `json:"zones" binding:"required"`
	// contains filtered or unexported fields
}

type PoolInfo

type PoolInfo struct {
	Id             uint32 `json:"id" binding:"required"`
	Name           string `json:"name" binding:"required"`
	PhysicalPoolId uint32 `json:"physicalPoolId" binding:"required"`
	Type           string `json:"type" binding:"required"`
	CreateTime     string `json:"createTime" binding:"required"`
	AllocateStatus string `json:"allocateStatus" binding:"required"`
	ScanEnable     bool   `json:"scanEnable"`
	ServerNum      uint32 `json:"serverNum" binding:"required"`
	ChunkServerNum uint32 `json:"chunkServerNum" binding:"required"`
	CopysetNum     uint32 `json:"copysetNum" binding:"required"`
	Space          Space  `json:"space" binding:"required"`
}

type PoolInfoWithPerformance

type PoolInfoWithPerformance struct {
	Info        PoolInfo                `json:"info" binding:"required"`
	Performance []metricomm.Performance `json:"performance" binding:"required"`
}

type Server

type Server struct {
	Id           uint32                `json:"id" binding:"required"`
	Hostname     string                `json:"hostname" binding:"required"`
	InternalIp   string                `json:"internalIp" binding:"required"`
	InternalPort uint32                `json:"internalPort" binding:"required"`
	ExternalIp   string                `json:"externalIp" binding:"required"`
	ExternalPort uint32                `json:"externalPort" binding:"required"`
	ChunkServers []curvebs.ChunkServer `json:"chunkservers" binding:"required"`
}

type Snapshot

type Snapshot struct {
	UUID       string `json:"uuid" binding:"required"`
	User       string `json:"user" binding:"required"`
	VolumeName string `json:"volumeName" binding:"required"`
}

type Space

type Space struct {
	Total       uint64 `json:"total" binding:"required"`
	Alloc       uint64 `json:"alloc" binding:"required"`
	CanRecycled uint64 `json:"canRecycled" binding:"required"`
}

type UserInfo

type UserInfo struct {
	UserName   string `json:"userName" binding:"required"`
	Email      string `json:"email"`
	Permission int    `json:"permission" binding:"required"`
}

type VersionNum

type VersionNum struct {
	Version string `json:"version"`
	Number  int    `json:"number"`
}

type VolumeInfo

type VolumeInfo struct {
	Info        curvebs.FileInfo            `json:"info" binding:"required"`
	Pools       []VolumePoolInfo            `json:"pools"`
	Performance []metricomm.UserPerformance `json:"performance" binding:"required"`
}

type VolumePoolInfo

type VolumePoolInfo struct {
	Id    uint32 `json:"id" binding:"required"`
	Name  string `json:"name" binding:"required"`
	Type  string `json:"type" binding:"required"`
	Alloc uint32 `json:"alloc" binding:"required"`
}

type Zone

type Zone struct {
	Id      uint32   `json:"id" binding:"required"`
	Name    string   `json:"name" binding:"required"`
	Servers []Server `json:"servers" binding:"required"`
}

Jump to

Keyboard shortcuts

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