Documentation ¶
Index ¶
- Constants
- Variables
- func CombineToSeconds(days, hours, minutes, seconds int) int
- func GatherCores() (int, error)
- func GatherLoadAverage() (one, five, fifteen string, err error)
- func GatherLocalIPAddresses() ([]net.IP, error)
- func GatherTCPConnections() (tcp4, tcp6 int, err error)
- func GatherUptime() (days, hours, minutes, seconds int, err error)
- func SplitSeconds(in int) (days, hours, minutes, seconds int)
- type BulkElement
- type ConnectionsWidget
- func (widget *ConnectionsWidget) Configuration() interface{}
- func (widget *ConnectionsWidget) Configure(json.RawMessage) error
- func (widget *ConnectionsWidget) HasData() bool
- func (widget *ConnectionsWidget) Identifier() string
- func (widget *ConnectionsWidget) Name() string
- func (widget *ConnectionsWidget) Start() error
- func (widget *ConnectionsWidget) Type() string
- func (widget *ConnectionsWidget) Update() error
- type LoadWidget
- func (widget *LoadWidget) Configuration() interface{}
- func (widget *LoadWidget) Configure(json.RawMessage) error
- func (widget *LoadWidget) HasData() bool
- func (widget *LoadWidget) Identifier() string
- func (widget *LoadWidget) Name() string
- func (widget *LoadWidget) Start() error
- func (widget *LoadWidget) Type() string
- func (widget *LoadWidget) Update() error
- type Meminfo
- type MeminfoWidget
- func (widget *MeminfoWidget) Configuration() interface{}
- func (widget *MeminfoWidget) Configure(json.RawMessage) error
- func (widget *MeminfoWidget) HasData() bool
- func (widget *MeminfoWidget) Identifier() string
- func (widget *MeminfoWidget) Name() string
- func (widget *MeminfoWidget) Start() error
- func (widget *MeminfoWidget) Type() string
- func (widget *MeminfoWidget) Update() error
- type NetworkDevice
- type NetworkWidget
- func (widget *NetworkWidget) Configuration() interface{}
- func (widget *NetworkWidget) Configure(c json.RawMessage) error
- func (widget *NetworkWidget) HasData() bool
- func (widget *NetworkWidget) Identifier() string
- func (widget *NetworkWidget) Name() string
- func (widget *NetworkWidget) Start() error
- func (widget *NetworkWidget) Type() string
- func (widget *NetworkWidget) Update() error
- type TCPInfo
- type TCPState
- type UptimeWidget
- func (widget *UptimeWidget) Configuration() interface{}
- func (widget *UptimeWidget) Configure(json.RawMessage) error
- func (widget *UptimeWidget) HasData() bool
- func (widget *UptimeWidget) Identifier() string
- func (widget *UptimeWidget) MarshalJSON() ([]byte, error)
- func (widget *UptimeWidget) Name() string
- func (widget *UptimeWidget) Start() error
- func (widget *UptimeWidget) Type() string
- func (widget *UptimeWidget) UnmarshalJSON(data []byte) error
- func (widget *UptimeWidget) Update() error
- type Widget
- type WidgetInitiator
Constants ¶
View Source
const ConnectionsWidgetType = "connections"
View Source
const LoadWidgetType = "load"
View Source
const MeminfoWidgetType = "meminfo"
View Source
const NetworkWidgetType = "network"
View Source
const UptimeWidgetType = "uptime"
Variables ¶
View Source
var AllWidgets = map[string]WidgetInitiator{ LoadWidgetType: func() Widget { return &LoadWidget{} }, UptimeWidgetType: func() Widget { return &UptimeWidget{} }, MeminfoWidgetType: func() Widget { return &MeminfoWidget{} }, ConnectionsWidgetType: func() Widget { return &ConnectionsWidget{} }, NetworkWidgetType: func() Widget { return &NetworkWidget{} }, }
View Source
var LoadAverageRegexp = regexp.MustCompile("^([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)")
View Source
var LoadCoresRegexp = regexp.MustCompile("^processor")
View Source
var MeminfoRegexp = regexp.MustCompile("^([^:]*):\\s+(\\d+)")
View Source
var NetworkDeviceSplitRegexp = regexp.MustCompile("\\s+")
View Source
var TCPInfoRegexp = regexp.MustCompile("^\\s*(\\d+): ([0-9a-fA-F]+):([0-9a-fA-F]+) ([0-9a-fA-F]+):([0-9a-fA-F]+) ([0-9a-fA-F]+)")
Functions ¶
func CombineToSeconds ¶
func GatherCores ¶
func GatherLoadAverage ¶
func GatherLocalIPAddresses ¶
func GatherTCPConnections ¶
func GatherUptime ¶
func SplitSeconds ¶
Types ¶
type BulkElement ¶
type BulkElement struct { Type string `json:"type"` Identifier string `json:"identifier"` Widget json.RawMessage `json:"widget"` }
type ConnectionsWidget ¶
func (*ConnectionsWidget) Configuration ¶
func (widget *ConnectionsWidget) Configuration() interface{}
func (*ConnectionsWidget) Configure ¶
func (widget *ConnectionsWidget) Configure(json.RawMessage) error
func (*ConnectionsWidget) HasData ¶
func (widget *ConnectionsWidget) HasData() bool
func (*ConnectionsWidget) Identifier ¶
func (widget *ConnectionsWidget) Identifier() string
func (*ConnectionsWidget) Name ¶
func (widget *ConnectionsWidget) Name() string
func (*ConnectionsWidget) Start ¶
func (widget *ConnectionsWidget) Start() error
func (*ConnectionsWidget) Type ¶
func (widget *ConnectionsWidget) Type() string
func (*ConnectionsWidget) Update ¶
func (widget *ConnectionsWidget) Update() error
type LoadWidget ¶
type LoadWidget struct { One string `json:"one"` Five string `json:"five"` Fifteen string `json:"fifteen"` Cores int `json:"cores"` }
func (*LoadWidget) Configuration ¶
func (widget *LoadWidget) Configuration() interface{}
func (*LoadWidget) Configure ¶
func (widget *LoadWidget) Configure(json.RawMessage) error
func (*LoadWidget) HasData ¶
func (widget *LoadWidget) HasData() bool
func (*LoadWidget) Identifier ¶
func (widget *LoadWidget) Identifier() string
func (*LoadWidget) Name ¶
func (widget *LoadWidget) Name() string
func (*LoadWidget) Start ¶
func (widget *LoadWidget) Start() error
func (*LoadWidget) Type ¶
func (widget *LoadWidget) Type() string
func (*LoadWidget) Update ¶
func (widget *LoadWidget) Update() error
type Meminfo ¶
type Meminfo struct { MainTotalKB uint64 MainFreeKB uint64 MainBuffersKB uint64 MainCachedKB uint64 MainUsedKB uint64 }
func GatherMeminfo ¶
type MeminfoWidget ¶
func (*MeminfoWidget) Configuration ¶
func (widget *MeminfoWidget) Configuration() interface{}
func (*MeminfoWidget) Configure ¶
func (widget *MeminfoWidget) Configure(json.RawMessage) error
func (*MeminfoWidget) HasData ¶
func (widget *MeminfoWidget) HasData() bool
func (*MeminfoWidget) Identifier ¶
func (widget *MeminfoWidget) Identifier() string
func (*MeminfoWidget) Name ¶
func (widget *MeminfoWidget) Name() string
func (*MeminfoWidget) Start ¶
func (widget *MeminfoWidget) Start() error
func (*MeminfoWidget) Type ¶
func (widget *MeminfoWidget) Type() string
func (*MeminfoWidget) Update ¶
func (widget *MeminfoWidget) Update() error
type NetworkDevice ¶
func GatherNetDevInfo ¶
func GatherNetDevInfo() ([]NetworkDevice, error)
func NewNetworkDevice ¶
func NewNetworkDevice(line string) *NetworkDevice
type NetworkWidget ¶
type NetworkWidget struct { Interface string `json:"interface"` Interval float64 `json:"interval"` Received int `json:"received"` Transmitted int `json:"transmitted"` // contains filtered or unexported fields }
func (*NetworkWidget) Configuration ¶
func (widget *NetworkWidget) Configuration() interface{}
func (*NetworkWidget) Configure ¶
func (widget *NetworkWidget) Configure(c json.RawMessage) error
func (*NetworkWidget) HasData ¶
func (widget *NetworkWidget) HasData() bool
func (*NetworkWidget) Identifier ¶
func (widget *NetworkWidget) Identifier() string
func (*NetworkWidget) Name ¶
func (widget *NetworkWidget) Name() string
func (*NetworkWidget) Start ¶
func (widget *NetworkWidget) Start() error
func (*NetworkWidget) Type ¶
func (widget *NetworkWidget) Type() string
func (*NetworkWidget) Update ¶
func (widget *NetworkWidget) Update() error
type TCPInfo ¶
type TCPInfo struct { Entry uint // sl LocalIP net.IP // local_address LocalPort uint16 // local_address RemoteIP net.IP // remote_address RemotePort uint16 // remote_address State TCPState // st }
func GatherTCP4Infos ¶
func GatherTCP6Infos ¶
func GatherTCPInfos ¶
func NewTCPInfo ¶
type UptimeWidget ¶
func (*UptimeWidget) Configuration ¶
func (widget *UptimeWidget) Configuration() interface{}
func (*UptimeWidget) Configure ¶
func (widget *UptimeWidget) Configure(json.RawMessage) error
func (*UptimeWidget) HasData ¶
func (widget *UptimeWidget) HasData() bool
func (*UptimeWidget) Identifier ¶
func (widget *UptimeWidget) Identifier() string
func (*UptimeWidget) MarshalJSON ¶
func (widget *UptimeWidget) MarshalJSON() ([]byte, error)
func (*UptimeWidget) Name ¶
func (widget *UptimeWidget) Name() string
func (*UptimeWidget) Start ¶
func (widget *UptimeWidget) Start() error
func (*UptimeWidget) Type ¶
func (widget *UptimeWidget) Type() string
func (*UptimeWidget) UnmarshalJSON ¶
func (widget *UptimeWidget) UnmarshalJSON(data []byte) error
func (*UptimeWidget) Update ¶
func (widget *UptimeWidget) Update() error
type Widget ¶
type Widget interface { // Name should return a human-readable name for this widget describing what // it does. Name() string // Type should return the type of the widget. // unique among other widgets. Type() string // Identifier should return an unique identifier for the widget. It should // be based on its type and configuration. Identifier() string // HasData should return whether the widget has data to display. This should // default to false and become true when the widget gets information from // the client for the first time. HasData() bool // Update should update widget with the most recent information Update() error // Configure should configure a widget using data from the configuration // file. Configure(data json.RawMessage) error // Configuration should return the widget configuration Configuration() interface{} // Start should start any background processes needed to e.g. gather data, // if necessary. Start() error }
Widget defines the interface for a general widget.
type WidgetInitiator ¶
type WidgetInitiator func() Widget
Click to show internal directories.
Click to hide internal directories.