service

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OVERALL_CPU_PROVIDER_CODE     = "cpuoverall"
	CORE_CPU_PROVIDER_CODE        = "cpucore"
	VIRTUAL_MEMORY_PROVIDER_CODE  = "memoryvirtual"
	SWAP_MEMORY_PROVIDER_CODE     = "memoryswap"
	DISK_USAGE_PROVIDER_CODE      = "diskusage"
	DISK_IO_PROVIDER_CODE         = "diskio"
	OVERALL_NETWORK_PROVIDER_CODE = "networkoverall"
)
View Source
const (
	DEFAULT_COLLECT_INTERVALL  = time.Minute
	DEFAULT_CLEAN_INTERVALL    = time.Hour * 24
	DEFAULT_MAX_COLLECT_PERIOD = 6 // month
)

Variables

This section is empty.

Functions

func GetDiskDevices

func GetDiskDevices() ([]string, error)

func GetNetworkInterfacesInfo

func GetNetworkInterfacesInfo() ([]map[string]string, error)

func GetPartitions

func GetPartitions() ([]disk.PartitionStat, error)

func GetProcessesData

func GetProcessesData() ([]agentintegration.ProcessData, error)

Types

type BaseStatProvider added in v0.2.1

type BaseStatProvider struct{}

func (*BaseStatProvider) GetEmptyRecordValue added in v0.2.1

func (p *BaseStatProvider) GetEmptyRecordValue(index int) string

type CoreCPUStatPrivider

type CoreCPUStatPrivider struct {
	BaseStatProvider
	CoreNum int
}

CoreCPUStatPrivider retrieves statistics data for cpu per core

func (*CoreCPUStatPrivider) CheckRecord added in v0.2.1

func (sc *CoreCPUStatPrivider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*CoreCPUStatPrivider) GetAverageRecord added in v0.2.1

func (sc *CoreCPUStatPrivider) GetAverageRecord(records [][]string) []string

func (*CoreCPUStatPrivider) GetCode

func (sc *CoreCPUStatPrivider) GetCode() string

func (*CoreCPUStatPrivider) GetFieldsCount added in v0.2.1

func (sc *CoreCPUStatPrivider) GetFieldsCount() int

func (*CoreCPUStatPrivider) GetRecord added in v0.2.1

func (sc *CoreCPUStatPrivider) GetRecord() ([]string, error)

type DiskIOStatProvider

type DiskIOStatProvider struct {
	BaseStatProvider
	Device string
}

DiskIOStatProvider retrieves statistics data for the disk IO

func (*DiskIOStatProvider) CheckRecord added in v0.2.1

func (m *DiskIOStatProvider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*DiskIOStatProvider) GetAverageRecord added in v0.2.1

func (m *DiskIOStatProvider) GetAverageRecord(records [][]string) []string

func (*DiskIOStatProvider) GetCode

func (m *DiskIOStatProvider) GetCode() string

func (*DiskIOStatProvider) GetFieldsCount added in v0.2.1

func (m *DiskIOStatProvider) GetFieldsCount() int

func (*DiskIOStatProvider) GetRecord added in v0.2.1

func (m *DiskIOStatProvider) GetRecord() ([]string, error)

type DiskUsageStatProvider

type DiskUsageStatProvider struct {
	BaseStatProvider
	Mapper *diskService.MountpointIDMapper
}

DiskUsageStatProvider retrieves statistics data for the disk usage

func (*DiskUsageStatProvider) CheckRecord added in v0.2.1

func (m *DiskUsageStatProvider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*DiskUsageStatProvider) GetAverageRecord added in v0.2.1

func (m *DiskUsageStatProvider) GetAverageRecord(records [][]string) []string

func (*DiskUsageStatProvider) GetCode

func (m *DiskUsageStatProvider) GetCode() string

func (*DiskUsageStatProvider) GetDiskInfo

func (m *DiskUsageStatProvider) GetDiskInfo() (map[string]map[string]string, error)

func (*DiskUsageStatProvider) GetEmptyRecordValue added in v0.2.1

func (m *DiskUsageStatProvider) GetEmptyRecordValue(index int) string

func (*DiskUsageStatProvider) GetFieldsCount added in v0.2.1

func (m *DiskUsageStatProvider) GetFieldsCount() int

func (*DiskUsageStatProvider) GetRecord added in v0.2.1

func (m *DiskUsageStatProvider) GetRecord() ([]string, error)

type IOMeasure

type IOMeasure struct {
	ReadCount,
	WriteCount,
	MergedReadCount,
	MergedWriteCount,
	ReadTime,
	WriteTime,
	IoTime,
	ReadBytes,
	WriteBytes uint64
}

type OverallCPUStatPrivider

type OverallCPUStatPrivider struct {
	BaseStatProvider
}

OverallCPUStatPrivider retrieves overall statistics data for cpu

func (*OverallCPUStatPrivider) CheckRecord added in v0.2.1

func (sc *OverallCPUStatPrivider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*OverallCPUStatPrivider) GetAverageRecord added in v0.2.1

func (sc *OverallCPUStatPrivider) GetAverageRecord(records [][]string) []string

func (*OverallCPUStatPrivider) GetCode

func (sc *OverallCPUStatPrivider) GetCode() string

func (*OverallCPUStatPrivider) GetFieldsCount added in v0.2.1

func (sc *OverallCPUStatPrivider) GetFieldsCount() int

func (*OverallCPUStatPrivider) GetRecord added in v0.2.1

func (sc *OverallCPUStatPrivider) GetRecord() ([]string, error)

type OverallNetworkStatProvider

type OverallNetworkStatProvider struct {
	BaseStatProvider
}

OverallNetworkStatProvider retrieves statistics data for the network usage

func (*OverallNetworkStatProvider) CheckRecord added in v0.2.1

func (n *OverallNetworkStatProvider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*OverallNetworkStatProvider) GetAverageRecord added in v0.2.1

func (n *OverallNetworkStatProvider) GetAverageRecord(records [][]string) []string

func (*OverallNetworkStatProvider) GetCode

func (n *OverallNetworkStatProvider) GetCode() string

func (*OverallNetworkStatProvider) GetFieldsCount added in v0.2.1

func (n *OverallNetworkStatProvider) GetFieldsCount() int

func (*OverallNetworkStatProvider) GetRecord added in v0.2.1

func (n *OverallNetworkStatProvider) GetRecord() ([]string, error)

type StatCleanerService added in v0.3.0

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

func GetStatCleanerService added in v0.3.0

func GetStatCleanerService() (*StatCleanerService, error)

func (*StatCleanerService) Run added in v0.3.0

func (s *StatCleanerService) Run() error

type StatCollector

type StatCollector struct {
	Provider StatProvider
	FilePath string
	// contains filtered or unexported fields
}

func GetCoreCpuStatCollectors

func GetCoreCpuStatCollectors() ([]*StatCollector, error)

func GetDiskIOStatCollectors

func GetDiskIOStatCollectors() ([]*StatCollector, error)

func GetDiskUsageStatCollector

func GetDiskUsageStatCollector() (*StatCollector, error)

func GetStatCollector

func GetStatCollector(provider StatProvider) (*StatCollector, error)

func GetStatCollectors

func GetStatCollectors(providers []StatProvider) ([]*StatCollector, error)

func (*StatCollector) Clean added in v0.3.0

func (sc *StatCollector) Clean(filter StatProviderFilter) error

func (*StatCollector) Collect

func (sc *StatCollector) Collect() error

func (*StatCollector) Load

func (sc *StatCollector) Load(filter StatProviderFilter) ([][]string, error)

type StatCollectorService added in v0.3.0

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

func GetStatCollectorService added in v0.3.0

func GetStatCollectorService() (*StatCollectorService, error)

func (*StatCollectorService) Run added in v0.3.0

func (s *StatCollectorService) Run() error

type StatProvider

type StatProvider interface {
	GetRecord() ([]string, error)
	GetCode() string
	CheckRecord([]string, StatProviderFilter) bool
	GetFieldsCount() int
	GetAverageRecord([][]string) []string
	GetEmptyRecordValue(index int) string
}

func GetCoreCpuStatProviders

func GetCoreCpuStatProviders() ([]StatProvider, error)

GetCoreCpuStatProviders creates statistics providers for cpu cores

func GetDiskUsageStatProvider

func GetDiskUsageStatProvider() (StatProvider, error)

type StatProviderFilter

type StatProviderFilter interface {
	GetFromTime() int
	GetToTime() int
	Check(row []string) bool
}

type StatProviderTimeFilter

type StatProviderTimeFilter struct {
	FromTime, ToTime int
}

func (*StatProviderTimeFilter) Check

func (f *StatProviderTimeFilter) Check(row []string) bool

func (*StatProviderTimeFilter) GetFromTime added in v0.2.1

func (f *StatProviderTimeFilter) GetFromTime() int

func (*StatProviderTimeFilter) GetToTime added in v0.2.1

func (f *StatProviderTimeFilter) GetToTime() int

type SwapMemoryStatPrivider

type SwapMemoryStatPrivider struct {
	BaseStatProvider
}

SwapMemoryStatPrivider retrieves statistics data for memory

func (*SwapMemoryStatPrivider) CheckRecord added in v0.2.1

func (m *SwapMemoryStatPrivider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*SwapMemoryStatPrivider) GetAverageRecord added in v0.2.1

func (m *SwapMemoryStatPrivider) GetAverageRecord(records [][]string) []string

func (*SwapMemoryStatPrivider) GetCode

func (m *SwapMemoryStatPrivider) GetCode() string

func (*SwapMemoryStatPrivider) GetFieldsCount added in v0.2.1

func (m *SwapMemoryStatPrivider) GetFieldsCount() int

func (*SwapMemoryStatPrivider) GetRecord added in v0.2.1

func (m *SwapMemoryStatPrivider) GetRecord() ([]string, error)

type VirtualMemoryStatPrivider

type VirtualMemoryStatPrivider struct {
	BaseStatProvider
}

VirtualMemoryStatPrivider retrieves statistics data for memory

func (*VirtualMemoryStatPrivider) CheckRecord added in v0.2.1

func (m *VirtualMemoryStatPrivider) CheckRecord(data []string, filter StatProviderFilter) bool

func (*VirtualMemoryStatPrivider) GetAverageRecord added in v0.2.1

func (m *VirtualMemoryStatPrivider) GetAverageRecord(records [][]string) []string

func (*VirtualMemoryStatPrivider) GetCode

func (m *VirtualMemoryStatPrivider) GetCode() string

func (*VirtualMemoryStatPrivider) GetFieldsCount added in v0.2.1

func (m *VirtualMemoryStatPrivider) GetFieldsCount() int

func (*VirtualMemoryStatPrivider) GetRecord added in v0.2.1

func (m *VirtualMemoryStatPrivider) GetRecord() ([]string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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