funcs

package
v0.0.0-...-a9119a5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: Apache-2.0, Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mappers                     []FuncsAndInterval
	ProcMappers                 []ProcFuncsAndInterval
	DynamicMappersLock          = new(sync.RWMutex)
	DynamicMappers              []DynamicFuncsAndInterval
	DynamicMappersJson          = ""
	DynamicMapperConfChangeSign = make(chan int)
	MetricsOfFunctionName       = make(map[string]string)
	ProcMetricsOfFunctionName   = make(map[string]string)
	FunctionNameOfFunction      = make(map[string]func() []*model.MetricValue)
	ProcFunctionNameOfFunction  = make(map[string]func(string, []string) []*model.MetricValue)
	DynamicMetrics              = []string{}
	DynamicMetricsLock          = new(sync.RWMutex)
)
View Source
var (
	ServicesProCpus = make([]map[string]PidInfo, 2)
)
View Source
var USES = map[string]struct{}{
	"PruneCalled":        {},
	"LockDroppedIcmps":   {},
	"ArpFilter":          {},
	"TW":                 {},
	"DelayedACKLocked":   {},
	"ListenOverflows":    {},
	"ListenDrops":        {},
	"TCPPrequeueDropped": {},
	"TCPTSReorder":       {},
	"TCPDSACKUndo":       {},
	"TCPLoss":            {},
	"TCPLostRetransmit":  {},
	"TCPLossFailures":    {},
	"TCPFastRetrans":     {},
	"TCPFastRetransRate": {},
	"TCPTimeouts":        {},
	"TCPSchedulerFailed": {},
	"TCPAbortOnMemory":   {},
	"TCPAbortOnTimeout":  {},
	"TCPAbortFailed":     {},
	"TCPMemoryPressures": {},
	"TCPSpuriousRTOs":    {},
	"TCPBacklogDrop":     {},
	"TCPMinTTLDrop":      {},
}

Functions

func AgentMetrics

func AgentMetrics() (L []*model.MetricValue)

func BuildDynamicMappers

func BuildDynamicMappers()

定时更新动态采集的mapper

func BuildMappers

func BuildMappers()

根据调用指令类型和是否容易被挂起而分类(通过不同的goroutine去执行,避免相互之间的影响)

func CalculateProcCpuRate

func CalculateProcCpuRate(num uint64) float64

func CheckCollector

func CheckCollector()

func CoreNetMetrics

func CoreNetMetrics(ifacePrefix []string) []*model.MetricValue

func CounterValue

func CounterValue(metric string, val interface{}, tags ...string) *model.MetricValue

计数器类型

func CpuGuest

func CpuGuest() float64

func CpuGuestByCore

func CpuGuestByCore(index int) float64

func CpuIdle

func CpuIdle() float64

func CpuIdleByCore

func CpuIdleByCore(index int) float64

func CpuIowait

func CpuIowait() float64

func CpuIowaitByCore

func CpuIowaitByCore(index int) float64

func CpuIrq

func CpuIrq() float64

func CpuIrqByCore

func CpuIrqByCore(index int) float64

func CpuMetrics

func CpuMetrics() []*model.MetricValue

func CpuNice

func CpuNice() float64

func CpuNiceByCore

func CpuNiceByCore(index int) float64

func CpuPrepared

func CpuPrepared() bool

func CpuSoftIrq

func CpuSoftIrq() float64

func CpuSoftIrqByCore

func CpuSoftIrqByCore(index int) float64

func CpuSteal

func CpuSteal() float64

func CpuStealByCore

func CpuStealByCore(index int) float64

func CpuSystem

func CpuSystem() float64

func CpuSystemByCore

func CpuSystemByCore(index int) float64

func CpuUser

func CpuUser() float64

func CpuUserByCore

func CpuUserByCore(index int) float64

func CpuValidate

func CpuValidate(originValue float64) (right float64)

func CurrentCpuSwitches

func CurrentCpuSwitches() uint64

func DeviceMetrics

func DeviceMetrics() (L []*model.MetricValue)

func DeviceMetricsCheck

func DeviceMetricsCheck() bool

func DiskIOMetrics

func DiskIOMetrics() (L []*model.MetricValue)

func DuMetrics

func DuMetrics() (L []*model.MetricValue)

func GaugeValue

func GaugeValue(metric string, val interface{}, tags ...string) *model.MetricValue

原值类型

func GetDynamicMetrics

func GetDynamicMetrics() map[string]int

func GpuMetrics

func GpuMetrics() (L []*model.MetricValue)

需要load libnvidia-ml.so.1库

func IODelta

func IODelta(device string, f func([2]*nux.DiskStats) uint64) uint64

func IOMsecRead

func IOMsecRead(arr [2]*nux.DiskStats) uint64

func IOMsecTotal

func IOMsecTotal(arr [2]*nux.DiskStats) uint64

func IOMsecWeightedTotal

func IOMsecWeightedTotal(arr [2]*nux.DiskStats) uint64

func IOMsecWrite

func IOMsecWrite(arr [2]*nux.DiskStats) uint64

func IOReadMerged

func IOReadMerged(arr [2]*nux.DiskStats) uint64

func IOReadRequests

func IOReadRequests(arr [2]*nux.DiskStats) uint64

func IOReadSectors

func IOReadSectors(arr [2]*nux.DiskStats) uint64

func IOStatsForPage

func IOStatsForPage() (L [][]string)

func IOStatsMetrics

func IOStatsMetrics() (L []*model.MetricValue)

func IOWriteMerged

func IOWriteMerged(arr [2]*nux.DiskStats) uint64

func IOWriteRequests

func IOWriteRequests(arr [2]*nux.DiskStats) uint64

func IOWriteSectors

func IOWriteSectors(arr [2]*nux.DiskStats) uint64

func InitMetricsOfFunction

func InitMetricsOfFunction()

func KernelMetrics

func KernelMetrics() (L []*model.MetricValue)

func LoadAvgMetrics

func LoadAvgMetrics() []*model.MetricValue

func MemMetrics

func MemMetrics() []*model.MetricValue

func NetMetrics

func NetMetrics() []*model.MetricValue

func NetstatMetrics

func NetstatMetrics() (L []*model.MetricValue)

func NewMetricValue

func NewMetricValue(metric string, val interface{}, dataType string, tags ...string) *model.MetricValue

采集信息组成metricValue结构

func NtpMetrics

func NtpMetrics() (L []*model.MetricValue)

func NtpMetricsOld

func NtpMetricsOld() (L []*model.MetricValue)

func ParseIoLine

func ParseIoLine(line []byte, this *SingleIOInfo)

func ParseMemLine

func ParseMemLine(line []byte, pmem *SingleMemInfo)

func PortMetrics

func PortMetrics() (L []*model.MetricValue)

func ProcCpuMetrics

func ProcCpuMetrics(name string, pids []string) []*model.MetricValue

进程cpu采集函数

func ProcIoMetrics

func ProcIoMetrics(name string, pids []string) []*model.MetricValue

func ProcMemMetrics

func ProcMemMetrics(name string, pids []string) []*model.MetricValue

func ProcMetrics

func ProcMetrics() (L []*model.MetricValue)

func ProcNetMetrics

func ProcNetMetrics(service string, pids []string) []*model.MetricValue

func ProcSsMetrics

func ProcSsMetrics(service string, pids []string) []*model.MetricValue

func SetDynamicMappers

func SetDynamicMappers(mapper []DynamicFuncsAndInterval)

func SetDynamicMetrics

func SetDynamicMetrics(metrics []string)

func ShouldHandleDevice

func ShouldHandleDevice(device string) bool

func SocketStatSummaryMetrics

func SocketStatSummaryMetrics() (L []*model.MetricValue)

func SysUptimeMetric

func SysUptimeMetric() (L []*model.MetricValue)

func TS

func TS(arr [2]*nux.DiskStats) uint64

func Test1

func Test1() []*model.MetricValue

func Test2

func Test2() []*model.MetricValue

func UdpMetrics

func UdpMetrics() []*model.MetricValue

func UpdateCpuStat

func UpdateCpuStat() error

func UpdateDiskStats

func UpdateDiskStats() error

func UpdateProcCpuStat

func UpdateProcCpuStat(services map[string][]string) error

func UrlMetrics

func UrlMetrics() (L []*model.MetricValue)

Types

type DynamicFuncsAndInterval

type DynamicFuncsAndInterval struct {
	Fs       func() []*model.MetricValue
	Interval int
}

func GetDynamicMappers

func GetDynamicMappers() []DynamicFuncsAndInterval

type FuncsAndInterval

type FuncsAndInterval struct {
	Fs       []func() []*model.MetricValue
	Interval int
}

FuncsAndInterval 拆分不同的采集函数集,方便通过不同goroutine运行

type PidInfo

type PidInfo map[string]*ProcCpuUsage

func CurrentProcCpuStat

func CurrentProcCpuStat(pids []string) (PidInfo, error)

type PidNet

type PidNet struct {
	TcpSend int64
	TcpRecv int64
	UdpSend int64
	UdpRecv int64
}

func (*PidNet) String

func (this *PidNet) String() string

type ProcCpuUsage

type ProcCpuUsage struct {
	Utime  uint64 // time spent in user mode
	Stime  uint64 // time spent in user mode with low priority (nice)
	Cutime uint64 // 累计的该任务的所有的 waited-for 进程曾经在用户态运行的时间
	Cstime uint64 // 累计的该任务的所有的 waited-for 进程曾经在核心态运行的时间
	Total  uint64 // total of all time fields
}

func GetProcCpuStat

func GetProcCpuStat(fName string) (*ProcCpuUsage, error)

func (*ProcCpuUsage) String

func (this *ProcCpuUsage) String() string

proc cpu collect

type ProcFuncsAndInterval

type ProcFuncsAndInterval struct {
	Fs       []func(string, []string) []*model.MetricValue
	Interval int
}

type SSInfo

type SSInfo struct {
	Timestamp int64
	RTT       float64
	LocalIp   string
	LocalPort int64
	DestIp    string
	DestPort  int64
}

func (*SSInfo) String

func (this *SSInfo) String() string

type SingleIOInfo

type SingleIOInfo struct {
	Rchar int64
	Wchar int64
}

proc argus collect

func GetOnePidIoInfo

func GetOnePidIoInfo(pid string) *SingleIOInfo

type SingleMemInfo

type SingleMemInfo struct {
	Peak uint64
	Size uint64
	Lck  uint64
	Hwm  uint64
	Rss  uint64
	Data uint64
	Stk  uint64
	Exe  uint64
	Lib  uint64
	Pte  uint64
	Swap uint64
}

proc mem collect

func GetOnePidMemInfo

func GetOnePidMemInfo(pid string) *SingleMemInfo

Jump to

Keyboard shortcuts

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