Allign all points.

This commit is contained in:
David Newhall II 2019-07-14 02:38:16 -07:00
parent 3e1b67808a
commit c847a5a8cc
2 changed files with 3 additions and 2 deletions

View File

@ -42,6 +42,7 @@ type UnifiPoller struct {
// Metrics contains all the data from the controller and an influx endpoint to send it to.
type Metrics struct {
TS time.Time
unifi.Sites
unifi.IDSList
unifi.Clients

View File

@ -78,7 +78,7 @@ func (u *UnifiPoller) CollectAndReport() error {
// CollectMetrics grabs all the measurements from a UniFi controller and returns them.
// This also creates an InfluxDB writer, and returns an error if that fails.
func (u *UnifiPoller) CollectMetrics() (*Metrics, error) {
m := &Metrics{}
m := &Metrics{TS: time.Now()}
var err error
// Get the sites we care about.
m.Sites, err = u.GetFilteredSites()
@ -188,7 +188,7 @@ func (m *Metrics) processPoints(asset Asset) error {
if asset == nil {
return nil
}
points, err := asset.Points()
points, err := asset.PointsAt(m.TS)
if err != nil || points == nil {
return err
}