mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-23 22:16:18 +01:00
built-in agent
This commit is contained in:
@@ -70,13 +70,15 @@ func (a *Agent) Run(pubKey []byte, addr string) {
|
||||
|
||||
// if debugging, print stats
|
||||
if a.debug {
|
||||
slog.Debug("Stats", "data", a.gatherStats())
|
||||
slog.Debug("Stats", "data", a.GatherStats())
|
||||
}
|
||||
|
||||
a.startServer(pubKey, addr)
|
||||
if pubKey != nil {
|
||||
a.startServer(pubKey, addr)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Agent) gatherStats() system.CombinedData {
|
||||
func (a *Agent) GatherStats() system.CombinedData {
|
||||
systemData := system.CombinedData{
|
||||
Stats: a.getSystemStats(),
|
||||
Info: a.systemInfo,
|
||||
|
||||
@@ -24,7 +24,7 @@ func (a *Agent) startServer(pubKey []byte, addr string) {
|
||||
}
|
||||
|
||||
func (a *Agent) handleSession(s sshServer.Session) {
|
||||
stats := a.gatherStats()
|
||||
stats := a.GatherStats()
|
||||
slog.Debug("Sending stats", "data", stats)
|
||||
if err := json.NewEncoder(s).Encode(stats); err != nil {
|
||||
slog.Error("Error encoding stats", "err", err)
|
||||
|
||||
Reference in New Issue
Block a user