refactor monitor apis to adopt new response format
This commit is contained in:
@@ -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 ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user