Documentation ¶
Index ¶
- Constants
- func GetPodStatsById(stats []stats.PodStats, podId string) *stats.PodStats
- func Init(hostInfo IHostInfo)
- func Start()
- func Stop()
- type CadvisorDiskIoMetric
- type CadvisorProcessMetric
- type ContainerCpuMetric
- type ContainerDiskIoMetric
- type ContainerDiskIoMetrics
- type ContainerMemoryMetric
- type ContainerMetricMeta
- type ContainerMetrics
- type ContainerProcessMetric
- type CpuMetric
- type DiskIOMeta
- type DiskIOMetric
- type GuestMetrics
- type IHostInfo
- type MemMetric
- type NetIOMetric
- type NetMeta
- type PodCpuMetric
- type PodDiskIoMetric
- type PodDiskIoMetrics
- type PodMemoryMetric
- type PodMetricMeta
- type PodMetrics
- type PodProcessMetric
- type PodVolumeMetric
- type SGuestMonitor
- func (m *SGuestMonitor) Cpu() *CpuMetric
- func (m *SGuestMonitor) Diskio() *DiskIOMetric
- func (m *SGuestMonitor) GetSriovNicStats(pfName string, virtfn int) (*psnet.IOCountersStat, error)
- func (m *SGuestMonitor) HasPodMetrics() bool
- func (m *SGuestMonitor) Mem() *MemMetric
- func (m *SGuestMonitor) Netio() []*NetIOMetric
- func (m *SGuestMonitor) PodMetrics(prevUsage *GuestMetrics) *PodMetrics
- func (m *SGuestMonitor) SetNicDown(index int)
- func (m *SGuestMonitor) UpdateByInstance(instance guestman.GuestRuntimeInstance)
- func (m *SGuestMonitor) UpdateCpuCount(vcpuCount int)
- func (m *SGuestMonitor) UpdateNicsDesc(nics []*desc.SGuestNetwork)
- func (m *SGuestMonitor) UpdateVmName(name string)
- type SGuestMonitorCollector
- type SHostMetricsCollector
Constants ¶
View Source
const ( // Cumulative cpu time consumed by the container in core-seconds CPU_USAGE_SECONDS_TOTAL = "usage_seconds_total" // cpu usage rate CPU_USAGE_RATE = "usage_rate" // current working set of memory size in bytes MEMORY_WORKING_SET_BYTES = "working_set_bytes" // memory usage rate MEMORY_USAGE_RATE = "usage_rate" VOLUME_TOTAL = "total" VOLUME_FREE = "free" VOLUME_USED = "used" VOLUME_USED_PERCENT = "used_percent" VOLUME_INODES_TOTAL = "inodes_total" VOLUME_INODES_FREE = "inodes_free" VOLUME_INODES_USED = "inodes_used" VOLUME_INODES_USED_PERCENT = "inodes_used_percent" PROCESS_COUNT = "process_count" FD_COUNT = "fd_count" SOCKET_COUNT = "socket_count" THREADS_CURRENT = "threads_current" THREADS_MAX = "threads_max" )
View Source
const (
TelegrafServer = "http://127.0.0.1:8087/write"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CadvisorDiskIoMetric ¶
type CadvisorDiskIoMetric struct { Device string `json:"device"` //AsyncBytes uint64 `json:"async_bytes"` //DiscardBytes uint64 `json:"discard_bytes"` ReadBytes uint64 `json:"read_bytes"` WriteBytes uint64 `json:"write_bytes"` //TotalBytes uint64 `json:"total_bytes"` //AsyncCount uint64 `json:"async_count"` //DiscardCount uint64 `json:"discard_count"` ReadCount uint64 `json:"read_count"` WriteCount uint64 `json:"write_count"` ReadIOPS float64 `json:"read_iops"` WriteIOPS float64 `json:"write_iops"` ReadBPS float64 `json:"read_Bps"` WriteBPS float64 `json:"write_Bps"` }
func (CadvisorDiskIoMetric) GetTag ¶
func (m CadvisorDiskIoMetric) GetTag() map[string]string
func (CadvisorDiskIoMetric) ToMap ¶
func (m CadvisorDiskIoMetric) ToMap() map[string]interface{}
type CadvisorProcessMetric ¶
type CadvisorProcessMetric struct { // Number of processes ProcessCount uint64 `json:"process_count"` // Number of open file descriptors FdCount uint64 `json:"fd_count,omitempty"` // Number of sockets SocketCount uint64 `json:"socket_count"` // Number of threads currently in container ThreadsCurrent uint64 `json:"threads_current,omitempty"` // Maximum number of threads allowed in container ThreadsMax uint64 `json:"threads_max,omitempty"` }
func (CadvisorProcessMetric) ToMap ¶
func (m CadvisorProcessMetric) ToMap() map[string]interface{}
type ContainerCpuMetric ¶
type ContainerCpuMetric struct { ContainerMetricMeta CpuUsageSecondsTotal float64 `json:"cpu_usage_seconds_total"` CpuUsageRate *float64 `json:"cpu_usage_rate"` }
func (ContainerCpuMetric) GetName ¶
func (m ContainerCpuMetric) GetName() string
func (*ContainerCpuMetric) ToMap ¶
func (m *ContainerCpuMetric) ToMap() map[string]interface{}
type ContainerDiskIoMetric ¶
type ContainerDiskIoMetric struct { ContainerMetricMeta CadvisorDiskIoMetric }
func (ContainerDiskIoMetric) GetName ¶
func (m ContainerDiskIoMetric) GetName() string
func (*ContainerDiskIoMetric) GetTag ¶
func (m *ContainerDiskIoMetric) GetTag() map[string]string
type ContainerDiskIoMetrics ¶
type ContainerDiskIoMetrics map[string]*ContainerDiskIoMetric
func (ContainerDiskIoMetrics) ToCadvisorDiskIoMetrics ¶
func (m ContainerDiskIoMetrics) ToCadvisorDiskIoMetrics() map[string]CadvisorDiskIoMetric
type ContainerMemoryMetric ¶
type ContainerMemoryMetric struct { ContainerMetricMeta MemoryWorkingSetBytes float64 `json:"memory_working_set_bytes"` MemoryUsageRate float64 `json:"memory_usage_rate"` }
func (ContainerMemoryMetric) GetName ¶
func (m ContainerMemoryMetric) GetName() string
func (*ContainerMemoryMetric) ToMap ¶
func (m *ContainerMemoryMetric) ToMap() map[string]interface{}
type ContainerMetricMeta ¶
type ContainerMetricMeta struct { PodMetricMeta ContainerId string `json:"container_id"` ContainerName string `json:"container_name"` PodId string `json:"pod_id"` }
func NewContainerMetricMeta ¶
func (ContainerMetricMeta) GetTag ¶
func (m ContainerMetricMeta) GetTag() map[string]string
type ContainerMetrics ¶
type ContainerMetrics struct { ContainerCpu *ContainerCpuMetric `json:"container_cpu"` ContainerMemory *ContainerMemoryMetric `json:"container_memory"` ContainerProcess *ContainerProcessMetric `json:"container_process"` ContainerDiskIos ContainerDiskIoMetrics `json:"container_diskios"` }
type ContainerProcessMetric ¶
type ContainerProcessMetric struct { ContainerMetricMeta *CadvisorProcessMetric }
func (ContainerProcessMetric) GetName ¶
func (m ContainerProcessMetric) GetName() string
type CpuMetric ¶
type CpuMetric struct { UsageActive float64 `json:"usage_active"` CpuUsageIdlePcore float64 `json:"cpu_usage_idle_pcore"` CpuUsagePcore float64 `json:"cpu_usage_pcore"` CpuTimeUser float64 `json:"cpu_time_user"` CpuTimeSystem float64 `json:"cpu_time_system"` CpuCount int `json:"cpu_count"` ThreadCount int32 `json:"thread_count"` }
type DiskIOMeta ¶
type DiskIOMeta struct {
Uptime uint64 `json:"uptime"`
}
type DiskIOMetric ¶
type DiskIOMetric struct { Meta DiskIOMeta `json:"-"` ReadBytes uint64 `json:"read_bytes"` WriteBytes uint64 `json:"write_bytes"` ReadCount uint64 `json:"read_count"` WriteCount uint64 `json:"write_count"` // calculated on guest metrics report ReadBps float64 `json:"read_Bps"` WriteBps float64 `json:"write_Bps"` ReadBPS float64 `json:"read_bps"` WriteBPS float64 `json:"write_bps"` ReadIOPS float64 `json:"read_iops"` WriteIOPS float64 `json:"write_iops"` }
func (*DiskIOMetric) ToMap ¶
func (d *DiskIOMetric) ToMap() map[string]interface{}
type GuestMetrics ¶
type GuestMetrics struct { VmCpu *CpuMetric `json:"vm_cpu"` VmMem *MemMetric `json:"vm_mem"` VmNetio []*NetIOMetric `json:"vm_netio"` VmDiskio *DiskIOMetric `json:"vm_diskio"` PodMetrics *PodMetrics `json:"pod_metrics"` }
type IHostInfo ¶
type IHostInfo interface {
GetContainerStatsProvider() stats.ContainerStatsProvider
}
type MemMetric ¶
type NetIOMetric ¶
type NetIOMetric struct { Meta NetMeta `json:"-"` BytesSent uint64 `json:"bytes_sent"` BytesRecv uint64 `json:"bytes_recv"` PacketsSent uint64 `json:"packets_sent"` PacketsRecv uint64 `json:"packets_recv"` ErrIn uint64 `json:"err_in"` ErrOut uint64 `json:"err_out"` DropIn uint64 `json:"drop_in"` DropOut uint64 `json:"drop_out"` // calculated on guest metrics report BPSRecv float64 `json:"bps_recv"` BPSSent float64 `json:"bps_sent"` PPSRecv float64 `json:"pps_recv"` PPSSent float64 `json:"pps_sent"` TimeDiff float64 `json:"-"` }
func (*NetIOMetric) ToMap ¶
func (n *NetIOMetric) ToMap() map[string]interface{}
func (*NetIOMetric) ToTag ¶
func (n *NetIOMetric) ToTag() map[string]string
type PodCpuMetric ¶
type PodCpuMetric struct { PodMetricMeta CpuUsageSecondsTotal float64 `json:"cpu_usage_seconds_total"` CpuUsageRate *float64 `json:"cpu_usage_rate"` }
func (PodCpuMetric) GetName ¶
func (m PodCpuMetric) GetName() string
func (PodCpuMetric) ToMap ¶
func (m PodCpuMetric) ToMap() map[string]interface{}
type PodDiskIoMetric ¶
type PodDiskIoMetric struct { PodMetricMeta CadvisorDiskIoMetric }
func (PodDiskIoMetric) GetName ¶
func (m PodDiskIoMetric) GetName() string
func (PodDiskIoMetric) GetTag ¶
func (m PodDiskIoMetric) GetTag() map[string]string
type PodDiskIoMetrics ¶
type PodDiskIoMetrics map[string]*PodDiskIoMetric
func (PodDiskIoMetrics) GetTime ¶
func (m PodDiskIoMetrics) GetTime() time.Time
func (PodDiskIoMetrics) ToCadvisorDiskIoMetrics ¶
func (m PodDiskIoMetrics) ToCadvisorDiskIoMetrics() map[string]CadvisorDiskIoMetric
type PodMemoryMetric ¶
type PodMemoryMetric struct { PodMetricMeta MemoryWorkingSetBytes float64 `json:"memory_working_set_bytes"` MemoryUsageRate float64 `json:"memory_usage_rate"` }
func (PodMemoryMetric) GetName ¶
func (m PodMemoryMetric) GetName() string
func (PodMemoryMetric) ToMap ¶
func (m PodMemoryMetric) ToMap() map[string]interface{}
type PodMetricMeta ¶
func NewPodMetricMeta ¶
func NewPodMetricMeta(time time.Time) PodMetricMeta
func (PodMetricMeta) GetTag ¶
func (m PodMetricMeta) GetTag() map[string]string
type PodMetrics ¶
type PodMetrics struct { PodCpu *PodCpuMetric `json:"pod_cpu"` PodMemory *PodMemoryMetric `json:"pod_memory"` PodProcess *PodProcessMetric `json:"pod_process"` PodVolumes []*PodVolumeMetric `json:"pod_volume"` PodDiskIos PodDiskIoMetrics `json:"pod_disk_ios"` Containers []*ContainerMetrics `json:"containers"` }
type PodProcessMetric ¶
type PodProcessMetric struct { PodMetricMeta *CadvisorProcessMetric }
func (PodProcessMetric) GetName ¶
func (m PodProcessMetric) GetName() string
type PodVolumeMetric ¶
type PodVolumeMetric struct { ContainerMetricMeta // 容器内挂载路径 MountPath string `json:"mount_path"` // 宿主机路径 HostPath string `json:"host_path"` Type string `json:"type"` Fstype string `json:"fstype"` Total uint64 `json:"total"` Free uint64 `json:"free"` Used uint64 `json:"used"` UsedPercent float64 `json:"used_percent"` InodesTotal uint64 `json:"inodes_total"` InodesUsed uint64 `json:"inodes_used"` InodesFree uint64 `json:"inodes_free"` InodesUsedPercent float64 `json:"inodes_used_percent"` Tags map[string]string `json:"tags"` }
func (PodVolumeMetric) GetName ¶
func (m PodVolumeMetric) GetName() string
func (PodVolumeMetric) GetTag ¶
func (m PodVolumeMetric) GetTag() map[string]string
func (PodVolumeMetric) ToMap ¶
func (m PodVolumeMetric) ToMap() map[string]interface{}
type SGuestMonitor ¶
type SGuestMonitor struct { Name string Id string Pid int Nics []*desc.SGuestNetwork CpuCnt int MemMB int64 Ip string Process *process.Process ScalingGroupId string Tenant string TenantId string DomainId string ProjectDomain string // contains filtered or unexported fields }
func NewGuestMonitor ¶
func NewGuestMonitor(instance guestman.GuestRuntimeInstance, name, id string, pid int, nics []*desc.SGuestNetwork, cpuCount int) (*SGuestMonitor, error)
func NewGuestPodMonitor ¶
func NewGuestPodMonitor(instance guestman.GuestRuntimeInstance, name, id string, stat *stats.PodStats, nics []*desc.SGuestNetwork, cpuCount int) (*SGuestMonitor, error)
func (*SGuestMonitor) Cpu ¶
func (m *SGuestMonitor) Cpu() *CpuMetric
func (*SGuestMonitor) Diskio ¶
func (m *SGuestMonitor) Diskio() *DiskIOMetric
func (*SGuestMonitor) GetSriovNicStats ¶
func (m *SGuestMonitor) GetSriovNicStats(pfName string, virtfn int) (*psnet.IOCountersStat, error)
func (*SGuestMonitor) HasPodMetrics ¶
func (m *SGuestMonitor) HasPodMetrics() bool
func (*SGuestMonitor) Mem ¶
func (m *SGuestMonitor) Mem() *MemMetric
func (*SGuestMonitor) Netio ¶
func (m *SGuestMonitor) Netio() []*NetIOMetric
func (*SGuestMonitor) PodMetrics ¶
func (m *SGuestMonitor) PodMetrics(prevUsage *GuestMetrics) *PodMetrics
func (*SGuestMonitor) SetNicDown ¶
func (m *SGuestMonitor) SetNicDown(index int)
func (*SGuestMonitor) UpdateByInstance ¶
func (m *SGuestMonitor) UpdateByInstance(instance guestman.GuestRuntimeInstance)
func (*SGuestMonitor) UpdateCpuCount ¶
func (m *SGuestMonitor) UpdateCpuCount(vcpuCount int)
func (*SGuestMonitor) UpdateNicsDesc ¶
func (m *SGuestMonitor) UpdateNicsDesc(nics []*desc.SGuestNetwork)
func (*SGuestMonitor) UpdateVmName ¶
func (m *SGuestMonitor) UpdateVmName(name string)
type SGuestMonitorCollector ¶
type SGuestMonitorCollector struct {
// contains filtered or unexported fields
}
func NewGuestMonitorCollector ¶
func NewGuestMonitorCollector(hostInfo IHostInfo) *SGuestMonitorCollector
func (*SGuestMonitorCollector) CollectReportData ¶
func (s *SGuestMonitorCollector) CollectReportData() (ret string)
func (*SGuestMonitorCollector) GetGuests ¶
func (s *SGuestMonitorCollector) GetGuests() map[string]*SGuestMonitor
type SHostMetricsCollector ¶
type SHostMetricsCollector struct { ReportInterval int // seconds LastCollectTime time.Time // contains filtered or unexported fields }
func NewHostMetricsCollector ¶
func NewHostMetricsCollector(hostInfo IHostInfo) *SHostMetricsCollector
func (*SHostMetricsCollector) Start ¶
func (m *SHostMetricsCollector) Start()
func (*SHostMetricsCollector) Stop ¶
func (m *SHostMetricsCollector) Stop()
Click to show internal directories.
Click to hide internal directories.