system

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 19 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]]
  instance_id = "" # unique instance identifier (REQUIRED)

  # no other configuration
Permissions

The n_users field requires read access to /var/run/utmp, and may require the cua 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 MockDiskUsage

type MockDiskUsage struct {
	*mock.Mock
}

func (*MockDiskUsage) OSGetenv

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

func (*MockDiskUsage) OSStat

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

func (*MockDiskUsage) PSDiskUsage

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

func (*MockDiskUsage) Partitions

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

type MockPS

type MockPS struct {
	mock.Mock
	PSDiskDeps
}

func (*MockPS) CPUTimes

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

func (*MockPS) DiskIO

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

func (*MockPS) DiskUsage

func (m *MockPS) DiskUsage(mountPointFilter []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) 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

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

func (*MockPS) VMStat

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

type MockPSDisk

type MockPSDisk struct {
	*SysPS
	*mock.Mock
}

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)
	NetProto() ([]net.ProtoCountersStat, error)
	DiskIO(names []string) (map[string]disk.IOCountersStat, error)
	VMStat() (*mem.VirtualMemoryStat, error)
	SwapStat() (*mem.SwapMemoryStat, error)
	NetConnections() ([]net.ConnectionStat, error)
	Temperature() ([]host.TemperatureStat, 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 Stats added in v0.0.12

type Stats struct {
	Log cua.Logger
}

func (*Stats) Description added in v0.0.12

func (*Stats) Description() string

func (*Stats) Gather added in v0.0.12

func (s *Stats) Gather(ctx context.Context, acc cua.Accumulator) error

func (*Stats) SampleConfig added in v0.0.12

func (*Stats) SampleConfig() string

type SysPS added in v0.0.12

type SysPS struct {
	PSDiskDeps
}

func NewSystemPS

func NewSystemPS() *SysPS

func (*SysPS) CPUTimes added in v0.0.12

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

func (*SysPS) DiskIO added in v0.0.12

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

func (*SysPS) DiskUsage added in v0.0.12

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

func (*SysPS) NetConnections added in v0.0.12

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

func (*SysPS) NetIO added in v0.0.12

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

func (*SysPS) NetProto added in v0.0.12

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

func (*SysPS) SwapStat added in v0.0.12

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

func (*SysPS) Temperature added in v0.0.12

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

func (*SysPS) VMStat added in v0.0.12

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

type SysPSDisk added in v0.0.12

type SysPSDisk struct{}

func (*SysPSDisk) OSGetenv added in v0.0.12

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

func (*SysPSDisk) OSStat added in v0.0.12

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

func (*SysPSDisk) PSDiskUsage added in v0.0.12

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

func (*SysPSDisk) Partitions added in v0.0.12

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

Jump to

Keyboard shortcuts

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