Documentation ¶
Index ¶
- Constants
- Variables
- func GetCPUInfo() (physicalCnt int, logicalCnt int, totalPercent float64, modelName string, ...)
- func GetCPUUsageInfo() float64
- func GetDiskInfo() (total uint64, free uint64, used uint64, usedPercent float64, err error)
- func GetMemoryInfo() (total uint64, available uint64, used uint64, usedPercent float64, err error)
- func GetMemoryUsage() (*MemoryUsageInfo, *SwapMemoryUsageInfo, error)
- func GetOSInfo() (hostName string, bootTime uint64, platform string, platformVersion string, ...)
- func GetSwapInfo() (total uint64, used uint64, free uint64, usedPercent float64, err error)
- func UpdateHostAgentStatus(agentID, agentStatus string)
- type CPU
- type DiskIOUsageInfo
- type DiskUsageInfo
- type HostInfo
- type MemoryUsageInfo
- type NetIOUsageInfo
- type OS
- type SwapMemoryUsageInfo
- type Usage
- type UsageCategory
Constants ¶
View Source
const ( AllUsage UsageCategory = "all" CPUUsage = "cpu" DiskUsage = "disk" DiskIOUsage = "disk_io" NetIOUsage = "net_io" MemoryUsage = "memory" ESProcessInfo = "es_process" )
Variables ¶
View Source
var CollectDiskIOLastTime time.Time
View Source
var CollectNetIOLastTime time.Time
Functions ¶
func GetCPUInfo ¶
func GetCPUUsageInfo ¶
func GetCPUUsageInfo() float64
func GetDiskInfo ¶
func GetMemoryInfo ¶
func GetMemoryUsage ¶
func GetMemoryUsage() (*MemoryUsageInfo, *SwapMemoryUsageInfo, error)
func GetSwapInfo ¶
func UpdateHostAgentStatus ¶
func UpdateHostAgentStatus(agentID, agentStatus string)
Types ¶
type CPU ¶
type CPU struct { Model string `json:"model,omitempty" elastic_mapping:"model: { type: keyword }"` //eg: Apple M1 Pro PhysicalCPU int `json:"physical_cpu,omitempty" elastic_mapping:"physical_cpu: { type: keyword }"` LogicalCPU int `json:"logical_cpu,omitempty" elastic_mapping:"logical_cpu: { type: keyword }"` }
type DiskIOUsageInfo ¶
type DiskIOUsageInfo struct { ReadBytes uint64 `json:"read_bytes" elastic_mapping:"read_bytes: { type: keyword }"` //byte WriteBytes uint64 `json:"write_bytes" elastic_mapping:"write_bytes: { type: keyword }"` //byte ReadTimeCost uint64 `json:"read_time_cost" elastic_mapping:"read_time_cost: { type: keyword }"` //ms WriteTimeCost uint64 `json:"write_time_cost" elastic_mapping:"write_time_cost: { type: keyword }"` //ms }
var DiskIOUsageLast *DiskIOUsageInfo
func GetDiskIOUsageInfo ¶
func GetDiskIOUsageInfo() (*DiskIOUsageInfo, error)
type DiskUsageInfo ¶
type DiskUsageInfo struct { Total uint64 `json:"total" elastic_mapping:"total: { type: keyword }"` //byte Free uint64 `json:"free" elastic_mapping:"free: { type: keyword }"` //byte Used uint64 `json:"used" elastic_mapping:"used: { type: keyword }"` //byte UsedPercent float64 `json:"used_percent" elastic_mapping:"used_percent: { type: keyword }"` }
func GetDiskUsage ¶
func GetDiskUsage() (*DiskUsageInfo, error)
type HostInfo ¶
type HostInfo struct { orm.ORMObjectBase AgentID string `json:"agent_id" elastic_mapping:"agent_id: { type: keyword, copy_to:search_text }"` IP string `json:"ip" elastic_mapping:"ip: { type: keyword, copy_to:search_text }"` Name string `json:"name" elastic_mapping:"name: { type: keyword, copy_to:search_text }"` //eg: zhangsandeMacBook-Pro.local MemorySize uint64 `json:"memory_size,omitempty" elastic_mapping:"memory_size: { type: keyword }"` //byte, eg: 17179869184 DiskSize uint64 `json:"disk_size,omitempty" elastic_mapping:"disk_size: { type: keyword }"` //byte, eg: 494384795648 CPUInfo CPU `json:"cpu_info,omitempty" elastic_mapping:"cpu_info: { type: object }"` OSInfo OS `json:"os_info,omitempty" elastic_mapping:"os_info: { type: object }"` UpTime time.Time `json:"up_time,omitempty" elastic_mapping:"up_time: { type: date }"` Tags []string `json:"tags,omitempty" elastic_mapping:"tags: { type: keyword, copy_to:search_text }"` SearchText string `` /* 138-byte string literal not displayed */ Timestamp time.Time `json:"timestamp,omitempty" elastic_mapping:"timestamp: { type: date }"` AgentStatus string `json:"agent_status,omitempty" elastic_mapping:"agent_status: { type: keyword }"` NodeID string `json:"node_id,omitempty" elastic_mapping:"node_id: { type: keyword }"` }
type MemoryUsageInfo ¶
type MemoryUsageInfo struct { Total uint64 `json:"total" elastic_mapping:"total: { type: keyword }"` //byte Available uint64 `json:"available" elastic_mapping:"available: { type: keyword }"` //byte Used uint64 `json:"used" elastic_mapping:"used: { type: keyword }"` //byte UsedPercent float64 `json:"used_percent" elastic_mapping:"used_percent: { type: keyword }"` }
type NetIOUsageInfo ¶
type NetIOUsageInfo struct { BytesSent uint64 `json:"bytes_sent" elastic_mapping:"bytes_sent: { type: keyword }"` //byte BytesRecv uint64 `json:"bytes_recv" elastic_mapping:"bytes_recv: { type: keyword }"` //byte PacketsSent uint64 `json:"packets_sent" elastic_mapping:"packets_sent: { type: keyword }"` PacketsRecv uint64 `json:"packets_recv" elastic_mapping:"packets_recv: { type: keyword }"` }
var NetIOUsageLast *NetIOUsageInfo
func GetNetIOUsage ¶
func GetNetIOUsage() (*NetIOUsageInfo, error)
type OS ¶
type OS struct { Platform string `json:"platform,omitempty" elastic_mapping:"platform: { type: keyword }"` //eg: darwin PlatformVersion string `json:"platform_version,omitempty" elastic_mapping:"platform_version: { type: keyword }"` //eg: 12.5 KernelVersion string `json:"kernel_version,omitempty" elastic_mapping:"kernel_version: { type: keyword }"` //eg: 21.6.0 KernelArch string `json:"kernel_arch,omitempty" elastic_mapping:"kernel_arch: { type: keyword }"` //eg: arm64 }
type SwapMemoryUsageInfo ¶
type SwapMemoryUsageInfo struct { Total uint64 `json:"total" elastic_mapping:"total: { type: keyword }"` //byte Free uint64 `json:"available" elastic_mapping:"available: { type: keyword }"` //byte Used uint64 `json:"used" elastic_mapping:"used: { type: keyword }"` //byte UsedPercent float64 `json:"used_percent" elastic_mapping:"used_percent: { type: keyword }"` }
type Usage ¶
type Usage struct { orm.ORMObjectBase AgentID string `json:"agent_id" elastic_mapping:"agent_id: { type: keyword }"` CPUPercent float64 `json:"cpu_percent,omitempty" elastic_mapping:"cpu_percent: { type: keyword }"` DiskUsage *DiskUsageInfo `json:"disk_usage,omitempty" elastic_mapping:"disk_usage: { type: object }"` DiskIOUsage *DiskIOUsageInfo `json:"disk_io_usage,omitempty" elastic_mapping:"disk_io_usage: { type: object }"` NetIOUsage *NetIOUsageInfo `json:"net_io_usage,omitempty" elastic_mapping:"net_io_usage: { type: object }"` MemoryUsage *MemoryUsageInfo `json:"memory_usage,omitempty" elastic_mapping:"memory_usage: { type: object }"` SwapMemoryUsage *SwapMemoryUsageInfo `json:"swap_memory_usage,omitempty" elastic_mapping:"swap_memory_usage: { type: object }"` ESProcessInfo string `json:"es_process_info"` }
func GetAllUsageInfo ¶
type UsageCategory ¶
type UsageCategory string
Click to show internal directories.
Click to hide internal directories.