Adjust ganglia sink to CCMetric

This commit is contained in:
Thomas Roehl 2022-01-30 15:25:57 +01:00
parent d915bcc02d
commit 011218ab80

View File

@ -2,11 +2,13 @@ package sinks
import ( import (
"fmt" "fmt"
"strings"
"log" "log"
"strings"
// "time" // "time"
lp "github.com/influxdata/line-protocol"
"os/exec" "os/exec"
lp "github.com/ClusterCockpit/cc-metric-collector/internal/ccMetric"
) )
const GMETRIC_EXEC = `gmetric` const GMETRIC_EXEC = `gmetric`
@ -16,7 +18,7 @@ type GangliaSink struct {
gmetric_path string gmetric_path string
} }
func (s *GangliaSink) Init(config SinkConfig) error { func (s *GangliaSink) Init(config sinkConfig) error {
p, err := exec.LookPath(string(GMETRIC_EXEC)) p, err := exec.LookPath(string(GMETRIC_EXEC))
if err == nil { if err == nil {
s.gmetric_path = p s.gmetric_path = p
@ -24,7 +26,7 @@ func (s *GangliaSink) Init(config SinkConfig) error {
return err return err
} }
func (s *GangliaSink) Write(point lp.MutableMetric) error { func (s *GangliaSink) Write(point lp.CCMetric) error {
var err error = nil var err error = nil
var tagsstr []string var tagsstr []string
var argstr []string var argstr []string
@ -66,9 +68,9 @@ func (s *GangliaSink) Write(point lp.MutableMetric) error {
} }
} }
log.Print(s.gmetric_path, " ", strings.Join(argstr, " ")) log.Print(s.gmetric_path, " ", strings.Join(argstr, " "))
// command := exec.Command(string(GMETRIC_EXEC), strings.Join(argstr, " ")) // command := exec.Command(string(GMETRIC_EXEC), strings.Join(argstr, " "))
// command.Wait() // command.Wait()
// _, err := command.Output() // _, err := command.Output()
return err return err
} }
@ -77,5 +79,4 @@ func (s *GangliaSink) Flush() error {
} }
func (s *GangliaSink) Close() { func (s *GangliaSink) Close() {
return
} }