henrygd / beszel

Lightweight server monitoring hub with historical data, docker stats, and alerts.
MIT License
2.46k stars 78 forks source link

Inverted CPU graphs. Same node, different interface. #224

Open Stitch10925 opened 1 week ago

Stitch10925 commented 1 week ago

Hey Henry,

So this is an interesting one. I have a Docker swarm setup with separate management and data interfaces, this means that each of my Docker nodes has 2 network adapters.

All of my nodes has an agent running on it. For testing purposes I added the IP of both interfaces to Beszel, All of the logging seems to be the same for both interfaces, as expected, since it's the same machine. However, the CPU graphs seem to be inverted:

image

vs:

image

henrygd commented 1 week ago

Are these using the same agent instance?

Stats like RAM and disk usage will be the same because those are just moment-in-time snapshots. But for CPU we check the total usage since the last query and divide it by the time between the checks. That gives us the average usage over the intervening time.

If you have multiple systems hooked up to the same agent instance, things can go wonky because different systems are resetting the time periods. And you may get some errors related to memory safety.

If you want multiple users to have access to the same system, share it through PocketBase rather than recreating it.

Try running running a second agent on a different port and setting the other system to use that agent instead. Then both should match very closely.