Skip to content

Instantly share code, notes, and snippets.

@jacoelho
Last active August 5, 2016 20:48
Show Gist options
  • Save jacoelho/bfeb1f0f90b10e4b2ccbffe899e1fffd to your computer and use it in GitHub Desktop.
Save jacoelho/bfeb1f0f90b10e4b2ccbffe899e1fffd to your computer and use it in GitHub Desktop.
sample collectd plugin
package main
import (
"flag"
"time"
)
func main() {
var (
interval = flag.Int("interval", 5, "time in seconds between collection")
)
ticker := time.NewTicker(time.Duration(*interval) * time.Second)
for {
select {
case <-ticker.C:
go collectMetric()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment