mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
add bandwidth alerts
This commit is contained in:
@@ -214,6 +214,7 @@ func (a *Agent) getSystemStats() system.Stats {
|
||||
a.systemInfo.MemPct = systemStats.MemPct
|
||||
a.systemInfo.DiskPct = systemStats.DiskPct
|
||||
a.systemInfo.Uptime, _ = host.Uptime()
|
||||
a.systemInfo.Bandwidth = twoDecimals(systemStats.NetworkSent + systemStats.NetworkRecv)
|
||||
|
||||
return systemStats
|
||||
}
|
||||
|
@@ -57,6 +57,8 @@ func (am *AlertManager) HandleSystemAlerts(systemRecord *models.Record, systemIn
|
||||
am.handleSlidingValueAlert(systemRecord, alertRecord, name, "%", systemInfo.MemPct)
|
||||
case "Disk":
|
||||
am.handleSlidingValueAlert(systemRecord, alertRecord, name+" usage", "%", systemInfo.DiskPct)
|
||||
case "Bandwidth":
|
||||
am.handleSlidingValueAlert(systemRecord, alertRecord, name, " MB/s", systemInfo.Bandwidth)
|
||||
case "Temperature":
|
||||
if temperatures == nil {
|
||||
continue
|
||||
|
@@ -61,6 +61,7 @@ type Info struct {
|
||||
Cpu float64 `json:"cpu"`
|
||||
MemPct float64 `json:"mp"`
|
||||
DiskPct float64 `json:"dp"`
|
||||
Bandwidth float64 `json:"b"`
|
||||
AgentVersion string `json:"v"`
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user