Pipeline as Http Handler
package main
import (
"fmt"
"net/http"
"github.com/OutOfBedlam/tine/engine"
_ "github.com/OutOfBedlam/tine/plugins/all"
)
func main() {
addr := "127.0.0.1:8080"
router := http.NewServeMux()
router.HandleFunc("GET /cpu", engine.HttpHandleFunc(cpuPipeline))
fmt.Printf("\nstart server http://%s\n\n", addr)
http.ListenAndServe(addr, router)
}
const cpuPipeline = `
[[inlets.cpu]]
interval = "3s"
totalcpu = true
percpu = false
[[flows.select]]
includes = ["#_ts", "*"]
[[outlets.file]]
format = "json"
decimal = 2
`Last updated