process

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolUnspecified = ""
	ProtocolTCP         = "tcp"
	ProtocolUDP         = "udp"
	ProtocolTCP6        = "tcp6"
	ProtocolUDP6        = "udp6"

	DetectorStd     = "std"
	DetectorNetlink = "netlink"
)

Variables

View Source
var ErrSkipCollect = errors.New("skip collect")
View Source
var ProcCustomPerfCollector = NewProcCollector()

Functions

func IsIpv6

func IsIpv6(s string) bool

Types

type ConnDetector

type ConnDetector interface {
	Type() string
	Get(pids []int32) (PidSockets, error)
	GetState(pids []int32, state StateType) (PidSockets, error)
}

type FileSocket

type FileSocket struct {
	Status   string
	Inode    uint32
	Type     int
	Pid      int32
	Family   uint32
	Saddr    string
	Sport    uint32
	Daddr    string
	Dport    uint32
	Protocol string
}

func (FileSocket) Listen

func (fs FileSocket) Listen() string

type NetlinkDetector

type NetlinkDetector struct{}

func (NetlinkDetector) Get

func (d NetlinkDetector) Get(pids []int32) (PidSockets, error)

func (NetlinkDetector) GetState

func (d NetlinkDetector) GetState(pids []int32, state StateType) (PidSockets, error)

func (NetlinkDetector) Type

func (d NetlinkDetector) Type() string

type PidSockets

type PidSockets struct {
	TCP  map[int32][]FileSocket
	UDP  map[int32][]FileSocket
	TCP6 map[int32][]FileSocket
	UDP6 map[int32][]FileSocket
}

func NewPidSockets

func NewPidSockets() PidSockets

func (PidSockets) Get

func (ps PidSockets) Get(pid int32, protocol string) []FileSocket

Get 获取指定 protocol 的 FileSocket 既要支持 ipv6 新场景的 也要兼容原先的 tcp/udp 检测逻辑

type PortConfigStore

type PortConfigStore struct {
	Pid2Conf map[int32][]string
	Conf2Pid map[string][]int32
}

type PortStat

type PortStat struct {
	ProcName          string   `json:"name"`
	Status            int      `json:"exists"`
	Protocol          string   `json:"protocol"`
	Listen            []uint16 `json:"listen"`
	NonListen         []uint16 `json:"nonlisten"`
	NotAccurateListen []string `json:"notaccuratelisten"`
	BindIP            string   `json:"bindip"`
	ParamRegex        string   `json:"paramregex"`
	DisplayName       string   `json:"displayname"`
	PortHealthy       int      `json:"porthealth"`
}

type PortStats

type PortStats struct {
	Processes []PortStat `json:"processes"`
}

type ProcCollector

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

func NewProcCollector

func NewProcCollector() *ProcCollector

func (*ProcCollector) AsOneCmdbConfMapStr

func (pc *ProcCollector) AsOneCmdbConfMapStr(stat define.ProcStat) common.MapStr

func (*ProcCollector) CollectPortStat

func (pc *ProcCollector) CollectPortStat(pcs PortConfigStore) (PortStats, error)

func (*ProcCollector) CollectProcStat

func (pc *ProcCollector) CollectProcStat(metas []define.ProcStat) ([]common.MapStr, []common.MapStr, PortConfigStore)

CollectProcStat collects process performance statistics

func (*ProcCollector) GetAllMetaData

func (pc *ProcCollector) GetAllMetaData() ([]define.ProcStat, error)

func (*ProcCollector) GetOneMetaData

func (pc *ProcCollector) GetOneMetaData(pid int32) (define.ProcStat, error)

func (*ProcCollector) GetOnePerfStat

func (pc *ProcCollector) GetOnePerfStat(pid int32) (define.ProcStat, error)

func (*ProcCollector) MergeMetaDataPerfStat

func (pc *ProcCollector) MergeMetaDataPerfStat(meta, perf define.ProcStat) define.ProcStat

func (*ProcCollector) Snapshot

func (pc *ProcCollector) Snapshot() ([]define.ProcStat, int64, error)

func (*ProcCollector) UpdateConf

func (pc *ProcCollector) UpdateConf(conf *configs.ProcessbeatConfig)

type StateType

type StateType uint8
const (
	StateListen      StateType = 0
	StateListenEstab StateType = 1
)

type StdDetector

type StdDetector struct{}

func (StdDetector) Get

func (d StdDetector) Get(pids []int32) (PidSockets, error)

func (StdDetector) GetState

func (d StdDetector) GetState(pids []int32, state StateType) (PidSockets, error)

func (StdDetector) Type

func (d StdDetector) Type() string

Jump to

Keyboard shortcuts

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