procs

package
v1.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2015 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 added in v1.0.0

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 added in v1.0.0

type ProcsConfig struct {
	Enabled            bool
	Max_proc_read_freq int
	Monitored          []ProcConfig
	Refresh_pids_freq  int
}

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