Skip to content

Commit

Permalink
#845 业务配置导入支持自动创建告警看板&非自动模式
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiawei committed Nov 20, 2024
1 parent 2c00d3c commit 99764d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions monitor-server/api/v2/service/log_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ func ImportLogMetric(c *gin.Context) {
middleware.ReturnHandleError(c, "file open error ", err)
return
}
// autoCreate 是否自动创建告警和看板,yes表示自动,no表示不自动,不传递就根据导出数据判断
autoCreate := c.Query("autoCreate")
var paramObj models.LogMetricQueryObj
b, err := io.ReadAll(f)
defer f.Close()
Expand Down Expand Up @@ -419,6 +421,17 @@ func ImportLogMetric(c *gin.Context) {
}
for _, metricGroup := range logMonitor.MetricGroups {
metricGroup.ServiceGroup = serviceGroup
if autoCreate == "yes" {
metricGroup.AutoDashboard = 1
metricGroup.AutoCreateDashboard = true
metricGroup.AutoAlarm = 1
metricGroup.AutoCreateWarn = true
} else if autoCreate == "no" {
metricGroup.AutoDashboard = 0
metricGroup.AutoCreateDashboard = false
metricGroup.AutoAlarm = 0
metricGroup.AutoCreateWarn = false
}
}
}
for _, dbMonitor := range paramObj.DBConfig {
Expand Down

0 comments on commit 99764d2

Please sign in to comment.