add bandwidth alerts

This commit is contained in:
Henry Dollman
2024-10-12 17:22:25 -04:00
parent b464fa5b3f
commit 6c31263e60
6 changed files with 20 additions and 5 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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"`
}