add disk_util for target table

This commit is contained in:
Ulric Qin 2022-08-10 17:05:29 +08:00
parent b1b2c7d6b0
commit 23d7e5a7de
4 changed files with 9 additions and 8 deletions

View File

@ -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)'''
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)'''

View File

@ -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)'''
DiskUtil = '''max(max_over_time(disk_used_percent{ident=~"(%s)", path="/"}[%dm])) by (ident)'''

View File

@ -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 {

View File

@ -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]
}
}
}