Commit 12584164 authored by jingbo.wang's avatar jingbo.wang

解决cpu使用率数值不正确问题

parent 376d638d
...@@ -85,7 +85,7 @@ func (n *Node) queryKey(key string) (int, int) { ...@@ -85,7 +85,7 @@ func (n *Node) queryKey(key string) (int, int) {
} }
func (n *Node) initCpu() { func (n *Node) initCpu() {
n.averageCpu, n.maxCpu = n.queryKey(`system_load_average/processors`) n.averageCpu, n.maxCpu = n.queryKey(`system_load_average/processors*100`)
} }
func (n *Node) initMem() { func (n *Node) initMem() {
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
) )
func TestRun(t *testing.T) { func TestRun(t *testing.T) {
fmt.Println(Run(7)) fmt.Println(Run(1))
} }
func TestUtf8StringLen(t *testing.T) { func TestUtf8StringLen(t *testing.T) {
......
...@@ -91,6 +91,7 @@ func (s *Service) getNodeList() []string { ...@@ -91,6 +91,7 @@ func (s *Service) getNodeList() []string {
resp, err := query(sql) resp, err := query(sql)
if err != nil { if err != nil {
glog.Error("query sql:", sql, err) glog.Error("query sql:", sql, err)
return []string{}
} }
if len(resp.Results) != 1 { if len(resp.Results) != 1 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment