stat.go
func (h *HAProxyClient) Stats() (stats []*Stat, err error) {
	res, err := h.RunCommand("show stat")
	if err != nil {
		return nil, err
	}

	reader := csv.NewReader(res)
	reader.TrailingComma = true
	err = gocsv.UnmarshalCSV(reader, &stats)
	if err != nil {
		return nil, fmt.Errorf("error reading csv: %s", err)
	}

	//	for _, s := range allStats {
	//		switch s.SvName {
	//		case "FRONTEND":
	//			services.Frontends = append(services.Frontends, s)
	//		case "BACKEND":
	//			services.Backends = append(services.Backends, s)
	//		default:
	//			services.Listeners = append(services.Listeners, s)
	//		}
	//	}

	return stats, nil
}
func (h *HAProxyClient) Stats() (stats []*Stat, err error) {
	res, err := h.RunCommand("show stat")
	if err != nil {
		return nil, err
	}

	reader := csv.NewReader(res)
	reader.TrailingComma = true
	err = gocsv.UnmarshalCSV(reader, &stats)
	if err != nil {
		return nil, fmt.Errorf("error reading csv: %s", err)
	}

	//	for _, s := range allStats {
	//		switch s.SvName {
	//		case "FRONTEND":
	//			services.Frontends = append(services.Frontends, s)
	//		case "BACKEND":
	//			services.Backends = append(services.Backends, s)
	//		default:
	//			services.Listeners = append(services.Listeners, s)
	//		}
	//	}

	return stats, nil
}
func ( h * HAProxyClient ) Stats ( ) ( stats [ ] * Stat , err error ) { res , err := h . RunCommand ( " " ) if err != nil { return nil , err } reader := csv . NewReader ( res ) reader . TrailingComma = true err = gocsv . UnmarshalCSV ( reader , & stats ) if err != nil { return nil , fmt . Errorf ( " " , err ) } //	for _, s := range allStats { //		switch s.SvName { //		case "FRONTEND": //			services.Frontends = append(services.Frontends, s) //		case "BACKEND": //			services.Backends = append(services.Backends, s) //		default: //			services.Listeners = append(services.Listeners, s) //		} //	} return stats , nil }
// Equivalent to HAProxy "show stat" command.
Equivalent to HAProxy show stat command .