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) {
|
func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
||||||
failCount := 0 // 检查未通过的个数
|
failCount := 0 // 检查未通过的个数
|
||||||
|
|
||||||
for i, rule := range r.Rules {
|
for ruleId, rule := range r.Rules {
|
||||||
if rule.IsTransferDurationRule() {
|
if rule.IsTransferDurationRule() {
|
||||||
// 循环区间流量报警
|
// 循环区间流量报警
|
||||||
if maxDuration < 1 {
|
if maxDuration < 1 {
|
||||||
maxDuration = 1
|
maxDuration = 1
|
||||||
}
|
}
|
||||||
for j := len(points) - 1; j >= 0; j-- {
|
if len(points) > 0 && !points[len(points)-1][ruleId] {
|
||||||
if !points[j][i] {
|
failCount++
|
||||||
failCount++
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 常规报警
|
// 常规报警
|
||||||
@ -96,11 +94,10 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
|||||||
if len(points) < duration {
|
if len(points) < duration {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
total, fail := 0.0, 0.0
|
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++
|
total++
|
||||||
if !points[j][i] {
|
if !points[timeTick][ruleId] {
|
||||||
fail++
|
fail++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ type NotificationHistory struct {
|
|||||||
var (
|
var (
|
||||||
AlertsLock sync.RWMutex
|
AlertsLock sync.RWMutex
|
||||||
Alerts []*model.AlertRule
|
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] -> 对应报警规则的上一次报警状态
|
alertsPrevState map[uint64]map[uint64]uint8 // [alert_id][server_id] -> 对应报警规则的上一次报警状态
|
||||||
AlertsCycleTransferStatsStore map[uint64]*model.CycleTransferStats // [alert_id] -> 对应报警规则的周期流量统计
|
AlertsCycleTransferStatsStore map[uint64]*model.CycleTransferStats // [alert_id] -> 对应报警规则的周期流量统计
|
||||||
)
|
)
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
name: "OfficialAdmin"
|
name: "OfficialAdmin"
|
||||||
repository: "https://github.com/nezhahq/admin-frontend"
|
repository: "https://github.com/nezhahq/admin-frontend"
|
||||||
author: "nezhahq"
|
author: "nezhahq"
|
||||||
version: "v1.4.3"
|
version: "v1.4.4"
|
||||||
isadmin: true
|
isadmin: true
|
||||||
isofficial: true
|
isofficial: true
|
||||||
- path: "user-dist"
|
- path: "user-dist"
|
||||||
name: "Official"
|
name: "Official"
|
||||||
repository: "https://github.com/hamster1963/nezha-dash-v1"
|
repository: "https://github.com/hamster1963/nezha-dash-v1"
|
||||||
author: "hamster1963"
|
author: "hamster1963"
|
||||||
version: "v1.9.3"
|
version: "v1.10.3"
|
||||||
isofficial: true
|
isofficial: true
|
||||||
- path: "nazhua-dist"
|
- path: "nazhua-dist"
|
||||||
name: "Nazhua"
|
name: "Nazhua"
|
||||||
|
Loading…
Reference in New Issue
Block a user