Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring: Stats to header (Cpu Usage %) #3843

Merged
merged 19 commits into from May 15, 2024

Conversation

IgorA100
Copy link
Contributor

@IgorA100 IgorA100 commented Feb 27, 2024

Perl script enters the calculated CPU loads into DB.
PHP gets data from DB and displays it

@IgorA100 IgorA100 marked this pull request as draft February 27, 2024 13:51
@IgorA100
Copy link
Contributor Author

@connortechnology

I tried to implement your idea.
For a single server everything works correctly.
I don’t have the opportunity to check for multi-servers, but in theory it should work.

Please merge and build.

@IgorA100 IgorA100 marked this pull request as ready for review February 27, 2024 15:22
@IgorA100
Copy link
Contributor Author

We need to resolve the issue with "$Config{ZM_SERVER_ID}"
When it is NULL it is bad because:
“NULL” is entered into the database, and on the “Options->Servers” page it is designated as “1”. Because of this, the values are not displayed correctly on the “Options->Servers” page.
But I don't know how to correctly change the "$Config{ZM_SERVER_ID}" setting from NULL to 1

@IgorA100 IgorA100 marked this pull request as draft February 27, 2024 18:49
@IgorA100 IgorA100 marked this pull request as ready for review February 27, 2024 19:06
@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 2, 2024

@connortechnology
Is there something you don't like or don't have time to check the code?

@connortechnology
Copy link
Member

See the comments. Remove removed the caching of previous calls and added a sleep. I don't want to sleep if we don't have to.

@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 2, 2024

Ok, I'll change the code.

We no longer use sllep()
A temporary file is now used to save the previous state.
Without the previous state, correct calculation of the load is not possible.
CPU load is calculated during the database update interval
@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 3, 2024

@connortechnology
I made changes and abandoned sleep().

@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 3, 2024

Without using a temporary file with the previous state it will not work.
I don't see any point in storing temporary information in the "Server_Stats" table. In addition, the table will have to be enlarged by adding 4 columns.
Do you like it or not?

@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 4, 2024

Did I do something wrong?

@connortechnology
Copy link
Member

At no time did I mention the Server_Stats table. I mean leave it in the in-memory server object.

@IgorA100
Copy link
Contributor Author

IgorA100 commented Mar 6, 2024

@connortechnology
Forgive me Isaac.
I don't know Perl very well.

I hope you are now satisfied with my code?

@IgorA100
Copy link
Contributor Author

What is my mistake now? :(
Everything works great for me.

@connortechnology
Copy link
Member

When I find the time, I'll modify it to suit me and merge. I'm actually on vacation right now... but also working and signing up new clients. Work load 400%.

@IgorA100
Copy link
Contributor Author

I'm actually on vacation right now...

Sorry, Isaac.
It's good for you to rest!

@IgorA100 IgorA100 changed the title Refactoring: Stats to header Refactoring: Stats to header (Cpu Usage %) Apr 27, 2024
@IgorA100
Copy link
Contributor Author

@connortechnology
Didn't find time to look at this PR?
It works for me without problems.

@connortechnology connortechnology merged commit 7bfd94b into ZoneMinder:master May 15, 2024
16 of 18 checks passed
@connortechnology
Copy link
Member

I have merged it, and also reverted the parts I didn't like. ANd fixed the sql for loading of stats in php.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants