🚸 improve: 优化agent取双栈IP、服务状态页面展示策略

This commit is contained in:
naiba
2021-01-16 11:23:42 +08:00
parent a41c792577
commit 345511e90f
7 changed files with 75 additions and 17 deletions

View File

@@ -71,6 +71,30 @@ func ServeWeb(port uint) {
today := time.Date(year, month, day, 0, 0, 0, 0, time.Local)
return today.AddDate(0, 0, i-29).Format("1月2号")
},
"className": func(percent float32) string {
if percent == 0 {
return ""
}
if percent > 95 {
return "good"
}
if percent > 80 {
return "warning"
}
return "danger"
},
"statusName": func(percent float32) string {
if percent == 0 {
return "无数据"
}
if percent > 95 {
return "良好"
}
if percent > 80 {
return "低可用"
}
return "故障"
},
})
r.Static("/static", "resource/static")
r.LoadHTMLGlob("resource/template/**/*")