henrygd / beszel

A lightweight server monitoring hub with historical data, docker stats, and alerts.
MIT License
1.11k stars 45 forks source link

Built-in agent on the hub #140

Open steveiliop56 opened 2 weeks ago

steveiliop56 commented 2 weeks ago

Hello,

It would be really nice to have the agent built-in on the huh and displayed by default on the dashboard so we don't have to run 2 docker containers on the server.

henrygd commented 2 weeks ago

That's a good idea.

Mostly for myself - here are initial thoughts on how to do this:

  1. Add option to NewAgent to disable the SSH server (or just disable if pubkey is empty).
  2. Add method to agent that exports stats directly.
  3. On first user creation, create system with specific host, like hub-system.
  4. In hub, on system update, check if host matches above. If so, use method on agent to directly fetch stats.
  5. Check for agent and create agent in system update function to make sure it's available after restart or prev system deletion.
  6. If the system is deleted, make sure to delete agent and references.

I'll experiment with this at some point, but no timeline as of now.