func main() {
	password := flag.String("password", "", "Password for all redis instances")
	db := flag.Int("db", 0, "DB number")
	socket := flag.String("socket", "/tmp/redis-monitor.sock", "Socket to provide metrics over")
	flag.Parse()
	if len(flag.Args()) < 1 {
		flag.Usage()
		os.Exit(1)
	}
	s := &http.Server{
		Handler: &Addresses{
			Addr:     flag.Args(),
			Password: *password,
			DB:       int64(*db),
		},
	}

	l, err := util.CreateSocket(*socket)

	go func() {
		log.Println(http.ListenAndServe("localhost:6060", nil))
	}()

	defer profile.Start(profile.MemProfile).Stop()

	if err != nil {
		panic(err)
	}

	if err := s.Serve(l); err != nil {
		panic(err)
	}
}
示例#2
0
func main() {
	socket := flag.String("socket", "/tmp/nsq-monitor.sock", "Path to the socket we serve metrics over")

	flag.Parse()

	if len(flag.Args()) < 1 {
		fmt.Println("Enter one or more NSQ Lookupd addresses (ex: 10.0.0.1:4161)")
		os.Exit(1)
	}

	s := &http.Server{
		Handler: &NSQHandler{
			NSQLookupdHTTPAddresses: flag.Args(),
		},
	}

	l, err := util.CreateSocket(*socket)

	if err != nil {
		panic(err)
	}

	if err := s.Serve(l); err != nil {
		panic(err)
	}
}
示例#3
0
func main() {
	socket := flag.String("socket", "/tmp/process-monitor.sock", "Path to the socket we serve metrics over")

	flag.Parse()

	if len(flag.Args()) < 1 {
		fmt.Println("enter the full path to a binary")
		os.Exit(1)
	}

	s := &http.Server{
		Handler: &PMHandler{
			Binaries: flag.Args(),
		},
	}

	l, err := util.CreateSocket(*socket)

	if err != nil {
		panic(err)
	}

	if err := s.Serve(l); err != nil {
		panic(err)
	}
}
func main() {
	params := map[string]*string{}

	for key, value := range db_params {
		params[key] = flag.String(key, value[0], value[1])
	}

	ignore_errors := flag.Bool("ignore-errors", false, "Ignore processing errors while pulling stats -- nice if you don't have some relations")
	socket := flag.String("socket", "/tmp/postgresql-monitor.sock", "Socket to serve metrics on")

	flag.Parse()

	s := &http.Server{
		Handler: &Attrs{
			Params:       params,
			IgnoreErrors: *ignore_errors,
		},
	}

	l, err := util.CreateSocket(*socket)

	if err != nil {
		panic(err)
	}

	if err := s.Serve(l); err != nil {
		panic(err)
	}
}
示例#5
0
func (h *Handler) CreateServer() error {
	s := http.Server{Handler: h}

	l, err := util.CreateSocket(h.Socket)

	if err != nil {
		return err
	}

	return s.Serve(l)
}
示例#6
0
func main() {
	socket := flag.String("socket", "/tmp/sysctl-monitor.sock", "UNIX Socket to expose")
	flag.Parse()

	for _, val := range flag.Args() {
		mutex.Lock()
		registry[val] = 0
		mutex.Unlock()
	}

	go populateRegistry()

	http.HandleFunc("/", Handler)

	l, err := util.CreateSocket(*socket)

	if err != nil {
		panic(err)
	}

	panic(http.Serve(l, nil))
}