From ed472bcfd7fd53d086c7109d1d464dcb776d2e9f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 26 Feb 2024 13:54:48 -0500 Subject: [PATCH] Add remaining CpuUsage stats to Server_Stats --- db/zm_create.sql.in | 3 +++ db/zm_update-1.37.55.sql | 39 ++++++++++++++++++++++++++++++++++ distros/redhat/zoneminder.spec | 2 +- version.txt | 2 +- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 db/zm_update-1.37.55.sql diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index e60ecd5ee..837dbc797 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -711,7 +711,10 @@ CREATE TABLE `Server_Stats` ( `TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `CpuLoad` DECIMAL(5,1) default NULL, `CpuUserPercent` DECIMAL(5,1) default NULL, + `CpuNicePercent` DECIMAL(5,1) default NULL, `CpuSystemPercent` DECIMAL(5,1) default NULL, + `CpuIdlePercent` DECIMAL(5,1) default NULL, + `CpuUsagePercent` DECIMAL(5,1) default NULL, `TotalMem` bigint unsigned default null, `FreeMem` bigint unsigned default null, `TotalSwap` bigint unsigned default null, diff --git a/db/zm_update-1.37.55.sql b/db/zm_update-1.37.55.sql new file mode 100644 index 000000000..4559473f0 --- /dev/null +++ b/db/zm_update-1.37.55.sql @@ -0,0 +1,39 @@ +-- +-- Add Cpu Usage stats to Server Status +-- + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Server_Stats' + AND column_name = 'CpuNicePercent' + ) > 0, +"SELECT 'Column CpuNicePercent already exists in Server_Stats'", +"ALTER TABLE Server_Stats ADD `CpuNicePercent` DECIMAL(5,1) default NULL AFTER `CpuUserPercent`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Server_Stats' + AND column_name = 'CpuIdlePercent' + ) > 0, +"SELECT 'Column CpuIdlePercent already exists in Server_Stats'", +"ALTER TABLE Server_Stats ADD `CpuIdlePercent` DECIMAL(5,1) default NULL AFTER `CpuSystemPercent`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + +SET @s = (SELECT IF( + (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema = DATABASE() + AND table_name = 'Server_Stats' + AND column_name = 'CpuUsagePercent' + ) > 0, +"SELECT 'Column CpuUsagePercent already exists in Server_Stats'", +"ALTER TABLE Server_Stats ADD `CpuUsagePercent` DECIMAL(5,1) default NULL AFTER `CpuIdlePercent`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; diff --git a/distros/redhat/zoneminder.spec b/distros/redhat/zoneminder.spec index 78f27b0d8..6152a6a87 100644 --- a/distros/redhat/zoneminder.spec +++ b/distros/redhat/zoneminder.spec @@ -18,7 +18,7 @@ %global zmtargetdistro %{?rhel:el%{rhel}}%{!?rhel:fc%{fedora}} Name: zoneminder -Version: 1.37.54 +Version: 1.37.55 Release: 2%{?dist} Summary: A camera monitoring and analysis tool Group: System Environment/Daemons diff --git a/version.txt b/version.txt index 3018390c6..3b70cad19 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.37.54 +1.37.55