From dd643c469b17fe9d2d7defce059ba93bb4f4705a Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Wed, 23 Mar 2016 22:19:53 +0100 Subject: [PATCH] Use int64 instead of uint64 uint64 is stored as string by InfluxDB --- data/statistics.go | 8 ++++---- stats_db.go | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/data/statistics.go b/data/statistics.go index 6a1fd38..36e69ff 100644 --- a/data/statistics.go +++ b/data/statistics.go @@ -55,8 +55,8 @@ type Clients struct { } type Memory struct { - Cached uint64 `json:"cached"` - Total uint64 `json:"total"` - Buffers uint64 `json:"buffers"` - Free uint64 `json:"free"` + Cached uint32 `json:"cached"` + Total uint32 `json:"total"` + Buffers uint32 `json:"buffers"` + Free uint32 `json:"free"` } diff --git a/stats_db.go b/stats_db.go index df79fce..70a4144 100644 --- a/stats_db.go +++ b/stats_db.go @@ -49,8 +49,8 @@ func (c *StatsDb) Add(stats *data.Statistics) { } fields := map[string]interface{}{ "load": stats.LoadAverage, - "idletime": uint64(stats.Idletime), - "uptime": uint64(stats.Uptime), + "idletime": int64(stats.Idletime), + "uptime": int64(stats.Uptime), "processes.running": stats.Processes.Running, "clients.wifi": stats.Clients.Wifi, "clients.wifi24": stats.Clients.Wifi24, @@ -63,24 +63,24 @@ func (c *StatsDb) Add(stats *data.Statistics) { } if t := stats.Traffic.Rx; t != nil { - fields["traffic.rx.bytes"] = uint64(t.Bytes) + fields["traffic.rx.bytes"] = int64(t.Bytes) fields["traffic.rx.packets"] = t.Packets } if t := stats.Traffic.Tx; t != nil { - fields["traffic.tx.bytes"] = uint64(t.Bytes) + fields["traffic.tx.bytes"] = int64(t.Bytes) fields["traffic.tx.packets"] = t.Packets fields["traffic.tx.dropped"] = t.Dropped } if t := stats.Traffic.Forward; t != nil { - fields["traffic.forward.bytes"] = uint64(t.Bytes) + fields["traffic.forward.bytes"] = int64(t.Bytes) fields["traffic.forward.packets"] = t.Packets } if t := stats.Traffic.MgmtRx; t != nil { - fields["traffic.mgmt_rx.bytes"] = uint64(t.Bytes) + fields["traffic.mgmt_rx.bytes"] = int64(t.Bytes) fields["traffic.mgmt_rx.packets"] = t.Packets } if t := stats.Traffic.MgmtTx; t != nil { - fields["traffic.mgmt_tx.bytes"] = uint64(t.Bytes) + fields["traffic.mgmt_tx.bytes"] = int64(t.Bytes) fields["traffic.mgmt_tx.packets"] = t.Packets }