Documentation
¶
Index ¶
- Constants
- Variables
- func FormatPercent(percent float64) string
- func FormatSize(size uint64) string
- func LoadStartTime()
- func ReadConnIp(field string, lenBytes int) (net.IP, uint64, error)
- func ReadUint(val string) uint64
- type ConcreteSigar
- func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
- func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error)
- func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error)
- func (c *ConcreteSigar) GetMem() (Mem, error)
- func (c *ConcreteSigar) GetSwap() (Swap, error)
- func (c *ConcreteSigar) GetSystemInfo() (SystemInfo, error)
- type Cpu
- type CpuList
- type DiskIo
- type DiskList
- type FileSystem
- type FileSystemList
- type FileSystemUsage
- type Getter
- type ICMPStats
- type IPStats
- type LoadAverage
- type Mem
- type NetConn
- type NetConnProto
- type NetConnState
- type NetIface
- type NetIfaceList
- type NetProtoV4Stats
- type NetProtoV6Stats
- type NetRawConnList
- type NetRawV6ConnList
- type NetTcpConnList
- type NetTcpV6ConnList
- type NetUdpConnList
- type NetUdpV6ConnList
- type ProcArgs
- type ProcExe
- type ProcIo
- type ProcList
- type ProcMem
- type ProcState
- type ProcTime
- type Process
- type ProcessList
- type RunState
- type Sigar
- type Swap
- type SystemDistribution
- type SystemInfo
- type TCPStats
- type UDPStats
- type Uptime
Constants ¶
View Source
const ( ConnProtoUdp = NetConnProto(iota + 1) ConnProtoTcp ConnProtoRaw )
View Source
const ( ConnStateEstablished = NetConnState(iota + 1) ConnStateSynSent ConnStateSynRecv ConnStateFinWait1 ConnStateFinWait2 ConnStateTimeWait ConnStateClose ConnStateCloseWait ConnStateLastAck ConnStateListen ConnStateClosing )
View Source
const ( RunStateSleep = 'S' RunStateRun = 'R' RunStateStop = 'T' RunStateZombie = 'Z' RunStateIdle = 'D' RunStateUnknown = '?' )
Variables ¶
View Source
var ErrNotImplemented error = errors.New("Collection not implemented for this operating system")
View Source
var Etcd string
View Source
var Procd string
View Source
var Sysd string
Functions ¶
func FormatPercent ¶
func LoadStartTime ¶
func LoadStartTime()
func ReadConnIp ¶
Decode an IP:port pair, with either a 16 or 4-byte address and 2-byte port,
both hex-encoded. TODO: Test on a big-endian architecture.
Types ¶
type ConcreteSigar ¶
type ConcreteSigar struct{}
func (*ConcreteSigar) CollectCpuStats ¶
func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
func (*ConcreteSigar) GetFileSystemUsage ¶
func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error)
func (*ConcreteSigar) GetLoadAverage ¶
func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error)
func (*ConcreteSigar) GetMem ¶
func (c *ConcreteSigar) GetMem() (Mem, error)
func (*ConcreteSigar) GetSwap ¶
func (c *ConcreteSigar) GetSwap() (Swap, error)
func (*ConcreteSigar) GetSystemInfo ¶
func (c *ConcreteSigar) GetSystemInfo() (SystemInfo, error)
type Cpu ¶
type DiskIo ¶
type FileSystem ¶
type FileSystemList ¶
type FileSystemList struct {
List []FileSystem
}
func (*FileSystemList) Get ¶
func (self *FileSystemList) Get() error
type FileSystemUsage ¶
type FileSystemUsage struct {
Total uint64
Used uint64
Free uint64
Avail uint64
Files uint64
FreeFiles uint64
}
func (*FileSystemUsage) Get ¶
func (self *FileSystemUsage) Get(path string) error
func (*FileSystemUsage) UsePercent ¶
func (self *FileSystemUsage) UsePercent() float64
type LoadAverage ¶
type LoadAverage struct {
One, Five, Fifteen float64
}
func (*LoadAverage) Get ¶
func (self *LoadAverage) Get() error
type NetConn ¶
type NetConnProto ¶
type NetConnProto int
func (NetConnProto) String ¶
func (self NetConnProto) String() string
type NetConnState ¶
type NetConnState int
func (NetConnState) String ¶
func (self NetConnState) String() string
type NetIface ¶
type NetIface struct {
Name string
MTU uint64
Mac string
LinkStatus string
SendBytes uint64
RecvBytes uint64
SendPackets uint64
RecvPackets uint64
SendCompressed uint64
RecvCompressed uint64
RecvMulticast uint64
SendErrors uint64
RecvErrors uint64
SendDropped uint64
RecvDropped uint64
SendFifoErrors uint64
RecvFifoErrors uint64
RecvFramingErrors uint64
SendCarrier uint64
SendCollisions uint64
}
type NetIfaceList ¶
type NetIfaceList struct {
List []NetIface
}
func (*NetIfaceList) Get ¶
func (self *NetIfaceList) Get() error
type NetProtoV4Stats ¶
func (*NetProtoV4Stats) Get ¶
func (self *NetProtoV4Stats) Get() error
type NetProtoV6Stats ¶
func (*NetProtoV6Stats) Get ¶
func (self *NetProtoV6Stats) Get() error
type NetRawConnList ¶
type NetRawConnList struct {
List []NetConn
}
func (*NetRawConnList) Get ¶
func (self *NetRawConnList) Get() error
type NetRawV6ConnList ¶
type NetRawV6ConnList struct {
List []NetConn
}
func (*NetRawV6ConnList) Get ¶
func (self *NetRawV6ConnList) Get() error
type NetTcpConnList ¶
type NetTcpConnList struct {
List []NetConn
}
func (*NetTcpConnList) Get ¶
func (self *NetTcpConnList) Get() error
type NetTcpV6ConnList ¶
type NetTcpV6ConnList struct {
List []NetConn
}
func (*NetTcpV6ConnList) Get ¶
func (self *NetTcpV6ConnList) Get() error
type NetUdpConnList ¶
type NetUdpConnList struct {
List []NetConn
}
func (*NetUdpConnList) Get ¶
func (self *NetUdpConnList) Get() error
type NetUdpV6ConnList ¶
type NetUdpV6ConnList struct {
List []NetConn
}
func (*NetUdpV6ConnList) Get ¶
func (self *NetUdpV6ConnList) Get() error
type ProcMem ¶
type ProcState ¶
type ProcTime ¶
type ProcTime struct {
CollectionTime time.Time
StartTime uint64 // Milliseconds since epoch
User uint64 // User time in milliseconds
Sys uint64 // System time in milliseconds
Total uint64 // Total time in milliseconds
// Not valid until after CalculateCpuPercent()
PercentUserTime uint64
PercentSysTime uint64
PercentTotalTime uint64
}
func (*ProcTime) CalculateCpuPercent ¶
Calculate percent of CPU usage by diffing counters. The "other" ProcTime should be from an earlier reading.
func (*ProcTime) FormatStartTime ¶
func (*ProcTime) FormatTotal ¶
type ProcessList ¶
type ProcessList struct {
List []Process
}
func (*ProcessList) Get ¶
func (self *ProcessList) Get() error
type Sigar ¶
type Sigar interface {
CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
GetLoadAverage() (LoadAverage, error)
GetMem() (Mem, error)
GetSwap() (Swap, error)
GetFileSystemUsage(string) (FileSystemUsage, error)
GetSystemInfo() (SystemInfo, error)
GetSystemDistribution() (SystemDistribution, error)
}
type SystemDistribution ¶
type SystemDistribution struct {
Description string
}
func (*SystemDistribution) Get ¶
func (self *SystemDistribution) Get() error
type SystemInfo ¶
type SystemInfo struct {
Sysname string
Nodename string
Release string
Version string
Machine string
Domainname string
}
func (*SystemInfo) Get ¶
func (self *SystemInfo) Get() error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.