mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48:14 -05:00
chore: fix index bug & upgrade frontend
This commit is contained in:
parent
0c0143170d
commit
33115bb221
@ -75,17 +75,15 @@ func (r *AlertRule) Snapshot(cycleTransferStats *CycleTransferStats, server *Ser
|
||||
func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
||||
failCount := 0 // 检查未通过的个数
|
||||
|
||||
for i, rule := range r.Rules {
|
||||
for ruleId, rule := range r.Rules {
|
||||
if rule.IsTransferDurationRule() {
|
||||
// 循环区间流量报警
|
||||
if maxDuration < 1 {
|
||||
maxDuration = 1
|
||||
}
|
||||
for j := len(points) - 1; j >= 0; j-- {
|
||||
if !points[j][i] {
|
||||
failCount++
|
||||
break
|
||||
}
|
||||
if len(points) > 0 && !points[len(points)-1][ruleId] {
|
||||
failCount++
|
||||
break
|
||||
}
|
||||
} else {
|
||||
// 常规报警
|
||||
@ -96,11 +94,10 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
||||
if len(points) < duration {
|
||||
continue
|
||||
}
|
||||
|
||||
total, fail := 0.0, 0.0
|
||||
for j := len(points) - duration; j < len(points); j++ {
|
||||
for timeTick := len(points) - duration; timeTick < len(points); timeTick++ {
|
||||
total++
|
||||
if !points[j][i] {
|
||||
if !points[timeTick][ruleId] {
|
||||
fail++
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ type NotificationHistory struct {
|
||||
var (
|
||||
AlertsLock sync.RWMutex
|
||||
Alerts []*model.AlertRule
|
||||
alertsStore map[uint64]map[uint64][][]bool // [alert_id][server_id] -> 对应报警规则的检查结果
|
||||
alertsStore map[uint64]map[uint64][][]bool // [alert_id][server_id] -> [timeTick][ruleId] 时间点对应的rule的检查结果
|
||||
alertsPrevState map[uint64]map[uint64]uint8 // [alert_id][server_id] -> 对应报警规则的上一次报警状态
|
||||
AlertsCycleTransferStatsStore map[uint64]*model.CycleTransferStats // [alert_id] -> 对应报警规则的周期流量统计
|
||||
)
|
||||
|
@ -2,14 +2,14 @@
|
||||
name: "OfficialAdmin"
|
||||
repository: "https://github.com/nezhahq/admin-frontend"
|
||||
author: "nezhahq"
|
||||
version: "v1.4.3"
|
||||
version: "v1.4.4"
|
||||
isadmin: true
|
||||
isofficial: true
|
||||
- path: "user-dist"
|
||||
name: "Official"
|
||||
repository: "https://github.com/hamster1963/nezha-dash-v1"
|
||||
author: "hamster1963"
|
||||
version: "v1.9.3"
|
||||
version: "v1.10.3"
|
||||
isofficial: true
|
||||
- path: "nazhua-dist"
|
||||
name: "Nazhua"
|
||||
|
Loading…
Reference in New Issue
Block a user