Documentation
¶
Index ¶
- type MockDiskUsage
- type MockPS
- func (m *MockPS) CPUTimes(_, _ bool) ([]cpu.TimesStat, error)
- func (m *MockPS) DiskIO(_ []string) (map[string]disk.IOCountersStat, error)
- func (m *MockPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
- func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
- func (m *MockPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
- func (m *MockPS) NetIO() ([]net.IOCountersStat, error)
- func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)
- func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error)
- func (m *MockPS) VMStat() (*mem.VirtualMemoryStat, error)
- type MockPSDisk
- type PS
- type PSDiskDeps
- type SystemPS
- func (*SystemPS) CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
- func (*SystemPS) DiskIO(names []string) (map[string]disk.IOCountersStat, error)
- func (s *SystemPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
- func (*SystemPS) NetConnections() ([]net.ConnectionStat, error)
- func (*SystemPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
- func (*SystemPS) NetIO() ([]net.IOCountersStat, error)
- func (*SystemPS) NetProto() ([]net.ProtoCountersStat, error)
- func (*SystemPS) SwapStat() (*mem.SwapMemoryStat, error)
- func (*SystemPS) VMStat() (*mem.VirtualMemoryStat, error)
- type SystemPSDisk
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockDiskUsage ¶
MockDiskUsage is a mock implementation for disk usage operations.
func (*MockDiskUsage) OSGetenv ¶
func (m *MockDiskUsage) OSGetenv(key string) string
OSGetenv returns the value of the environment variable named by the key.
func (*MockDiskUsage) OSStat ¶
func (m *MockDiskUsage) OSStat(name string) (os.FileInfo, error)
OSStat returns the FileInfo structure describing the named file.
func (*MockDiskUsage) PSDiskUsage ¶
func (m *MockDiskUsage) PSDiskUsage(path string) (*disk.UsageStat, error)
PSDiskUsage returns a file system usage for the specified path.
func (*MockDiskUsage) Partitions ¶
func (m *MockDiskUsage) Partitions(all bool) ([]disk.PartitionStat, error)
Partitions returns the disk partition statistics.
type MockPS ¶
type MockPS struct {
mock.Mock
PSDiskDeps
}
MockPS is a mock implementation of the PS interface for testing purposes.
func (*MockPS) DiskUsage ¶
func (m *MockPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
DiskUsage returns the disk usage statistics.
func (*MockPS) NetConnections ¶
func (m *MockPS) NetConnections() ([]net.ConnectionStat, error)
NetConnections returns a list of network connections opened.
func (*MockPS) NetConntrack ¶
func (m *MockPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
NetConntrack returns more detailed info about the conntrack table.
func (*MockPS) NetIO ¶
func (m *MockPS) NetIO() ([]net.IOCountersStat, error)
NetIO returns network I/O statistics for every network interface installed on the system.
func (*MockPS) NetProto ¶
func (m *MockPS) NetProto() ([]net.ProtoCountersStat, error)
NetProto returns network statistics for the entire system.
type MockPSDisk ¶
MockPSDisk is a mock implementation of the PSDiskDeps interface for testing purposes.
type PS ¶
type PS interface {
// CPUTimes returns the CPU times statistics.
CPUTimes(perCPU, totalCPU bool) ([]cpu.TimesStat, error)
// DiskUsage returns the disk usage statistics.
DiskUsage(mountPointFilter []string, mountOptsExclude []string, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
// NetIO returns network I/O statistics for every network interface installed on the system.
NetIO() ([]net.IOCountersStat, error)
// NetProto returns network statistics for the entire system.
NetProto() ([]net.ProtoCountersStat, error)
// DiskIO returns the disk I/O statistics.
DiskIO(names []string) (map[string]disk.IOCountersStat, error)
// VMStat returns the virtual memory statistics.
VMStat() (*mem.VirtualMemoryStat, error)
// SwapStat returns the swap memory statistics.
SwapStat() (*mem.SwapMemoryStat, error)
// NetConnections returns a list of network connections opened.
NetConnections() ([]net.ConnectionStat, error)
// NetConntrack returns more detailed info about the conntrack table.
NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
}
PS is an interface that defines methods for gathering system statistics.
type PSDiskDeps ¶
type PSDiskDeps interface {
// Partitions returns the disk partition statistics.
Partitions(all bool) ([]disk.PartitionStat, error)
// OSGetenv returns the value of the environment variable named by the key.
OSGetenv(key string) string
// OSStat returns the FileInfo structure describing the named file.
OSStat(name string) (os.FileInfo, error)
// PSDiskUsage returns a file system usage for the specified path.
PSDiskUsage(path string) (*disk.UsageStat, error)
}
PSDiskDeps is an interface that defines methods for gathering disk statistics.
type SystemPS ¶
type SystemPS struct {
PSDiskDeps
Log telegraf.Logger `toml:"-"`
}
SystemPS is a struct that implements the PS interface.
func (*SystemPS) DiskUsage ¶
func (s *SystemPS) DiskUsage(mountPointFilter, mountOptsExclude, fstypeExclude []string) ([]*disk.UsageStat, []*disk.PartitionStat, error)
DiskUsage returns the disk usage statistics.
func (*SystemPS) NetConnections ¶
func (*SystemPS) NetConnections() ([]net.ConnectionStat, error)
NetConnections returns a list of network connections opened.
func (*SystemPS) NetConntrack ¶
func (*SystemPS) NetConntrack(perCPU bool) ([]net.ConntrackStat, error)
NetConntrack returns more detailed info about the conntrack table.
func (*SystemPS) NetIO ¶
func (*SystemPS) NetIO() ([]net.IOCountersStat, error)
NetIO returns network I/O statistics for every network interface installed on the system.
func (*SystemPS) NetProto ¶
func (*SystemPS) NetProto() ([]net.ProtoCountersStat, error)
NetProto returns network statistics for the entire system.
type SystemPSDisk ¶
type SystemPSDisk struct{}
SystemPSDisk is a struct that implements the PSDiskDeps interface.
func (*SystemPSDisk) OSGetenv ¶
func (*SystemPSDisk) OSGetenv(key string) string
OSGetenv returns the value of the environment variable named by the key.
func (*SystemPSDisk) OSStat ¶
func (*SystemPSDisk) OSStat(name string) (os.FileInfo, error)
OSStat returns the FileInfo structure describing the named file.
func (*SystemPSDisk) PSDiskUsage ¶
func (*SystemPSDisk) PSDiskUsage(path string) (*disk.UsageStat, error)
PSDiskUsage returns a file system usage for the specified path.
func (*SystemPSDisk) Partitions ¶
func (*SystemPSDisk) Partitions(all bool) ([]disk.PartitionStat, error)
Partitions returns the disk partition statistics.