system

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 12 Imported by: 0

README

System Input Plugin

The system plugin gathers general stats on system load, uptime, and number of users logged in. It is similar to the unix uptime command.

Number of CPUs is obtained from the /proc/cpuinfo file.

Configuration

# Read metrics about system load & uptime
[[inputs.system]]
  # no configuration
Permissions

The n_users field requires read access to /var/run/utmp, and may require the telegraf user to be added to the utmp group on some systems. If this file does not exist n_users will be skipped.

Metrics

  • system
    • fields:
      • load1 (float)
      • load15 (float)
      • load5 (float)
      • n_users (integer)
      • n_cpus (integer)
      • uptime (integer, seconds)
      • uptime_format (string, deprecated in 1.10, use uptime field)

Example Output

system,host=tyrion load1=3.72,load5=2.4,load15=2.1,n_users=3i,n_cpus=4i 1483964144000000000
system,host=tyrion uptime=1249632i 1483964144000000000
system,host=tyrion uptime_format="14 days, 11:07" 1483964144000000000

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PS

type PS interface {
	CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
	DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
	NetIO() ([]net.IOCountersStat, error)
	DiskIO(names []string) (map[string]disk.IOCountersStat, error)
	VMStat() (*mem.VirtualMemoryStat, error)
	NetConnections(fns ...net.ConnectionStatOptionsFn) ([]net.ConnectionStat, error)
}

type PSDiskDeps

type PSDiskDeps interface {
	Partitions(all bool) ([]disk.PartitionStat, error)
	OSGetenv(key string) string
	OSStat(name string) (os.FileInfo, error)
	PSDiskUsage(path string) (*disk.UsageStat, error)
}

type SystemPS

type SystemPS struct {
	PSDiskDeps
}

func NewSystemPS

func NewSystemPS() *SystemPS

func (*SystemPS) CPUTimes

func (s *SystemPS) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)

func (*SystemPS) DiskIO

func (s *SystemPS) DiskIO(names []string) (map[string]disk.IOCountersStat, error)

func (*SystemPS) DiskUsage

func (s *SystemPS) DiskUsage(mountPointFilter []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)

func (*SystemPS) NetConnections

func (s *SystemPS) NetConnections(fns ...net.ConnectionStatOptionsFn) ([]net.ConnectionStat, error)

func (*SystemPS) NetIO

func (s *SystemPS) NetIO() ([]net.IOCountersStat, error)

func (*SystemPS) VMStat

func (s *SystemPS) VMStat() (*mem.VirtualMemoryStat, error)

type SystemPSDisk

type SystemPSDisk struct{}

func (*SystemPSDisk) OSGetenv

func (s *SystemPSDisk) OSGetenv(key string) string

func (*SystemPSDisk) OSStat

func (s *SystemPSDisk) OSStat(name string) (os.FileInfo, error)

func (*SystemPSDisk) PSDiskUsage

func (s *SystemPSDisk) PSDiskUsage(path string) (*disk.UsageStat, error)

func (*SystemPSDisk) Partitions

func (s *SystemPSDisk) Partitions(all bool) ([]disk.PartitionStat, error)

type SystemStats

type SystemStats struct{}

func (*SystemStats) Gather

func (s *SystemStats) Gather() ([]interface{}, error)

func (*SystemStats) Series

func (s *SystemStats) Series() plugins.Series

Jump to

Keyboard shortcuts

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