Commit 0118f614 authored by Kamil Kisiel's avatar Kamil Kisiel

Made localhost the default graphite server

parent 120c87f6
......@@ -2,37 +2,29 @@ package main
import (
"flag"
"fmt"
"github.com/kisielk/gostatsd/statsd"
"log"
"os"
)
var (
metricsAddr string
consoleAddr string
metricsAddr string
consoleAddr string
graphiteAddr string
)
func init() {
const (
defaultMetricsAddr = ":8125"
defaultConsoleAddr = ":8126"
defaultGraphiteAddr = ""
defaultMetricsAddr = ":8125"
defaultConsoleAddr = ":8126"
defaultGraphiteAddr = "localhost:2003"
)
flag.StringVar(&metricsAddr, "l", defaultMetricsAddr, "Address on which to listen for metrics (optional)")
flag.StringVar(&consoleAddr, "c", defaultConsoleAddr, "Address on which to listen for console sessions (optional)")
flag.StringVar(&graphiteAddr, "g", defaultGraphiteAddr, "Address of the graphite server (required)")
flag.StringVar(&metricsAddr, "l", defaultMetricsAddr, "Address on which to listen for metrics")
flag.StringVar(&consoleAddr, "c", defaultConsoleAddr, "Address on which to listen for console sessions")
flag.StringVar(&graphiteAddr, "g", defaultGraphiteAddr, "Address of the graphite server")
}
func main() {
flag.Parse()
if graphiteAddr == "" {
fmt.Printf("Error: You must provide the address of the graphite server with the -g flag\n")
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
flag.PrintDefaults()
return
}
err := statsd.ListenAndServe(metricsAddr, consoleAddr, graphiteAddr)
if err != nil {
log.Fatal(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment