mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-23 22:16:18 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b9910351d | ||
|
|
f397ab0797 | ||
|
|
b1fc715ec9 | ||
|
|
d25c7c58c1 |
@@ -33,8 +33,9 @@ type Agent struct {
|
|||||||
|
|
||||||
func NewAgent() *Agent {
|
func NewAgent() *Agent {
|
||||||
agent := &Agent{
|
agent := &Agent{
|
||||||
fsStats: make(map[string]*system.FsStats),
|
sensorsContext: context.Background(),
|
||||||
cache: NewSessionCache(69 * time.Second),
|
fsStats: make(map[string]*system.FsStats),
|
||||||
|
cache: NewSessionCache(69 * time.Second),
|
||||||
}
|
}
|
||||||
agent.memCalc, _ = GetEnv("MEM_CALC")
|
agent.memCalc, _ = GetEnv("MEM_CALC")
|
||||||
|
|
||||||
@@ -59,8 +60,6 @@ func NewAgent() *Agent {
|
|||||||
agent.sensorsContext = context.WithValue(agent.sensorsContext,
|
agent.sensorsContext = context.WithValue(agent.sensorsContext,
|
||||||
common.EnvKey, common.EnvMap{common.HostSysEnvKey: sysSensors},
|
common.EnvKey, common.EnvMap{common.HostSysEnvKey: sysSensors},
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
agent.sensorsContext = context.Background()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set sensors whitelist
|
// Set sensors whitelist
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ func (a *Agent) getSystemStats() system.Stats {
|
|||||||
// temperatures (skip if sensors whitelist is set to empty string)
|
// temperatures (skip if sensors whitelist is set to empty string)
|
||||||
err = a.updateTemperatures(&systemStats)
|
err = a.updateTemperatures(&systemStats)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("Error getting temperatures", "err", err)
|
slog.Error("Error getting temperatures", "err", fmt.Sprintf("%+v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// GPU data
|
// GPU data
|
||||||
@@ -238,6 +238,7 @@ func (a *Agent) updateTemperatures(systemStats *system.Stats) error {
|
|||||||
// get sensor data
|
// get sensor data
|
||||||
temps, err := sensors.TemperaturesWithContext(a.sensorsContext)
|
temps, err := sensors.TemperaturesWithContext(a.sensorsContext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
slog.Error("Error getting temperatures", "err", fmt.Sprintf("%+v", err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
slog.Debug("Temperature", "sensors", temps)
|
slog.Debug("Temperature", "sensors", temps)
|
||||||
|
|||||||
@@ -64,11 +64,6 @@ func (h *Hub) BootstrapHub() (*Hub, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial setup
|
|
||||||
if err := h.initialize(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// serve web ui
|
// serve web ui
|
||||||
h.OnServe().BindFunc(h.startServer)
|
h.OnServe().BindFunc(h.startServer)
|
||||||
// set up scheduled jobs
|
// set up scheduled jobs
|
||||||
@@ -85,6 +80,11 @@ func (h *Hub) BootstrapHub() (*Hub, error) {
|
|||||||
// start system updates
|
// start system updates
|
||||||
h.sm.Initialize()
|
h.sm.Initialize()
|
||||||
|
|
||||||
|
// initial setup
|
||||||
|
if err := h.initialize(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return h, nil
|
return h, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,6 @@ func (h *Hub) initialize() error {
|
|||||||
|
|
||||||
// Start starts the hub application / server
|
// Start starts the hub application / server
|
||||||
func (h *Hub) Start() error {
|
func (h *Hub) Start() error {
|
||||||
// Use type assertion to access the Start method
|
|
||||||
if pb, ok := h.App.(*pocketbase.PocketBase); ok {
|
if pb, ok := h.App.(*pocketbase.PocketBase); ok {
|
||||||
return pb.Start()
|
return pb.Start()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package beszel
|
package beszel
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Version = "0.10.0"
|
Version = "0.10.1"
|
||||||
AppName = "beszel"
|
AppName = "beszel"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user