Add temp input plugin (#4411)

This commit is contained in:
pytimer
2018-09-11 02:52:15 +08:00
committed by Daniel Nelson
parent 69100f60b8
commit 25f9cc0b8d
6 changed files with 133 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/load"
"github.com/shirou/gopsutil/mem"
@@ -100,6 +101,15 @@ func (m *MockPS) SwapStat() (*mem.SwapMemoryStat, error) {
return r0, r1
}
func (m *MockPS) Temperature() ([]host.TemperatureStat, error) {
ret := m.Called()
r0 := ret.Get(0).([]host.TemperatureStat)
r1 := ret.Error(1)
return r0, r1
}
func (m *MockPS) NetConnections() ([]net.ConnectionStat, error) {
ret := m.Called()

View File

@@ -10,6 +10,7 @@ import (
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/mem"
"github.com/shirou/gopsutil/net"
)
@@ -23,6 +24,7 @@ type PS interface {
VMStat() (*mem.VirtualMemoryStat, error)
SwapStat() (*mem.SwapMemoryStat, error)
NetConnections() ([]net.ConnectionStat, error)
Temperature() ([]host.TemperatureStat, error)
}
type PSDiskDeps interface {
@@ -168,6 +170,10 @@ func (s *SystemPS) SwapStat() (*mem.SwapMemoryStat, error) {
return mem.SwapMemory()
}
func (s *SystemPS) Temperature() ([]host.TemperatureStat, error) {
return host.SensorsTemperatures()
}
func (s *SystemPSDisk) Partitions(all bool) ([]disk.PartitionStat, error) {
return disk.Partitions(all)
}