2016-03-09 03:49:27 +01:00
|
|
|
package respond
|
|
|
|
|
2016-03-12 00:59:36 +01:00
|
|
|
import (
|
2016-03-12 13:32:55 +01:00
|
|
|
"github.com/monitormap/micro-daemon/data"
|
2016-03-12 00:59:36 +01:00
|
|
|
"time"
|
|
|
|
)
|
2016-03-09 03:49:27 +01:00
|
|
|
|
|
|
|
//MultiCollector struct
|
|
|
|
type MultiCollector struct {
|
|
|
|
collectors []*Collector
|
|
|
|
}
|
|
|
|
|
|
|
|
//NewMultiCollector create a list of collectors
|
2016-03-12 00:59:36 +01:00
|
|
|
func NewMultiCollector(interval time.Duration, onReceive OnReceive) *MultiCollector {
|
2016-03-09 03:49:27 +01:00
|
|
|
return &MultiCollector{
|
|
|
|
collectors: []*Collector{
|
2016-03-12 18:26:51 +01:00
|
|
|
NewCollector("statistics", 0, interval, data.Statistics{}, onReceive),
|
|
|
|
NewCollector("nodeinfo", time.Second*3, interval, data.NodeInfo{}, onReceive),
|
|
|
|
NewCollector("neighbours", time.Second*6, interval, data.Neighbours{}, onReceive),
|
2016-03-09 03:49:27 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Close all Collections
|
|
|
|
func (multi *MultiCollector) Close() {
|
|
|
|
for _, col := range multi.collectors {
|
|
|
|
col.Close()
|
|
|
|
}
|
|
|
|
}
|