Documentation
¶
Index ¶
- func ESInsertDoc(esURL, esIndex, esType string, doc map[string]interface{})
- type Cluster
- type ClusterStat
- type ContainerStat
- type DB
- func (db *DB) Close()
- func (db *DB) GetClusters(filter map[string]interface{}) (*[]Cluster, error)
- func (db *DB) GetCol(colName string) (*[]interface{}, error)
- func (db *DB) GetHosts() (*[]Host, error)
- func (db *DB) Init(dbURL string, dbName string) error
- func (db *DB) ReDial() error
- func (db *DB) SaveData(s interface{}, colName string) error
- func (db *DB) SetCol(colKey, colName string)
- func (db *DB) SetIndex(colKey, indexKey string, expireDays int) error
- type Host
- type HostStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ESInsertDoc ¶
ESInsertDoc will insert a doc to elasticsearch
Types ¶
type Cluster ¶
type Cluster struct {
ID string `bson:"id,omitempty"`
Name string `bson:"name,omitempty"`
ConsensusPlugin string `bson:"consensus_plugin,omitempty"`
ConsensusMode string `bson:"consensus_mode,omitempty"`
HostID string `bson:"host_id,omitempty"`
UserID string `bson:"user_id,omitempty"`
Containers map[string]string `bson:"containers,omitempty"`
APIURL string `bson:"api_url,omitempty"`
DaemonURL string `bson:"daemon_url,omitempty"`
Size uint64 `bson:"size,omitempty"`
CreateTS time.Time `bson:"create_ts,omitempty"`
ReleaseTS time.Time `bson:"release_ts,omitempty"`
Duration time.Time `bson:"duration,omitempty"`
// contains filtered or unexported fields
}
Cluster is a document in the host collection
type ClusterStat ¶
type ClusterStat struct {
ClusterID string `bson:"cluster_id,omitempty"`
ClusterName string `bson:"cluster_name,omitempty"`
CPUPercentage float64 `bson:"cpu_percentage,omitempty"`
Memory float64 `bson:"memory_usage,omitempty"`
MemoryLimit float64 `bson:"memory_limit,omitempty"`
MemoryPercentage float64 `bson:"memory_percentage,omitempty"`
NetworkRx float64 `bson:"network_rx,omitempty"`
NetworkTx float64 `bson:"network_tx,omitempty"`
BlockRead float64 `bson:"block_read,omitempty"`
BlockWrite float64 `bson:"block_write,omitempty"`
PidsCurrent uint64 `bson:"pid_current,omitempty"`
Size uint64 `bson:"size,omitempty"`
MaxLatency float64 `bson:"max_latency,omitempty"`
MinLatency float64 `bson:"min_latency,omitempty"`
AvgLatency float64 `bson:"avg_latency,omitempty"`
Latencies []float64 `bson:"latencies,omitempty"`
TimeStamp time.Time `bson:"timestamp,omitempty"`
// contains filtered or unexported fields
}
ClusterStat is a document of stat info for a cluster
func (*ClusterStat) CalculateStat ¶
func (s *ClusterStat) CalculateStat(csList []*ContainerStat)
CalculateStat will get the stat result for a cluster
type ContainerStat ¶
type ContainerStat struct {
ContainerID string `bson:"container_id,omitempty"`
ContainerName string `bson:"container_name,omitempty"`
CPUPercentage float64 `bson:"cpu_percentage,omitempty"`
Memory float64 `bson:"memory_usage,omitempty"`
MemoryLimit float64 `bson:"memory_limit,omitempty"`
MemoryPercentage float64 `bson:"memory_percentage,omitempty"`
NetworkRx float64 `bson:"network_rx,omitempty"`
NetworkTx float64 `bson:"network_tx,omitempty"`
BlockRead float64 `bson:"block_read,omitempty"`
BlockWrite float64 `bson:"block_write,omitempty"`
PidsCurrent uint64 `bson:"pid_current,omitempty"`
TimeStamp time.Time `bson:"timestamp,omitempty"`
// contains filtered or unexported fields
}
ContainerStat is a document of stat info for a container
type DB ¶
type DB struct {
URL string // mongo api url
Name string // name of the db
// contains filtered or unexported fields
}
DB is a table in mongo
func (*DB) GetClusters ¶
GetClusters retrieve the hosts info from db
type Host ¶
type Host struct {
ID string `bson:"id,omitempty"`
Name string `bson:"name,omitempty"`
DaemonURL string `bson:"daemon_url,omitempty"`
Clusters []string `bson:"clusters,omitempty"`
Status string `bson:"status,omitempty"`
Capacity uint64 `bson:"capacity,omitempty"`
Type string `bson:"type,omitempty"`
LogType string `bson:"log_type,omitempty"`
LogServer string `bson:"log_server,omitempty"`
CreateTS string `bson:"create_ts,omitempty"`
// contains filtered or unexported fields
}
Host is a document in the host collection
type HostStat ¶
type HostStat struct {
HostID string `bson:"host_id,omitempty"`
HostName string `bson:"host_name,omitempty"`
CPUPercentage float64 `bson:"cpu_percentage,omitempty"`
Memory float64 `bson:"memory_usage,omitempty"`
MemoryLimit float64 `bson:"memory_limit,omitempty"`
MemoryPercentage float64 `bson:"memory_percentage,omitempty"`
NetworkRx float64 `bson:"network_rx,omitempty"`
NetworkTx float64 `bson:"network_tx,omitempty"`
BlockRead float64 `bson:"block_read,omitempty"`
BlockWrite float64 `bson:"block_write,omitempty"`
PidsCurrent uint64 `bson:"pid_current,omitempty"`
AvgLatency float64 `bson:"avg_latency,omitempty"`
MaxLatency float64 `bson:"max_latency,omitempty"`
MinLatency float64 `bson:"min_latency,omitempty"`
TimeStamp time.Time `bson:"timestamp,omitempty"`
// contains filtered or unexported fields
}
HostStat is a document of stat info for a cluster
func (*HostStat) CalculateStat ¶
func (s *HostStat) CalculateStat(csList []*ClusterStat)
CalculateStat will get the stat result for a cluster
Click to show internal directories.
Click to hide internal directories.