mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-24 14:36:17 +01:00
S.M.A.R.T support (#614)
* add agent smart support * refactor(system): update JSON tags in SmartData struct * refactor(agent): use serial number as the key of SmartDataMap Updated the SmartManager's methods to use the device's serial number as the key in the SmartDataMap instead of the device name. * refactor: use raw values in smart attributes for nvme devices * feat: add S.M.A.R.T. data display in web ui Introduced a new Disks tab in the SystemDetail component to display disk information and S.M.A.R.T. data. The tab includes a table for visualizing disk attributes and their statuses. Also added SmartData and SmartAttribute interfaces to support the new functionality.
This commit is contained in:
@@ -237,6 +237,17 @@ func (a *Agent) getSystemStats() system.Stats {
|
||||
}
|
||||
}
|
||||
}
|
||||
if a.smartManager != nil {
|
||||
if smartData := a.smartManager.GetCurrentData(); len(smartData) > 0 {
|
||||
systemStats.SmartData = smartData
|
||||
if systemStats.Temperatures == nil {
|
||||
systemStats.Temperatures = make(map[string]float64, len(a.smartManager.SmartDataMap))
|
||||
}
|
||||
for key, value := range a.smartManager.SmartDataMap {
|
||||
systemStats.Temperatures[key] = float64(value.Temperature)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update base system info
|
||||
a.systemInfo.Cpu = systemStats.Cpu
|
||||
|
||||
Reference in New Issue
Block a user