yanic/respond/multi_collector.go
Julian Kornberger d1b315aa6e Copy data structs from node-informant/gluon-collector/data
Some fields are missing there
2016-03-12 16:21:09 +01:00

30 lines
690 B
Go

package respond
import (
"github.com/monitormap/micro-daemon/data"
"time"
)
//MultiCollector struct
type MultiCollector struct {
collectors []*Collector
}
//NewMultiCollector create a list of collectors
func NewMultiCollector(interval time.Duration, onReceive OnReceive) *MultiCollector {
return &MultiCollector{
collectors: []*Collector{
NewCollector("statistics", interval, data.Statistics{}, onReceive),
NewCollector("nodeinfo", interval, data.NodeInfo{}, onReceive),
NewCollector("neighbours", interval, data.Neighbours{}, onReceive),
},
}
}
//Close all Collections
func (multi *MultiCollector) Close() {
for _, col := range multi.collectors {
col.Close()
}
}