func endpointMemoryMetrics(host string) float64 {
	residentMemoryKey := "process_resident_memory_bytes"
	var residentMemoryValue string
	if !strings.HasPrefix(host, `http://`) {
		host = "http://" + host
	}
	url := host + "/metrics"
	resp, err := http.Get(url)
	if err != nil {
		fmt.Println(fmt.Sprintf("fetch error: %v", err))
		return 0.0
	}
	byts, readerr := ioutil.ReadAll(resp.Body)
	resp.Body.Close()
	if readerr != nil {
		fmt.Println(fmt.Sprintf("fetch error: reading %s: %v", url, readerr))
		return 0.0
	}

	for _, line := range strings.Split(string(byts), "\n") {
		if strings.HasPrefix(line, residentMemoryKey) {
			residentMemoryValue = strings.TrimSpace(strings.TrimPrefix(line, residentMemoryKey))
			break
		}
	}
	if residentMemoryValue == "" {
		fmt.Println(fmt.Sprintf("could not find: %v", residentMemoryKey))
		return 0.0
	}
	residentMemoryBytes, parseErr := strconv.ParseFloat(residentMemoryValue, 64)
	if parseErr != nil {
		fmt.Println(fmt.Sprintf("parse error: %v", parseErr))
		return 0.0
	}

	return residentMemoryBytes
}
func endpointMemoryMetrics(host string) float64 {
	residentMemoryKey := "process_resident_memory_bytes"
	var residentMemoryValue string
	if !strings.HasPrefix(host, `http:
		host = "http:
	}
	url := host + "/metrics"
	resp, err := http.Get(url)
	if err != nil {
		fmt.Println(fmt.Sprintf("fetch error: %v", err))
		return 0.0
	}
	byts, readerr := ioutil.ReadAll(resp.Body)
	resp.Body.Close()
	if readerr != nil {
		fmt.Println(fmt.Sprintf("fetch error: reading %s: %v", url, readerr))
		return 0.0
	}

	for _, line := range strings.Split(string(byts), "\n") {
		if strings.HasPrefix(line, residentMemoryKey) {
			residentMemoryValue = strings.TrimSpace(strings.TrimPrefix(line, residentMemoryKey))
			break
		}
	}
	if residentMemoryValue == "" {
		fmt.Println(fmt.Sprintf("could not find: %v", residentMemoryKey))
		return 0.0
	}
	residentMemoryBytes, parseErr := strconv.ParseFloat(residentMemoryValue, 64)
	if parseErr != nil {
		fmt.Println(fmt.Sprintf("parse error: %v", parseErr))
		return 0.0
	}

	return residentMemoryBytes
}
func endpointMemoryMetrics ( host string ) float64 { residentMemoryKey := " " var residentMemoryValue string if ! strings . HasPrefix ( host , `http://` ) { host = " " + host } url := host + " " resp , err := http . Get ( url ) if err != nil { fmt . Println ( fmt . Sprintf ( " " , err ) ) return 0.0 } byts , readerr := ioutil . ReadAll ( resp . Body ) resp . Body . Close ( ) if readerr != nil { fmt . Println ( fmt . Sprintf ( " " , url , readerr ) ) return 0.0 } for _ , line := range strings . Split ( string ( byts ) , " \n " ) { if strings . HasPrefix ( line , residentMemoryKey ) { residentMemoryValue = strings . TrimSpace ( strings . TrimPrefix ( line , residentMemoryKey ) ) break } } if residentMemoryValue == " " { fmt . Println ( fmt . Sprintf ( " " , residentMemoryKey ) ) return 0.0 } residentMemoryBytes , parseErr := strconv . ParseFloat ( residentMemoryValue , 64 ) if parseErr != nil { fmt . Println ( fmt . Sprintf ( " " , parseErr ) ) return 0.0 } return residentMemoryBytes }
// get the process_resident_memory_bytes from <server:2379>/metrics
get the process_resident_memory_bytes from <server : 2379 > / metrics