2016-03-09 02:49:27 +00:00
|
|
|
package respond
|
|
|
|
|
2016-03-11 23:59:36 +00:00
|
|
|
import (
|
2016-03-15 22:26:30 +00:00
|
|
|
"github.com/FreifunkBremen/respond-collector/data"
|
2016-03-11 23:59:36 +00:00
|
|
|
"time"
|
|
|
|
)
|
2016-03-09 02:49:27 +00:00
|
|
|
|
|
|
|
//MultiCollector struct
|
|
|
|
type MultiCollector struct {
|
|
|
|
collectors []*Collector
|
|
|
|
}
|
|
|
|
|
|
|
|
//NewMultiCollector create a list of collectors
|
2016-03-11 23:59:36 +00:00
|
|
|
func NewMultiCollector(interval time.Duration, onReceive OnReceive) *MultiCollector {
|
2016-03-09 02:49:27 +00:00
|
|
|
return &MultiCollector{
|
|
|
|
collectors: []*Collector{
|
2016-03-12 17:26:51 +00: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 02:49:27 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Close all Collections
|
|
|
|
func (multi *MultiCollector) Close() {
|
|
|
|
for _, col := range multi.collectors {
|
|
|
|
col.Close()
|
|
|
|
}
|
|
|
|
}
|