Documentation
¶
Overview ¶
Teonet v5 monitoring client package
Index ¶
- Constants
- type Metric
- type Monitor
- type Parameter
- type Parameters
- type Peers
- func (p *Peers) Add(metric *Metric)
- func (p *Peers) Del(address string) (m *Metric, ok bool)
- func (p *Peers) Each(f func(m *Metric))
- func (p *Peers) Get(address string) (m *Metric, ok bool)
- func (p Peers) Json() (data []byte, err error)
- func (p *Peers) Load(file string) (err error)
- func (p *Peers) MarshalBinary() (data []byte, err error)
- func (p *Peers) Save(file string) (err error)
- func (p Peers) String() (str string)
- func (p *Peers) UnmarshalBinary(data []byte) (err error)
- type TeonetInterface
Constants ¶
const ( CmdMetric byte = 130 CmdParameter byte = 131 )
Comand constant
const ( ParamOnline = "online" ParamPeers = "peers" ParamHost = "host" ParamMachineID = "machineid" MayOffline = "mayoffline" )
Param constant
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metric ¶
type Metric struct {
Address string
AppName string
AppShort string
AppVersion string
TeoVersion string
AppStartTime time.Time
New bool
Params *Parameters
bslice.ByteSlice
}
Metric contain metric struct and methods receiver
func (Metric) MarshalBinary ¶
MarshalBinary binary marshal Metric struct
func (*Metric) UnmarshalBinary ¶
UnmarshalBinary binary unmarshal Metric struct
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Teonet monitor struct
func Connect ¶
func Connect(teo TeonetInterface, address string, m Metric, t ...TeonetInterface) (mon *Monitor)
Connect to monitor peer and send metric
type Parameter ¶
Parameter struct and methods receiver
func (Parameter) MarshalBinary ¶
MarshalBinary binary marshal Parameter struct
func (*Parameter) UnmarshalBinary ¶
UnmarshalBinary binary unmarshal Parameter struct
type Parameters ¶
Parameters is metric parameters struct and methods receiver
func (*Parameters) Add ¶
func (p *Parameters) Add(name string, val interface{})
add or update parameter
func (*Parameters) Each ¶
func (p *Parameters) Each(f func(name string, value interface{}))
Each execute callback for each Parameter
func (*Parameters) Get ¶
func (p *Parameters) Get(name string) (val interface{}, ok bool)
get parameter
type Peers ¶
Peers struct and methods receiver
func (*Peers) MarshalBinary ¶
MarshalBinary binary marshal Peers struct
func (*Peers) UnmarshalBinary ¶
UnmarshalBinary binary unmarshal Peers struct
type TeonetInterface ¶
type TeonetInterface interface {
WhenConnectedDisconnected(f func(e byte))
WhenConnectedTo(address string, f func())
ConnectTo(address string, attr ...interface{}) error
SendTo(address string, data []byte, attr ...interface{}) (int, error)
Address() string
NumPeers() int
}
TeonetInterface define teonet functions used in teomon