Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["monitor.go"],
importpath = "go-common/app/admin/main/aegis/model/monitor",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,64 @@
package monitor
const (
// RedisPrefix 参数:business。参数1bid参数2监控ID
RedisPrefix = "monitor_stats_%d"
// CompGT 大于
CompGT = ">"
// CompLT 小于
CompLT = "<"
)
// RuleResultData 返回的结果数据
type RuleResultData struct {
Rule *Rule `json:"rule"`
User *User `json:"user"`
Stats *Stats `json:"stats"`
}
// Rule 监控规则信息
type Rule struct {
ID int64 `json:"id"`
Type int8 `json:"type"`
BID int8 `json:"bid"`
Name string `json:"name"`
State int8 `json:"state"`
STime string `json:"stime"`
ETime string `json:"etime"`
CTime string `json:"ctime"`
MTime string `json:"mtime"`
UID int64 `json:"uid"`
RuleConf *RuleConf `json:"rule"`
}
// RuleConf 监控方案配置结构体
type RuleConf struct {
Name string `json:"name"`
MoniCdt map[string]struct { //监控方案的监控条件
Comp string `json:"comparison"`
Value int64 `json:"value"`
} `json:"moni_cdt"`
NotifyCdt map[string]struct { //达到发送通知的条件
Comp string `json:"comparison"`
Value int64 `json:"value"`
} `json:"notify_cdt"`
Notify struct { //通知类型配置
Way int8 `json:"way"`
Member []string `json:"member"`
} `json:"notify"`
}
// Stats 监控统计
type Stats struct {
TotalCount int `json:"total_count"`
MoniCount int `json:"moni_count"`
MaxTime int `json:"max_time"`
}
// User manager user struct
type User struct {
ID int64 `json:"id"`
UserName string `json:"username"`
NickName string `json:"nickname"`
}