procs

package
v5.0.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindPidsByCmdlineGrep

func FindPidsByCmdlineGrep(prefix string, process string) ([]int, error)

func FindSocketsOfPid

func FindSocketsOfPid(prefix string, pid int) (inodes []int64, err error)

Types

type PortProcMapping

type PortProcMapping struct {
	Port uint16
	Pid  int
	Proc *Process
}

type ProcConfig

type ProcConfig struct {
	Process      string
	Cmdline_grep string
}

type Process

type Process struct {
	Name    string
	Grepper string
	Pids    []int

	RefreshPidsTimer <-chan time.Time
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(proc *ProcessesWatcher, name string, grepper string,
	refreshPidsTimer <-chan time.Time) (*Process, error)

func (*Process) RefreshPids

func (p *Process) RefreshPids()

type ProcessesWatcher

type ProcessesWatcher struct {
	PortProcMap   map[uint16]PortProcMapping
	LastMapUpdate time.Time
	Processes     []*Process
	LocalAddrs    []net.IP

	// config
	ReadFromProc    bool
	MaxReadFreq     time.Duration
	RefreshPidsFreq time.Duration

	TestSignals *chan bool
	// contains filtered or unexported fields
}
var ProcWatcher ProcessesWatcher

func (*ProcessesWatcher) FindProc

func (proc *ProcessesWatcher) FindProc(port uint16) (procname string)

func (*ProcessesWatcher) FindProcessesTuple

func (proc *ProcessesWatcher) FindProcessesTuple(tuple *common.IpPortTuple) (proc_tuple *common.CmdlineTuple)

func (*ProcessesWatcher) Init

func (proc *ProcessesWatcher) Init(config ProcsConfig) error

func (*ProcessesWatcher) IsLocalIp

func (proc *ProcessesWatcher) IsLocalIp(ip net.IP) bool

func (*ProcessesWatcher) UpdateMap

func (proc *ProcessesWatcher) UpdateMap()

func (*ProcessesWatcher) UpdateMappingEntry

func (proc *ProcessesWatcher) UpdateMappingEntry(port uint16, pid int, p *Process)

type ProcsConfig

type ProcsConfig struct {
	Enabled            bool          `config:"enabled"`
	Max_proc_read_freq time.Duration `config:"max_proc_read_freq"`
	Monitored          []ProcConfig  `config:"monitored"`
	Refresh_pids_freq  time.Duration `config:"refresh_pids_freq"`
}

type SocketInfo

type SocketInfo struct {
	Src_ip, Dst_ip     uint32
	Src_port, Dst_port uint16

	Uid   uint16
	Inode int64
}

func Parse_Proc_Net_Tcp

func Parse_Proc_Net_Tcp(input io.Reader) ([]*SocketInfo, error)

Parses the /proc/net/tcp file

Jump to

Keyboard shortcuts

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