Documentation
¶
Index ¶
- Constants
- func ByteConverter(n int) string
- func Bytes(b int) string
- func GetCpuValues(c chan []*CpuUsage, refresh int)
- func GetDiskUsage(c chan []*DiskStat, refresh int)
- func GetKeyOrNone(key string, m map[string]int) int
- func GetNetValues(c chan NetUsage, refresh int)
- func PollNetworkStatistics() (ifaces map[string]*Iface, err error)
- func PrintMemoryUsage()
- func ValueToInteger(s string) int
- type CpuUsage
- type DiskStat
- type Iface
- type MemoryStats
- type MemoryUsage
- type NetUsage
- type RxData
- type TxData
- type Usage
Constants ¶
View Source
const ( KiB MiB GiB TiB )
View Source
const ( SwapTotal = iota SwapFree MemTotal MemFree Buffers Cached Slab )
Variables ¶
This section is empty.
Functions ¶
func ByteConverter ¶
func GetCpuValues ¶
GetCpuValues polls the cpu statistics for a given interval in seconds
func GetDiskUsage ¶
GetDiskUsage polls storage device statistics for a given interval in seconds
func GetNetValues ¶
GetNetValues polls the network statistics for a given interval in seconds
func PollNetworkStatistics ¶
func PrintMemoryUsage ¶
func PrintMemoryUsage()
func ValueToInteger ¶
Types ¶
type CpuUsage ¶
type CpuUsage struct {
Name string `json:"name"`
Time time.Time `json:"time"`
Usage float64 `json:"percent_used"`
}
CpuUsage type represents the utilization of a given cpu
type DiskStat ¶
type DiskStat struct {
Dev string `json:"device"`
Rsuccess int `json:"read_success"`
Rmerged int `json:"read_merged"`
SectorRead int `json:"sector_read"`
Rtime int `json:"time_reading"`
Wcomplete int `json:"write_complete"`
Wmerged int `json:"write_merged"`
SectorWritten int `json:"sector_written"`
Wtime int `json:"time_writing"`
IOinProg int `json:"current_io"`
IOtime int `json:"time_io"`
WeightedTimeIO int `json:"weighted_time_io"`
Time time.Time `json:"time"`
}
DiskStat type represents the utilization of a given partition
type Iface ¶
func (*Iface) BytesReceivedToHumanReadable ¶
func (*Iface) BytesTransmittedToHumanReadable ¶
func (*Iface) TotalBytesToHumanReadable ¶
type MemoryStats ¶
type MemoryStats struct {
SwapTotal,
SwapFree,
MemTotal,
MemFree,
Buffers,
Cached,
Slab int
}
MemoryStats type holds raw data used to calculate usage
type MemoryUsage ¶
type MemoryUsage struct {
Time time.Time `json:"time"`
Swap int `json:"swap_used"`
Used int `json:"percent_used"`
Total int `json:"total_memory"`
Free int `json:"free"`
Buff int `json:"buffered"`
Cached int `json:"cached"`
Slab int `json:"slab"`
}
MemoryUsage type represents the memory util at a given time
func GetMemoryUsage ¶
func GetMemoryUsage() *MemoryUsage
GetMemoryUsage reads the system memory stats and calculates the usage
func (*MemoryUsage) String ¶
func (m *MemoryUsage) String() string
type NetUsage ¶
type NetUsage struct {
Name string `json:"name"`
Time time.Time `json:"time"`
Ifaces []Iface `json:"ifaces"`
}
NetUsage type represents the utilization of a given network interface
Click to show internal directories.
Click to hide internal directories.