Add CpuUserPercent and CpuSystemPercent to System_Stats
parent
4246d9626c
commit
fa9a0e45b7
|
@ -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,
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue