func (smb standardBucket) Publish(graphite_addr string) error { addr, err := net.ResolveTCPAddr("tcp", graphite_addr) if err != nil { return err } go gometrics.Graphite(smb.registry, GraphitePublishInterval, smb.name, addr) return nil }
func AddOutput(outputType string) { switch outputType { // TODO(pquerna): Add graphite/statsd support case "graphite": addr, _ := net.ResolveTCPAddr("tcp", "127.0.0.1:2003") go gmetrics.Graphite(gmetrics.DefaultRegistry, 10e9, "metrics", addr) case "console": ConsoleOutput() default: panic("unrecognized output type") } }
func main() { defer common.LogPanic() common.InitWithMetrics("probeserver", graphiteServer) go monitorIssueTracker() glog.Infoln("Looking for Graphite server.") addr, err := net.ResolveTCPAddr("tcp", *graphiteServer) if err != nil { glog.Fatalln("Failed to resolve the Graphite server: ", err) } glog.Infoln("Found Graphite server.") liveness := imetrics.NewLiveness("probes") // We have two sets of metrics, one for the probes and one for the probe // server itself. The server's metrics are handled by common.Init() probeRegistry := metrics.NewRegistry() go metrics.Graphite(probeRegistry, common.SAMPLE_PERIOD, *prefix, addr) // TODO(jcgregorio) Monitor config file and reload if it changes. cfg, err := readConfigFiles(*config) if err != nil { glog.Fatalln("Failed to read config file: ", err) } glog.Infoln("Successfully read config file.") // Register counters for each probe. for name, probe := range cfg { probe.failure = metrics.NewRegisteredGauge(name+".failure", probeRegistry) probe.latency = metrics.NewRegisteredGauge(name+".latency", probeRegistry) } // Create a client that uses our dialer with a timeout. c := &http.Client{ Transport: &http.Transport{ Dial: dialTimeout, }, } probeOneRound(cfg, c) for _ = range time.Tick(*runEvery) { probeOneRound(cfg, c) liveness.Update() } }