Documentation
¶
Index ¶
- Constants
- func NewGlobalStats(nodes *Nodes, sitesDomains map[string][]string) (result map[string]map[string]*GlobalStats)
- func SaveJSON(input interface{}, outputFile string)
- func SaveJSONL(input []interface{}, outputFile string)
- type CounterMap
- type GlobalStats
- type Link
- type LinkProtocol
- type LinkType
- type Node
- type Nodes
- func (nodes *Nodes) AddNode(node *Node)
- func (nodes *Nodes) GetNodeIDbyAddress(addr string) string
- func (nodes *Nodes) NodeLinks(node *Node) (result []Link)
- func (nodes *Nodes) Select(f func(*Node) bool) []*Node
- func (nodes *Nodes) Start()
- func (nodes *Nodes) Update(nodeID string, res *data.ResponseData) *Node
- type NodesConfig
Constants ¶
View Source
const ( DISABLED_AUTOUPDATER = "disabled" GLOBAL_SITE = "global" GLOBAL_DOMAIN = "global" )
Variables ¶
This section is empty.
Functions ¶
func NewGlobalStats ¶
func NewGlobalStats(nodes *Nodes, sitesDomains map[string][]string) (result map[string]map[string]*GlobalStats)
NewGlobalStats returns global statistics for InfluxDB
Types ¶
type CounterMap ¶
CounterMap to manage multiple values
func (CounterMap) Increment ¶
func (m CounterMap) Increment(key string)
Increment counter in the map by one if the value is not empty
type GlobalStats ¶
type GlobalStats struct {
Clients uint32
ClientsWifi uint32
ClientsWifi24 uint32
ClientsWifi5 uint32
ClientsOWE uint32
ClientsOWE24 uint32
ClientsOWE5 uint32
Gateways uint32
Nodes uint32
Firmwares CounterMap
Models CounterMap
Autoupdater CounterMap
}
GlobalStats struct
func (*GlobalStats) Add ¶
func (s *GlobalStats) Add(node *Node)
Add values to GlobalStats if node is online
type Link ¶
type Link struct {
SourceID string
SourceHostname string
SourceAddress string
TargetID string
TargetAddress string
TargetHostname string
TQ float32
Type LinkType
Protocol LinkProtocol
}
Link represents a link between two nodes
type LinkProtocol ¶ added in v1.8.0
type LinkProtocol int
const ( UnknownLinkProtocol LinkProtocol = iota BatadvLinkProtocol BabelLinkProtocol LLDPLinkProtocol )
func (LinkProtocol) String ¶ added in v1.8.0
func (lp LinkProtocol) String() string
type Node ¶
type Node struct {
Address *net.UDPAddr `json:"-"` // the last known address
Firstseen jsontime.Time `json:"firstseen"`
Lastseen jsontime.Time `json:"lastseen"`
Online bool `json:"online"`
Statistics *data.Statistics `json:"statistics"`
Nodeinfo *data.Nodeinfo `json:"nodeinfo"`
Neighbours *data.Neighbours `json:"-"`
CustomFields map[string]interface{} `json:"custom_fields"`
}
Node struct
type Nodes ¶
type Nodes struct {
List map[string]*Node `json:"nodes"` // the current nodemap, indexed by node ID
sync.RWMutex
// contains filtered or unexported fields
}
Nodes struct: cache DB of Node's structs
func (*Nodes) GetNodeIDbyAddress ¶
type NodesConfig ¶
type NodesConfig struct {
StatePath string `toml:"state_path"`
SaveInterval duration.Duration `toml:"save_interval"` // Save nodes periodically
OfflineAfter duration.Duration `toml:"offline_after"` // Set node to offline if not seen within this period
PruneAfter duration.Duration `toml:"prune_after"` // Remove nodes after n days of inactivity
Output map[string]interface{}
}
Click to show internal directories.
Click to hide internal directories.