From e1b84dc21bed0879323c2ff1ff51c117cc680fbd Mon Sep 17 00:00:00 2001 From: Martin Geno Date: Fri, 15 Jul 2016 16:34:16 +0200 Subject: [PATCH] add txpower (for check controller) --- stats_db.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/stats_db.go b/stats_db.go index 2bb3825..b9dcab5 100644 --- a/stats_db.go +++ b/stats_db.go @@ -52,14 +52,6 @@ func (c *StatsDb) Add(nodeId string, node *models.Node) { "nodeid": nodeId, } - if nodeinfo := node.Nodeinfo; nodeinfo != nil { - if owner := nodeinfo.Owner; owner != nil { - tags["owner"] = owner.Contact - } - // morpheus needs - tags["hostname"] = nodeinfo.Hostname - } - fields := map[string]interface{}{ "load": stats.LoadAverage, "idletime": int64(stats.Idletime), @@ -75,6 +67,18 @@ func (c *StatsDb) Add(nodeId string, node *models.Node) { "memory.total": stats.Memory.Total, } + if nodeinfo := node.Nodeinfo; nodeinfo != nil { + if owner := nodeinfo.Owner; owner != nil { + tags["owner"] = owner.Contact + } + if wireless := nodeinfo.Wireless; wireless != nil { + fields["wireless.txpower24"] = wireless.TxPower24 + fields["wireless.txpower5"] = wireless.TxPower5 + } + // morpheus needs + tags["hostname"] = nodeinfo.Hostname + } + if t := stats.Traffic.Rx; t != nil { fields["traffic.rx.bytes"] = int64(t.Bytes) fields["traffic.rx.packets"] = t.Packets