processes

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2019 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MissingCGroup = iota
	MalformedCGroup
	UnknownCGroup
	DockerCGroup
)

Classifiers for CGroup found

View Source
const (
	DefaultTimeout = 10 * time.Second
	DefaultProcDir = "/proc"
)
View Source
const FreshnessThreshold = 1 * time.Second

Variables

This section is empty.

Functions

func DumpMetrics added in v0.13.0

func DumpMetrics(w io.Writer) error

DumpMetrics dump the current metrics in the text format in the given writer.

func FindContainerIDByCGroup

func FindContainerIDByCGroup(pid int32) (string, int)

FindContainerIDByCGroup fetches cgroup information for the given PID Returns the cgroup name and the CGroup classifier Should the pid belong to more than one cgroup: returns the first one, in kernel order.

Types

type CRIPodFinder

type CRIPodFinder struct {
	ProcDir string
	// contains filtered or unexported fields
}

func NewCRIPodFinder

func NewCRIPodFinder(runtimeEndPoint string, timeout time.Duration, scanner procscanner.ProcScanner) (*CRIPodFinder, error)

func (*CRIPodFinder) FindPodByPID

func (cpf *CRIPodFinder) FindPodByPID(pid int32) (string, error)

func (*CRIPodFinder) FindPods

func (cpf *CRIPodFinder) FindPods() (map[string]*PodInfo, error)

type Collector added in v0.13.0

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

func NewCollectorFromConf added in v0.13.0

func NewCollectorFromConf(conf *Config) (*Collector, error)

func NewSelfCollector added in v0.13.0

func NewSelfCollector() (*Collector, error)

func (Collector) Collect added in v0.13.0

func (co Collector) Collect(ch chan<- prometheus.Metric)

Note that Collect could be called concurrently

func (Collector) Describe added in v0.13.0

func (co Collector) Describe(ch chan<- *prometheus.Desc)

type Config

type Config struct {
	Targets       []procscanner.ProcTarget `json:"targets"`
	ListenAddress string                   `json:"listenaddress"`
	CRIEndPoint   string                   `json:"criendpoint"`
	Hostname      string                   `json:"hostname"`
	DebugMode     bool                     `json:"debugmode"`
}

Config encodes the configuration of the monitoring package

func NewConfig

func NewConfig() *Config

NewConfig creates a new Config object with the current defaults

func NewConfigFromFile

func NewConfigFromFile(confFile string) (*Config, error)

NewConfigFromFile creates a new Config object with the settings taken from the given file. Should the file not specify a setting, the value is the default one (see NewCOnfig)

func (*Config) Validate

func (c *Config) Validate() error

Validate returns nil if the current configuration is consistent and legal, an error otherwise

type DomainMonitor

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

func (*DomainMonitor) Update

func (dm *DomainMonitor) Update() (PodInfoMap, error)

type Monitor

type Monitor interface {
	Update() (PodInfoMap, error)
}

func NewDomainMonitor

func NewDomainMonitor(podFinder PodFinder) (Monitor, error)

func NewSelfMonitor added in v0.13.0

func NewSelfMonitor() (Monitor, error)

type PodFinder

type PodFinder interface {
	FindPods() (map[string]*PodInfo, error)
	FindPodByPID(pid int32) (string, error)
}

type PodInfo

type PodInfo struct {
	Procs []*process.Process
}

type PodInfoMap added in v0.13.0

type PodInfoMap map[string]*PodInfo

type PodMap

type PodMap map[string]*PodInfo

func (PodMap) MapProcsToPods

func (pods PodMap) MapProcsToPods(pf PodFinder, procs map[string][]int32) (PodMap, error)

type SelfMonitor added in v0.13.0

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

func (*SelfMonitor) Update added in v0.13.0

func (sm *SelfMonitor) Update() (PodInfoMap, error)

Jump to

Keyboard shortcuts

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