Last active
August 5, 2016 20:48
-
-
Save jacoelho/bfeb1f0f90b10e4b2ccbffe899e1fffd to your computer and use it in GitHub Desktop.
sample collectd plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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