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