Skip to content

Commit

Permalink
Saves uptime in days at each sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreandradecosta committed Sep 27, 2016
1 parent cc238fe commit f251d1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ func (d *Device) ReadSample() (*rpimonitor.Sample, error) {
s.Metrics["netIO"] = getData(net.IOCounters(true))
s.Metrics["netProto"] = getData(net.ProtoCounters(nil))
s.Metrics["temperature"] = getData(GetTemperature())
uptime, err := host.Uptime()
if err == nil {
s.Metrics["daysUptime"] = uptime / (60 * 60 * 24)
}
return s, nil
}

Expand Down
1 change: 1 addition & 0 deletions mongo/mongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (s *SampleService) Query(start, end time.Time) ([]rpimonitor.Sample, error)
"metrics.virtualMemory": 1,
"metrics.swapMemory": 1,
"metrics.temperature": 1,
"metrics.daysUptime": 1,
}).Sort(
"-localTime",
).All(&result)
Expand Down

0 comments on commit f251d1e

Please sign in to comment.