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

Made localhost the default graphite server

parent 120c87f6
...@@ -2,37 +2,29 @@ package main ...@@ -2,37 +2,29 @@ package main
import ( import (
"flag" "flag"
"fmt"
"github.com/kisielk/gostatsd/statsd" "github.com/kisielk/gostatsd/statsd"
"log" "log"
"os"
) )
var ( var (
metricsAddr string metricsAddr string
consoleAddr string consoleAddr string
graphiteAddr string graphiteAddr string
) )
func init() { func init() {
const ( const (
defaultMetricsAddr = ":8125" defaultMetricsAddr = ":8125"
defaultConsoleAddr = ":8126" defaultConsoleAddr = ":8126"
defaultGraphiteAddr = "" defaultGraphiteAddr = "localhost:2003"
) )
flag.StringVar(&metricsAddr, "l", defaultMetricsAddr, "Address on which to listen for metrics (optional)") 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 (optional)") flag.StringVar(&consoleAddr, "c", defaultConsoleAddr, "Address on which to listen for console sessions")
flag.StringVar(&graphiteAddr, "g", defaultGraphiteAddr, "Address of the graphite server (required)") flag.StringVar(&graphiteAddr, "g", defaultGraphiteAddr, "Address of the graphite server")
} }
func main() { func main() {
flag.Parse() 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) err := statsd.ListenAndServe(metricsAddr, consoleAddr, graphiteAddr)
if err != nil { if err != nil {
log.Fatal(err) 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