RRD
Code
package main
import (
"fmt"
"net/http"
"github.com/OutOfBedlam/tine/engine"
_ "github.com/OutOfBedlam/tine/plugins/all"
_ "github.com/OutOfBedlam/tine/x/rrd"
)
func main() {
addr := "127.0.0.1:8080"
// start data collector that save metrics to rrd file
collect, _ := engine.New(engine.WithConfig(collectorPipeline))
collect.Start()
router := http.NewServeMux()
router.HandleFunc("GET /", getView)
router.HandleFunc("GET /graph/load", HttpHandler(graphLoadPipeline))
router.HandleFunc("GET /graph/cpu", HttpHandler(graphCpuPipeline))
fmt.Printf("\nlistener start at http://%s\n", addr)
http.ListenAndServe(addr, router)
// stop data collector
collect.Stop()
}Run

How this works
Start collecting pipeline
Rendering HTML
HttpHandler wrapper for a pipeline
Attach pipelines to the endpoints
Last updated