refactor monitor apis to adopt new response format

This commit is contained in:
Calvin Yu
2018-06-01 20:13:57 +08:00
parent b65ba97e77
commit 1683f44594
7 changed files with 341 additions and 239 deletions

View File

@@ -55,3 +55,23 @@ func GetHeapsterMetrics(url string) string {
}
return ""
}
func GetCAdvisorMetrics(nodeAddr string) string {
response, err := http.Get("http://" + nodeAddr + ":10255/stats/summary")
if err != nil {
glog.Error(err)
os.Exit(1)
} else {
defer response.Body.Close()
contents, err := ioutil.ReadAll(response.Body)
if err != nil {
glog.Error(err)
os.Exit(1)
}
return string(contents)
}
return ""
}