mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-26 06:56:36 +08:00
WAF看板增加节点拦截排行和域名拦截排行
This commit is contained in:
@@ -132,6 +132,22 @@ func (this *NodeTrafficHourlyStatDAO) FindTopNodeStats(tx *dbs.Tx, role string,
|
||||
return
|
||||
}
|
||||
|
||||
// FindTopNodeStatsWithAttack 取得防火墙相关的节点排行数据
|
||||
func (this *NodeTrafficHourlyStatDAO) FindTopNodeStatsWithAttack(tx *dbs.Tx, role string, hourFrom string, hourTo string, size int64) (result []*NodeTrafficHourlyStat, err error) {
|
||||
// TODO 节点如果已经被删除,则忽略
|
||||
_, err = this.Query(tx).
|
||||
Attr("role", role).
|
||||
Gt("countAttackRequests", 0).
|
||||
Between("hour", hourFrom, hourTo).
|
||||
Result("nodeId, SUM(bytes) AS bytes, SUM(cachedBytes) AS cachedBytes, SUM(countRequests) AS countRequests, SUM(countCachedRequests) AS countCachedRequests, SUM(countAttackRequests) AS countAttackRequests, SUM(attackBytes) AS attackBytes").
|
||||
Group("nodeId").
|
||||
Desc("countRequests").
|
||||
Limit(size).
|
||||
Slice(&result).
|
||||
FindAll()
|
||||
return
|
||||
}
|
||||
|
||||
// FindTopNodeStatsWithClusterId 取得集群一定时间内的节点排行数据
|
||||
func (this *NodeTrafficHourlyStatDAO) FindTopNodeStatsWithClusterId(tx *dbs.Tx, role string, clusterId int64, hourFrom string, hourTo string, size int64) (result []*NodeTrafficHourlyStat, err error) {
|
||||
// TODO 节点如果已经被删除,则忽略
|
||||
|
||||
Reference in New Issue
Block a user