add txpower (for check controller)

This commit is contained in:
Martin Geno 2016-07-15 16:34:16 +02:00
parent 156122e62a
commit e1b84dc21b

View File

@ -52,14 +52,6 @@ func (c *StatsDb) Add(nodeId string, node *models.Node) {
"nodeid": nodeId, "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{}{ fields := map[string]interface{}{
"load": stats.LoadAverage, "load": stats.LoadAverage,
"idletime": int64(stats.Idletime), "idletime": int64(stats.Idletime),
@ -75,6 +67,18 @@ func (c *StatsDb) Add(nodeId string, node *models.Node) {
"memory.total": stats.Memory.Total, "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 { if t := stats.Traffic.Rx; t != nil {
fields["traffic.rx.bytes"] = int64(t.Bytes) fields["traffic.rx.bytes"] = int64(t.Bytes)
fields["traffic.rx.packets"] = t.Packets fields["traffic.rx.packets"] = t.Packets