Allign all points.
This commit is contained in:
parent
3e1b67808a
commit
c847a5a8cc
|
|
@ -42,6 +42,7 @@ type UnifiPoller struct {
|
||||||
|
|
||||||
// Metrics contains all the data from the controller and an influx endpoint to send it to.
|
// Metrics contains all the data from the controller and an influx endpoint to send it to.
|
||||||
type Metrics struct {
|
type Metrics struct {
|
||||||
|
TS time.Time
|
||||||
unifi.Sites
|
unifi.Sites
|
||||||
unifi.IDSList
|
unifi.IDSList
|
||||||
unifi.Clients
|
unifi.Clients
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func (u *UnifiPoller) CollectAndReport() error {
|
||||||
// CollectMetrics grabs all the measurements from a UniFi controller and returns them.
|
// 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.
|
// This also creates an InfluxDB writer, and returns an error if that fails.
|
||||||
func (u *UnifiPoller) CollectMetrics() (*Metrics, error) {
|
func (u *UnifiPoller) CollectMetrics() (*Metrics, error) {
|
||||||
m := &Metrics{}
|
m := &Metrics{TS: time.Now()}
|
||||||
var err error
|
var err error
|
||||||
// Get the sites we care about.
|
// Get the sites we care about.
|
||||||
m.Sites, err = u.GetFilteredSites()
|
m.Sites, err = u.GetFilteredSites()
|
||||||
|
|
@ -188,7 +188,7 @@ func (m *Metrics) processPoints(asset Asset) error {
|
||||||
if asset == nil {
|
if asset == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
points, err := asset.Points()
|
points, err := asset.PointsAt(m.TS)
|
||||||
if err != nil || points == nil {
|
if err != nil || points == nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue