Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
so-operation-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
smart-operation
so-operation-api
Commits
27803733
Commit
27803733
authored
Jul 06, 2023
by
黄智
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
c35b011f
fd344f73
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
19 deletions
+61
-19
src/bean/entity/alert_list.go
src/bean/entity/alert_list.go
+23
-19
src/bean/entity/alert_overview.go
src/bean/entity/alert_overview.go
+25
-0
src/router/alertlistrouter.go.go
src/router/alertlistrouter.go.go
+1
-0
src/service/alert_list.go
src/service/alert_list.go
+12
-0
No files found.
src/bean/entity/alert_list.go
View file @
27803733
...
@@ -5,25 +5,29 @@ import (
...
@@ -5,25 +5,29 @@ import (
)
)
type
AlertList
struct
{
type
AlertList
struct
{
Id
int
`json:"id"`
// 预警列表ID,主键,自增长
Id
int
`json:"id"`
// 预警列表ID,主键,自增长
AlertPoint
string
`json:"alert_point"`
// 预警点
AlertPoint
string
`json:"alert_point"`
// 预警点
AlertRulesId
string
`json:"alert_rules_id"`
// 告警规则id
AlertRulesId
string
`json:"alert_rules_id"`
// 告警规则id
RiskLevel
int
`json:"risk_level"`
// 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险
RiskLevel
int
`json:"risk_level"`
// 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险
AlertTime
jsontime
.
Time
`json:"alert_time"`
// 预警时间
AlertTime
jsontime
.
Time
`json:"alert_time"`
// 预警时间
ClassId
int
`json:"class_id" xorm:"'class_id'"`
// 预警对象id(级联:预警分类/预警对象)
ClassId
int
`json:"class_id" xorm:"'class_id'"`
// 预警对象id(级联:预警分类/预警对象)
MetricConfigId
string
`json:"metric_config_id"`
// 预警指标id // 预警指标
ClassParentName
string
`json:"class_parent_name" xorm:"class_parent_name"`
// 预警分类名称 TODO 该字段做关联存储或查询
CurrentValue
float64
`json:"current_value"`
// 当前报警值
ClassName
string
`json:"class_name" xorm:"class_name"`
// 预警对象名称 TODO 该字段做关联存储或查询
AlertCondition
string
`json:"alert_condition" xorm:"'alert_condition'"`
// 预警规则(预警阈值) 字典值
MetricConfigId
string
`json:"metric_config_id"`
// 预警指标id // 预警指标
NotificationCount
int
`json:"notification_count"`
// 通知人数
MetricConfigName
string
`json:"metric_config_name" xorm:"metric_config_name"`
// 预警指标名称
PushCount
int
`json:"push_count"`
// 推送次数
AlertRuleType
string
`json:"alert_rule_type" xorm:"alert_rule_type"`
// 预警规则类型 TODO 该字段做关联存储或查询
LastPushTime
jsontime
.
Time
`json:"last_push_time"`
// 最近推送时间
CurrentValue
float64
`json:"current_value"`
// 当前报警值
Status
int
`json:"status"`
// 状态,1:已恢复 2:未恢复 3:已关闭
AlertCondition
string
`json:"alert_condition" xorm:"'alert_condition'"`
// 预警规则(预警阈值) 字典值
IsDisposed
int
`json:"is_disposed"`
// 是否处置(工单管理),1:已处置,2:未处置
NotificationCount
int
`json:"notification_count"`
// 通知人数
DisposalContent
string
`json:"disposal_content"`
// 处置内容(工单管理,结果反馈)
PushCount
int
`json:"push_count"`
// 推送次数
CreatedBy
string
`json:"created_by" xorm:"'created_by'"`
// 创建人
LastPushTime
jsontime
.
Time
`json:"last_push_time"`
// 最近推送时间
CreatedAt
jsontime
.
Time
`json:"created_at" xorm:"'created_at'"`
// 创建时间
Status
int
`json:"status"`
// 状态,1:已恢复 2:未恢复 3:已关闭
UpdatedBy
string
`json:"updated_by" xorm:"'updated_by'"`
// 更新人
IsDisposed
int
`json:"is_disposed"`
// 是否处置(工单管理),1:已处置,2:未处置
UpdatedAt
jsontime
.
Time
`json:"updated_at" xorm:"'updated_at'"`
// 更新时间
DisposalContent
string
`json:"disposal_content"`
// 处置内容(工单管理,结果反馈)
CreatedBy
string
`json:"created_by" xorm:"'created_by'"`
// 创建人
CreatedAt
jsontime
.
Time
`json:"created_at" xorm:"'created_at'"`
// 创建时间
UpdatedBy
string
`json:"updated_by" xorm:"'updated_by'"`
// 更新人
UpdatedAt
jsontime
.
Time
`json:"updated_at" xorm:"'updated_at'"`
// 更新时间
}
}
func
(
a
*
AlertList
)
TableName
()
string
{
func
(
a
*
AlertList
)
TableName
()
string
{
...
...
src/bean/entity/alert_overview.go
0 → 100644
View file @
27803733
package
entity
import
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
type
AlertOverview
struct
{
RiskLevel
int
`json:"risk_level"`
MetricName
string
`json:"metric_name" xorm:"'metric_name'"`
// 预警规则名称(指标名称)
UnresolvedCount
int
`json:"unresolved_count"`
// 未恢复数量
TotalCount
int
`json:"total_count"`
// 总预警数
List
[]
AlertArray
`json:"list"`
// 预警列表
CreatedBy
string
`json:"created_by" xorm:"'created_by'"`
// 创建人
CreatedAt
jsontime
.
Time
`json:"created_at" xorm:"'created_at'"`
// 创建时间
UpdatedBy
string
`json:"updated_by" xorm:"'updated_by'"`
// 更新人
UpdatedAt
jsontime
.
Time
`json:"updated_at" xorm:"'updated_at'"`
// 更新时间
}
type
AlertArray
struct
{
MetricName
string
`json:"metric_name" xorm:"'metric_name'"`
// 预警规则名称(指标名称)
UnresolvedCount
int
`json:"unresolved_count"`
// 未恢复数量
TotalCount
int
`json:"total_count"`
// 总预警数
}
func
(
a
*
AlertOverview
)
TableName
()
string
{
return
"alert_overview"
}
src/router/alertlistrouter.go.go
View file @
27803733
...
@@ -13,5 +13,6 @@ func InitAlertListRouter(e *gin.Engine) {
...
@@ -13,5 +13,6 @@ func InitAlertListRouter(e *gin.Engine) {
{
{
group
.
GET
(
""
,
controller
.
DetailAlertList
)
group
.
GET
(
""
,
controller
.
DetailAlertList
)
group
.
GET
(
"list"
,
controller
.
ListAlertList
)
group
.
GET
(
"list"
,
controller
.
ListAlertList
)
group
.
PUT
(
""
,
controller
.
UpdateAlertList
)
}
}
}
}
src/service/alert_list.go
View file @
27803733
...
@@ -37,7 +37,11 @@ func (a *AlertListSvc) GetDataById(req request.DetailAlertList) (resp response.A
...
@@ -37,7 +37,11 @@ func (a *AlertListSvc) GetDataById(req request.DetailAlertList) (resp response.A
RiskLevel
:
4
,
RiskLevel
:
4
,
AlertTime
:
now
,
AlertTime
:
now
,
ClassId
:
14
,
ClassId
:
14
,
ClassParentName
:
"预警分类"
,
ClassName
:
"预警对象"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigName
:
"CPU负载过高"
,
AlertRuleType
:
"51a2cc1e-eb24-4b16-b106-3dc9db963a49"
,
CurrentValue
:
85
,
CurrentValue
:
85
,
NotificationCount
:
3
,
NotificationCount
:
3
,
PushCount
:
3
,
PushCount
:
3
,
...
@@ -70,7 +74,11 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL
...
@@ -70,7 +74,11 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL
RiskLevel
:
4
,
RiskLevel
:
4
,
AlertTime
:
now
,
AlertTime
:
now
,
ClassId
:
14
,
ClassId
:
14
,
ClassParentName
:
"预警分类"
,
ClassName
:
"预警对象"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigName
:
"磁盘空间不足"
,
AlertRuleType
:
"51a2cc1e-eb24-4b16-b106-3dc9db963a49"
,
CurrentValue
:
85
,
CurrentValue
:
85
,
NotificationCount
:
3
,
NotificationCount
:
3
,
PushCount
:
3
,
PushCount
:
3
,
...
@@ -97,7 +105,11 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL
...
@@ -97,7 +105,11 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL
RiskLevel
:
3
,
RiskLevel
:
3
,
AlertTime
:
now
,
AlertTime
:
now
,
ClassId
:
14
,
ClassId
:
14
,
ClassParentName
:
"预警分类"
,
ClassName
:
"预警对象"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigId
:
"d773b37b-dbb4-4a7b-be11-ab40f8acc00e"
,
MetricConfigName
:
"响应时间超时"
,
AlertRuleType
:
"51a2cc1e-eb24-4b16-b106-3dc9db963a49"
,
CurrentValue
:
85
,
CurrentValue
:
85
,
NotificationCount
:
1
,
NotificationCount
:
1
,
PushCount
:
1
,
PushCount
:
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment