From 23d7e5a7de5d0ffea7ab941e9621ef7f53071775 Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Wed, 10 Aug 2022 17:05:29 +0800 Subject: [PATCH] add disk_util for target table --- docker/n9eetc/webapi.conf | 3 ++- etc/webapi.conf | 2 +- src/models/target.go | 8 ++++---- src/webapi/router/router_target.go | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docker/n9eetc/webapi.conf b/docker/n9eetc/webapi.conf index b2bb4efe..ff1b920c 100644 --- a/docker/n9eetc/webapi.conf +++ b/docker/n9eetc/webapi.conf @@ -179,4 +179,5 @@ Timeout = 3000 [TargetMetrics] TargetUp = '''max(max_over_time(target_up{ident=~"(%s)"}[%dm])) by (ident)''' LoadPerCore = '''max(max_over_time(system_load_norm_1{ident=~"(%s)"}[%dm])) by (ident)''' -MemUtil = '''100-max(max_over_time(mem_available_percent{ident=~"(%s)"}[%dm])) by (ident)''' \ No newline at end of file +MemUtil = '''100-max(max_over_time(mem_available_percent{ident=~"(%s)"}[%dm])) by (ident)''' +DiskUtil = '''max(max_over_time(disk_used_percent{ident=~"(%s)", path="/"}[%dm])) by (ident)''' \ No newline at end of file diff --git a/etc/webapi.conf b/etc/webapi.conf index 291f65d7..76dfe986 100644 --- a/etc/webapi.conf +++ b/etc/webapi.conf @@ -207,4 +207,4 @@ Timeout = 3000 TargetUp = '''max(max_over_time(target_up{ident=~"(%s)"}[%dm])) by (ident)''' LoadPerCore = '''max(max_over_time(system_load_norm_1{ident=~"(%s)"}[%dm])) by (ident)''' MemUtil = '''100-max(max_over_time(mem_available_percent{ident=~"(%s)"}[%dm])) by (ident)''' -DiskUsedPercent = '''max(max_over_time(disk_used_percent{ident=~"(%s)", path="/"}[%dm])) by (ident)''' \ No newline at end of file +DiskUtil = '''max(max_over_time(disk_used_percent{ident=~"(%s)", path="/"}[%dm])) by (ident)''' \ No newline at end of file diff --git a/src/models/target.go b/src/models/target.go index bfd1a16b..ecfff974 100644 --- a/src/models/target.go +++ b/src/models/target.go @@ -21,10 +21,10 @@ type Target struct { TagsMap map[string]string `json:"-" gorm:"-"` // internal use, append tags to series UpdateAt int64 `json:"update_at"` - LoadPerCore float64 `json:"load_per_core" gorm:"-"` - MemUtil float64 `json:"mem_util" gorm:"-"` - TargetUp float64 `json:"target_up" gorm:"-"` - DiskUsedPercent float64 `json:"disk_used_percent" gorm:"-"` + TargetUp float64 `json:"target_up" gorm:"-"` + LoadPerCore float64 `json:"load_per_core" gorm:"-"` + MemUtil float64 `json:"mem_util" gorm:"-"` + DiskUtil float64 `json:"disk_util" gorm:"-"` } func (t *Target) TableName() string { diff --git a/src/webapi/router/router_target.go b/src/webapi/router/router_target.go index 46318de4..cde7d130 100644 --- a/src/webapi/router/router_target.go +++ b/src/webapi/router/router_target.go @@ -80,8 +80,8 @@ func targetGets(c *gin.Context) { t.MemUtil = values[ident] case "TargetUp": t.TargetUp = values[ident] - case "DiskUsedPercent": - t.DiskUsedPercent = values[ident] + case "DiskUtil": + t.DiskUtil = values[ident] } } }