Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Latest commit

 

History

History
48 lines (36 loc) · 923 Bytes

README.md

File metadata and controls

48 lines (36 loc) · 923 Bytes

GO-GMETRIC

Build Status

Native Ganglia gmetric packet sending support for Google Go.

BUILDING

go build

EXAMPLE

package main

import (
  "fmt"
  "github.com/jbuchbinder/go-gmetric/gmetric"
  "net"
)

func main() {
  gIP         := net.IPv4(127, 0, 0, 1)
  gangliaPort := 1234
  host        := "127.0.0.1"
  spoofHost   := "127.0.0.1:spoof"

	gm := gmetric.Gmetric{
		Host:  host,
		Spoof: spoofHost,
	}
	gm.AddServer(gmetric.GmetricServer{gIP, gangliaPort})

  m_name     := "some_metric"
  m_value    := fmt.Sprint(8675309)
  m_units    := "units"
  m_type     := gmetric.VALUE_UNSIGNED_INT
  m_slope    := gmetric.SLOPE_BOTH
  m_grp      := "group"
  m_interval := 300

  go gm.SendMetric(m_name, m_value, m_type, m_units, m_slope, m_interval, m_interval, m_grp)
}