forked from nwilkens/graphite-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecutor.go.tpl
39 lines (36 loc) · 930 Bytes
/
executor.go.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"github.com/graphite-ng/graphite-ng/chains"
"github.com/graphite-ng/graphite-ng/functions"
"github.com/graphite-ng/graphite-ng/config"
"github.com/graphite-ng/graphite-ng/stores"
"github.com/BurntSushi/toml"
)
func main () {
from := int32({{.From}})
until := int32({{.Until}})
var dep_el chains.ChainEl
var config config.Main
if _, err := toml.DecodeFile("graphite-ng.conf", &config); err != nil {
fmt.Println(err)
return
}
if err := stores.Init(config); err != nil {
fmt.Println(err)
return
}
{{range $i, $e := .Targets}}
{{if $i}}
fmt.Printf("]},\n")
{{else}}
fmt.Printf("[\n")
{{end}}
dep_el = {{.Cmd}}
dep_el.Settings <- from
dep_el.Settings <- until
fmt.Printf("{\"target\": \"{{.Name}}\", \"datapoints\": [")
functions.OutPrintStandardJson(dep_el, until)
{{end}}
fmt.Printf("]}\n]")
}