statgo: github.com/akhenakh/statgo Index | Files

package statgo

import "github.com/akhenakh/statgo"

Index

Package Files

cpu_stats.go diskio_stats.go fs_infos.go host_info.go interfaces_infos.go mem_stats.go net_io_stats.go pages_stats.go process_stats.go statgo.go

type CPUStats Uses

type CPUStats struct {
    User   float64
    Kernel float64
    Idle   float64
    IOWait float64
    Swap   float64
    Nice   float64

    // System load averages
    LoadMin1  float64
    LoadMin5  float64
    LoadMin15 float64

    // The time taken in seconds since the last call of the function
    Period time.Duration

    TimeTaken time.Time
}

CPUStats contains cpu stats Delivers correlated relative cpu counters (where total is 100%)

func (*CPUStats) String Uses

func (c *CPUStats) String() string

type DiskIOStats Uses

type DiskIOStats struct {
    DiskName   string
    ReadBytes  int
    WriteBytes int

    // The time period over which read_bytes and write_bytes were transferred.
    Period time.Duration

    TimeTaken time.Time
}

DiskIOStats contains disk io stats Expressed in bytes

func (*DiskIOStats) String Uses

func (d *DiskIOStats) String() string

type FSInfos Uses

type FSInfos struct {
    DeviceName string
    FSType     string
    MountPoint string

    // Size, Used, Free, Available are expressed in bytes
    Size      int
    Used      int
    Free      int
    Available int

    // Inodes count
    TotalInodes     int
    UsedInodes      int
    FreeInodes      int
    AvailableInodes int
}

FSInfos contains filesystem & mountpoints informations

func (*FSInfos) String Uses

func (fs *FSInfos) String() string

type HostInfos Uses

type HostInfos struct {
    OSName    string
    OSRelease string
    OSVersion string
    Platform  string
    HostName  string
    NCPUs     int
    MaxCPUs   int
    BitWidth  int //32, 64 bits
    // contains filtered or unexported fields
}

HostInfos contains informations related to the system

func (*HostInfos) String Uses

func (h *HostInfos) String() string

type InterfaceDuplexType Uses

type InterfaceDuplexType int

InterfaceDuplexType network interface duplex type

const (
    InterfaceFullDuplex InterfaceDuplexType = iota
    InterfaceHalfDuplex
    InterfaceUnknownDuplex
)

func (InterfaceDuplexType) MarshalText Uses

func (s InterfaceDuplexType) MarshalText() ([]byte, error)

func (InterfaceDuplexType) String Uses

func (s InterfaceDuplexType) String() string

func (*InterfaceDuplexType) UnmarshalText Uses

func (s *InterfaceDuplexType) UnmarshalText(text []byte) error

type InterfaceInfos Uses

type InterfaceInfos struct {
    Name string
    // Speed in factor/sec
    Speed  int
    Factor int
    Duplex InterfaceDuplexType
    State  InterfaceState
}

InterfaceInfos network interface related infos

func (*InterfaceInfos) String Uses

func (i *InterfaceInfos) String() string

type InterfaceState Uses

type InterfaceState int

InterfaceState up or down

const (
    InterfaceUpState InterfaceState = iota
    InterfaceDownState
)

func (InterfaceState) MarshalText Uses

func (s InterfaceState) MarshalText() ([]byte, error)

func (InterfaceState) String Uses

func (s InterfaceState) String() string

func (*InterfaceState) UnmarshalText Uses

func (s *InterfaceState) UnmarshalText(text []byte) error

type MemStats Uses

type MemStats struct {
    // The total amount of real memory in bytes
    Total int

    // Theount of real memory in bytes.
    Free int

    // The used amount of real memory in bytes
    Used int

    // The amount of real memory in bytes used for caching
    Cache int

    // The total swap space in bytes.
    SwapTotal int

    // The used swap in bytes
    SwapUsed int

    // The free swap in bytes
    SwapFree int
}

MemStats contains memory & swap stats expressed in bytes

func (*MemStats) String Uses

func (m *MemStats) String() string

type NetIOStats Uses

type NetIOStats struct {
    IntName string

    // Number of bytes transmitted
    TX  int

    // Number of bytes received
    RX  int

    // Number of packets received
    IPackets int

    // Number of packets transmitted
    OPackets int

    // Number of receive errors
    IErrors int

    // Number of transmit errors
    OErrors int

    // Number of collisions count
    Collisions int

    // the time period over which tx and rx were transferred
    Period time.Duration

    TimeTaken time.Time
}

NetIOStats contains network interfaces stats

func (*NetIOStats) String Uses

func (n *NetIOStats) String() string

type PageStats Uses

type PageStats struct {
    // The number of pages swapped into memory.
    PageIn int

    // The number of pages swapped out of memory (to swap).
    PageOut int

    // The time period over which pages_pagein and pages_pageout weretransferred.
    Period time.Duration

    TimeTaken time.Time
}

PageStats contains pages stats

func (*PageStats) String Uses

func (p *PageStats) String() string

type ProcessStats Uses

type ProcessStats struct {
    // The total number of processes
    Total int

    // The number of running processes
    Running int

    // The number of sleeping processes
    Sleeping int

    // The number of stopped processes
    Stopped int

    // The number of zombie processes
    Zombie int
}

ProcessStats contains processes count stats

func (*ProcessStats) String Uses

func (p *ProcessStats) String() string

type Stat Uses

type Stat struct {
    sync.Mutex
    // contains filtered or unexported fields
}

Stat handle to access libstatgrab

func NewStat Uses

func NewStat() *Stat

NewStat return a new Stat handle

func (*Stat) CPUStats Uses

func (s *Stat) CPUStats() *CPUStats

CPUStats get cpu related stats note that 1st call to 100ms may return NaN as values Go equivalent to sg_cpu_percents

func (*Stat) DiskIOStats Uses

func (s *Stat) DiskIOStats() []*DiskIOStats

DiskIOStats get I/Os related stats note that 1st call to 100ms may return NaN as values Go equivalent to sg_disk_io_stats

func (*Stat) FSInfos Uses

func (s *Stat) FSInfos() []*FSInfos

FSInfos return an FSInfo struct per mounted filesystem Go equivalent to sg_get_fs_stats

func (*Stat) HostInfos Uses

func (s *Stat) HostInfos() *HostInfos

HostInfos get the host informations Go equivalent to sg_host_info

func (*Stat) InteraceInfos Uses

func (s *Stat) InteraceInfos() []*InterfaceInfos

func (*Stat) MemStats Uses

func (s *Stat) MemStats() *MemStats

MemStats get memory & swap related stats Go equivalent to sg_get_mem_stats & sg_get_swap_stats

func (*Stat) NetIOStats Uses

func (s *Stat) NetIOStats() []*NetIOStats

NetIOStats get interface ios related stats Go equivalent to sg_get_network_io_stats

func (*Stat) PageStats Uses

func (s *Stat) PageStats() *PageStats

PageStats get pages related stats Go equivalent to sg_get_page_stats_diff

func (*Stat) ProcessStats Uses

func (s *Stat) ProcessStats() *ProcessStats

ProcessStats get prceosses related stats note that 1st call to 100ms may return NaN as values Go equivalent to sg_cpu_percents

Package statgo imports 6 packages (graph) and is imported by 1 packages. Updated 2017-10-21. Refresh now. Tools for package owners.