ZoneMinder / zoneminder

ZoneMinder is a free, open source Closed-circuit television software application developed for Linux which supports IP, USB and Analog cameras.
http://www.zoneminder.com/
GNU General Public License v2.0
4.9k stars 1.2k forks source link

Fix: Add Cpu Usage % to header for standalone server #3840

Closed IgorA100 closed 1 month ago

IgorA100 commented 3 months ago

After: After

connortechnology commented 3 months ago

The reason I didn't implement this, although it is nice to have as part of the toolset, is that I WILL NOT add a 1 second pause to loading the UI, so the plan was to make sure the db Server object existed and got updated even for non-multi-server case.

Also, beware, not all OS's have /proc. In fact, linux may not have /proc either.

IgorA100 commented 3 months ago

I WILL NOT add a 1 second pause to loading the UI,

I've updated the code. The 1 second pause is no longer used.

Also, beware, not all OS's have /proc. In fact, linux may not have /proc either.

For Windows, you can receive the download without any gaps. I can add some code. But can Zoneminder be installed on Windows? What systems can ZM be installed on?

linux may not have /proc either.

I’m not ready to answer anything yet, I need to think. Which Linux systems don't have /proc

so the plan was to make sure the db Server object existed and got updated even for non-multi-server case

I see that CpuUsagePercent is not updated for server, although CpuLoad is updated. I don't know why this happens, because... I haven't studied code in detail. Probably this is executed somewhere in Perl scripts? As far as I understand, ID is not assigned to a single server?

connortechnology commented 3 months ago

OpenBSD is the prime example of not having /proc. In linux land a container or something might not have it. It is uncommon, but possible. Which is why I left the top parsing code in perl-side.

The top parsing is not reliable though. I intend to change the parsing to perl regexps instead of bash awk, etc to see what the actual output is that fails.

In terms of SERVER_ID, we can just use = 0 when not in multi-server mode. Code just needs a few tweaks to make that work.

This is all work in progress. Might be better if you joined slack, or discord or something to discuss with me more to prevent overlap of effort. Or maybe even the discussion parts of github since you are already here. Or forums...

IgorA100 commented 3 months ago

Ok Isaac, I get it. I'm more used to communicating on the forum. You've done a lot of work on detecting memory leaks. I haven't found any obvious problems with memory usage in the latest versions!

connortechnology commented 3 months ago

I'll try communicate better. Too used to working alone around here. I'll likely merge this, but just be aware that my plan is for most of this nice work to be not needed as the values will be updated in background in the db.

IgorA100 commented 3 months ago

I understand your thoughts. Yes, my solution is temporary. Maybe I'll look at the Pearl scripts a little later. You already have more important tasks.

davidcomerford commented 1 month ago

I'm confused why we'd want CPU usage if we already have system load average?

IgorA100 commented 1 month ago

These are slightly different values.

connortechnology commented 1 month ago

They are very different values. On many of my servers, the load can be 20 or more, but cpu usage is about 50%. There are lots of different reasons why processes might be waiting on service (which is what load is a measure of).

IgorA100 commented 1 month ago

Closed as a draft because... there is a more recent version #3843