mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
update debug logs
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
package agent
|
package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"beszel"
|
||||||
"beszel/internal/entities/system"
|
"beszel/internal/entities/system"
|
||||||
"context"
|
"context"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
@@ -47,6 +48,8 @@ func (a *Agent) Run(pubKey []byte, addr string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slog.Debug(beszel.Version)
|
||||||
|
|
||||||
// Set sensors context (allows overriding sys location for sensors)
|
// Set sensors context (allows overriding sys location for sensors)
|
||||||
if sysSensors, exists := os.LookupEnv("SYS_SENSORS"); exists {
|
if sysSensors, exists := os.LookupEnv("SYS_SENSORS"); exists {
|
||||||
slog.Info("SYS_SENSORS", "path", sysSensors)
|
slog.Info("SYS_SENSORS", "path", sysSensors)
|
||||||
|
@@ -173,12 +173,12 @@ func (a *Agent) getSystemStats() system.Stats {
|
|||||||
|
|
||||||
// temperatures
|
// temperatures
|
||||||
temps, err := sensors.TemperaturesWithContext(a.sensorsContext)
|
temps, err := sensors.TemperaturesWithContext(a.sensorsContext)
|
||||||
if err != nil && a.debug {
|
if err != nil {
|
||||||
err.(*sensors.Warnings).Verbose = true
|
// err.(*sensors.Warnings).Verbose = true
|
||||||
slog.Debug("Sensor error", "errs", err)
|
slog.Debug("Sensor error", "err", err)
|
||||||
}
|
}
|
||||||
|
slog.Debug("Temperature", "sensors", temps)
|
||||||
if len(temps) > 0 {
|
if len(temps) > 0 {
|
||||||
slog.Debug("Temperatures", "data", temps)
|
|
||||||
systemStats.Temperatures = make(map[string]float64, len(temps))
|
systemStats.Temperatures = make(map[string]float64, len(temps))
|
||||||
for i, sensor := range temps {
|
for i, sensor := range temps {
|
||||||
// skip if temperature is 0
|
// skip if temperature is 0
|
||||||
@@ -209,6 +209,7 @@ func (a *Agent) getSystemStats() system.Stats {
|
|||||||
a.systemInfo.DiskPct = systemStats.DiskPct
|
a.systemInfo.DiskPct = systemStats.DiskPct
|
||||||
a.systemInfo.Uptime, _ = host.Uptime()
|
a.systemInfo.Uptime, _ = host.Uptime()
|
||||||
a.systemInfo.Bandwidth = twoDecimals(systemStats.NetworkSent + systemStats.NetworkRecv)
|
a.systemInfo.Bandwidth = twoDecimals(systemStats.NetworkSent + systemStats.NetworkRecv)
|
||||||
|
slog.Debug("sysinfo", "data", a.systemInfo)
|
||||||
|
|
||||||
return systemStats
|
return systemStats
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user