system

package
v1.28.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 19 Imported by: 259

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.

Global configuration options

In addition to the plugin-specific configuration settings, plugins support additional global and plugin configuration settings. These settings are used to modify metrics, tags, and field or create aliases and configure ordering, etc. See the CONFIGURATION.md for more details.

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.

The n_unique_users shows the count of unique usernames logged in. This way if a user has multiple sessions open/started they would only get counted once. The same requirements for n_users apply.

Metrics

  • system
    • fields:
      • load1 (float)
      • load15 (float)
      • load5 (float)
      • n_users (integer)
      • n_unique_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 MockDiskUsage added in v1.14.0

type MockDiskUsage struct {
	*mock.Mock
}

func (*MockDiskUsage) OSGetenv added in v1.14.0

func (m *MockDiskUsage) OSGetenv(key string) string

func (*MockDiskUsage) OSStat added in v1.14.0

func (m *MockDiskUsage) OSStat(name string) (os.FileInfo, error)

func (*MockDiskUsage) PSDiskUsage added in v1.14.0

func (m *MockDiskUsage) PSDiskUsage(path string) (*disk.UsageStat, error)

func (*MockDiskUsage) Partitions added in v1.14.0

func (m *MockDiskUsage) Partitions(all bool) ([]disk.PartitionStat, error)

type MockPS

type MockPS struct {
	mock.Mock
	PSDiskDeps
}

func (*MockPS) CPUTimes

func (m *MockPS) CPUTimes(_, _ bool) ([]cpu.TimesStat, error)

func (*MockPS) DiskIO

func (m *MockPS) DiskIO(_ []string) (map[string]disk.IOCountersStat, error)

func (*MockPS) DiskUsage

func (m *MockPS) DiskUsage(mountPointFilter []string, mountOptsExclude []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)

func (*MockPS) LoadAvg

func (m *MockPS) LoadAvg() (*load.AvgStat, error)

func (*MockPS) NetConnections

func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)

func (*MockPS) NetConntrack added in v1.25.0

func (m *MockPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)

func (*MockPS) NetIO

func (m *MockPS) NetIO() ([]net.IOCountersStat, error)

func (*MockPS) NetProto

func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)

func (*MockPS) SwapStat

func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)

func (*MockPS) Temperature added in v1.14.0

func (m *MockPS) Temperature() ([]host.TemperatureStat, error)

func (*MockPS) VMStat

func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)

type MockPSDisk added in v1.14.0

type MockPSDisk struct {
	*SystemPS
	*mock.Mock
}

type PS

type PS interface {
	CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
	DiskUsage(mountPointFilter []string, mountOptsExclude []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
	NetIO() ([]net.IOCountersStat, error)
	NetProto() ([]net.ProtoCountersStat, error)
	DiskIO(names []string) (map[string]disk.IOCountersStat, error)
	VMStat() (*mem.VirtualMemoryStat, error)
	SwapStat() (*mem.SwapMemoryStat, error)
	NetConnections() ([]net.ConnectionStat, error)
	NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
	Temperature() ([]host.TemperatureStat, error)
}

type PSDiskDeps added in v1.14.0

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

type SystemPS struct {
	PSDiskDeps
	Log telegraf.Logger `toml:"-"`
}

func NewSystemPS added in v1.14.0

func NewSystemPS() *SystemPS

func (*SystemPS) CPUTimes added in v1.14.0

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

func (*SystemPS) DiskIO added in v1.14.0

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

func (*SystemPS) DiskUsage added in v1.14.0

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

func (*SystemPS) NetConnections added in v1.14.0

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

func (*SystemPS) NetConntrack added in v1.25.0

func (s *SystemPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)

func (*SystemPS) NetIO added in v1.14.0

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

func (*SystemPS) NetProto added in v1.14.0

func (s *SystemPS) NetProto() ([]net.ProtoCountersStat, error)

func (*SystemPS) SwapStat added in v1.14.0

func (s *SystemPS) SwapStat() (*mem.SwapMemoryStat, error)

func (*SystemPS) Temperature added in v1.14.0

func (s *SystemPS) Temperature() ([]host.TemperatureStat, error)

func (*SystemPS) VMStat added in v1.14.0

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

type SystemPSDisk added in v1.14.0

type SystemPSDisk struct{}

func (*SystemPSDisk) OSGetenv added in v1.14.0

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

func (*SystemPSDisk) OSStat added in v1.14.0

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

func (*SystemPSDisk) PSDiskUsage added in v1.14.0

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

func (*SystemPSDisk) Partitions added in v1.14.0

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

type SystemStats

type SystemStats struct {
	Log telegraf.Logger
}

func (*SystemStats) Gather

func (s *SystemStats) Gather(acc telegraf.Accumulator) error

func (*SystemStats) SampleConfig

func (*SystemStats) SampleConfig() string

Jump to

Keyboard shortcuts

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