Add CpuUserPercent and CpuSystemPercent to System_Stats

pull/3669/head
Isaac Connor 2023-03-01 13:42:21 -05:00
parent 4246d9626c
commit fa9a0e45b7
2 changed files with 31 additions and 0 deletions

View File

@ -699,6 +699,8 @@ CREATE TABLE `Server_Stats` (
`ServerId` int(10) unsigned,
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`CpuLoad` DECIMAL(5,1) default NULL,
`CpuUserPercent` DECIMAL(5,1) default NULL,
`CpuSystemPercent` DECIMAL(5,1) default NULL,
`TotalMem` bigint unsigned default null,
`FreeMem` bigint unsigned default null,
`TotalSwap` bigint unsigned default null,

29
db/zm_update-1.37.37.sql Normal file
View File

@ -0,0 +1,29 @@
SELECT 'Checking for CpuUserPercent in ServerStats';
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Server_Stats'
AND table_schema = DATABASE()
AND column_name = 'CpuUserPercent'
) > 0,
"SELECT 'Column CpuUserPercent already exists in Server_Stats'",
"ALTER TABLE Server_Stats ADD `CpuUserPercent` DECIMAL(5,1) default NULL AFTER `CpuLoad`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;
SELECT 'Checking for CpuSystemPercent in ServerStats';
SET @s = (SELECT IF(
(SELECT COUNT(*)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = 'Server_Stats'
AND table_schema = DATABASE()
AND column_name = 'CpuSystemPercent'
) > 0,
"SELECT 'Column CpuSystemPercent already exists in Server_Stats'",
"ALTER TABLE Server_Stats ADD `CpuSystemPercent` DECIMAL(5,1) default NULL AFTER `CpuUserPercent`"
));
PREPARE stmt FROM @s;
EXECUTE stmt;