systemd

package
v0.0.0-...-c696c01 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFileNoStat

func ReadFileNoStat(filename string) ([]byte, error)

ReadFileNoStat uses ioutil.ReadAll to read contents of entire file. This is similar to ioutil.ReadFile but without the call to os.Stat, because many files in /proc and /sys report incorrect file sizes (either 0 or 4096). Reads a max file size of 512kB. For files larger than this, a scanner should be used. COPIED FROM prometheus/procfs WHICH ALSO USES APACHE 2.0

Types

type CPUAcct

type CPUAcct struct {
	CPUs []CPUUsage
}

CPUAcct stores CPU accounting information (e.g. cpu usage) for a control group (cgroup) of tasks. Equivalent to cpuacct.usage_all

func NewCPUAcct

func NewCPUAcct(cgSubpath string) (*CPUAcct, error)

NewCPUAcct will locate and read the kernel's cpu accounting info for the provided systemd cgroup subpath.

func (*CPUAcct) UsageAllNanosecs

func (c *CPUAcct) UsageAllNanosecs() uint64

UsageAllNanosecs returns total cpu consumption in nanoseconds, across all available cpu cores, from the point that CPU accounting was enabled for this control group.

func (*CPUAcct) UsageSystemNanosecs

func (c *CPUAcct) UsageSystemNanosecs() uint64

UsageSystemNanosecs returns system (e.g. kernel) cpu consumption in nanoseconds, across all available cpu cores, from the point that CPU accounting was enabled for this control group.

func (*CPUAcct) UsageUserNanosecs

func (c *CPUAcct) UsageUserNanosecs() uint64

UsageUserNanosecs returns user (e.g. non-kernel) cpu consumption in nanoseconds, across all available cpu cores, from the point that CPU accounting was enabled for this control group.

type CPUUsage

type CPUUsage struct {
	CPUId         uint32
	SystemNanosec uint64
	UserNanosec   uint64
}

CPUUsage stores one core's worth of CPU usage for a control group (aka cgroup) of tasks (e.g. both processes and threads). Equivalent to cpuacct.usage_percpu_user and cpuacct.usage_percpu_system

type Collector

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

func NewCollector

func NewCollector(logger log.Logger) (*Collector, error)

NewCollector returns a new Collector exposing systemd statistics.

func (*Collector) Collect

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

Collect gathers metrics from systemd.

func (*Collector) Describe

func (c *Collector) Describe(desc chan<- *prometheus.Desc)

Describe gathers descriptions of Metrics

Jump to

Keyboard shortcuts

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