service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2021 License: MIT Imports: 23 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"
)

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 CoreCPUStatPrivider

type CoreCPUStatPrivider struct {
	CoreNum int
}

CoreCPUStatPrivider retrieves statistics data for cpu per core

func (*CoreCPUStatPrivider) CheckData

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

func (*CoreCPUStatPrivider) GetCode

func (sc *CoreCPUStatPrivider) GetCode() string

func (*CoreCPUStatPrivider) GetData

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

type DiskIOStatProvider

type DiskIOStatProvider struct {
	Device string
}

DiskIOStatProvider retrieves statistics data for the disk IO

func (*DiskIOStatProvider) CheckData

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

func (*DiskIOStatProvider) GetCode

func (m *DiskIOStatProvider) GetCode() string

func (*DiskIOStatProvider) GetData

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

type DiskUsageStatProvider

type DiskUsageStatProvider struct {
	Mapper *diskService.MountpointIDMapper
}

DiskUsageStatProvider retrieves statistics data for the disk usage

func (*DiskUsageStatProvider) CheckData

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

func (*DiskUsageStatProvider) GetCode

func (m *DiskUsageStatProvider) GetCode() string

func (*DiskUsageStatProvider) GetData

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

func (*DiskUsageStatProvider) GetDiskInfo

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

type IOMeasure

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

type OverallCPUStatPrivider

type OverallCPUStatPrivider struct{}

OverallCPUStatPrivider retrieves overall statistics data for cpu

func (*OverallCPUStatPrivider) CheckData

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

func (*OverallCPUStatPrivider) GetCode

func (sc *OverallCPUStatPrivider) GetCode() string

func (*OverallCPUStatPrivider) GetData

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

type OverallNetworkStatProvider

type OverallNetworkStatProvider struct{}

OverallNetworkStatProvider retrieves statistics data for the network usage

func (*OverallNetworkStatProvider) CheckData

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

func (*OverallNetworkStatProvider) GetCode

func (n *OverallNetworkStatProvider) GetCode() string

func (*OverallNetworkStatProvider) GetData

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

type Service

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

func GetService

func GetService() (*Service, error)

func (*Service) Run

func (s *Service) 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) Collect

func (sc *StatCollector) Collect() error

func (*StatCollector) Load

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

type StatProvider

type StatProvider interface {
	GetData() ([]string, error)
	GetCode() string
	CheckData([]string, StatProviderFilter) bool
}

func GetCoreCpuStatProviders

func GetCoreCpuStatProviders() ([]StatProvider, error)

GetCoreCpuStatProviders creates statistics providers for cpu cores

func GetDiskUsageStatProvider

func GetDiskUsageStatProvider() (StatProvider, error)

type StatProviderFilter

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

type StatProviderTimeFilter

type StatProviderTimeFilter struct {
	FromTime, ToTime int
}

func (*StatProviderTimeFilter) Check

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

type SwapMemoryStatPrivider

type SwapMemoryStatPrivider struct{}

SwapMemoryStatPrivider retrieves statistics data for memory

func (*SwapMemoryStatPrivider) CheckData

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

func (*SwapMemoryStatPrivider) GetCode

func (m *SwapMemoryStatPrivider) GetCode() string

func (*SwapMemoryStatPrivider) GetData

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

type VirtualMemoryStatPrivider

type VirtualMemoryStatPrivider struct{}

VirtualMemoryStatPrivider retrieves statistics data for memory

func (*VirtualMemoryStatPrivider) CheckData

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

func (*VirtualMemoryStatPrivider) GetCode

func (m *VirtualMemoryStatPrivider) GetCode() string

func (*VirtualMemoryStatPrivider) GetData

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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