collector

This commit is contained in:
insanity@loafle.com 2017-05-16 16:44:02 +09:00
parent 58c6c696ad
commit f205c2e550

View File

@ -42,8 +42,6 @@ func GetInstance() *Collector {
return instance
}
func (c *Collector) start(started chan bool, conf cm.ConfigManager) {
go func() {
c.cm = conf
@ -59,7 +57,6 @@ func (c *Collector) start(started chan bool, conf cm.ConfigManager) {
}()
}
func (c *Collector) stop() {
c.scheduler.RemoveAllSchedule()
c.scheduler.Stop()
@ -107,8 +104,12 @@ func (c *Collector) removeSensor(id string) error {
return nil
}
func (c *Collector) updateSensor(id string) {
//update
func (c *Collector) updateSensor(id string) error {
err := c.removeSensor(id)
if err != nil {
return err
}
return c.addSensor(id)
}
func AddSensor(id string) error {
@ -119,6 +120,10 @@ func RemSensor(id string) error {
return GetInstance().removeSensor(id)
}
func UpdateSensor(id string) error {
return GetInstance().updateSensor(id)
}
func StartSensor(id string) error {
return GetInstance().scheduler.StartSchedule(id)
}