Page 1 of 1

:Incorrect decimal value: '' for column `zm`.`Server_Stats`.`CpuSystemPercent` at row 1

Posted: Thu Nov 30, 2023 1:49 am
by Simpler
Running 1.37.47 (latest commit) and I keep seeing the following error message in my logs:

Code: Select all

Failed INSERT INTO Server_Stats (ServerId, TimeStamp, CpuLoad, CpuUserPercent, CpuSystemPercent, TotalMem, FreeMem, TotalSwap, FreeSwap) VALUES ('',NOW(),?,?,?,?,?,?,?) :Incorrect decimal value: '' for column `zm`.`Server_Stats`.`CpuSystemPercent` at row 1

from zmstats.pl

Where does it get the CpuSystemPercent from and why would it be an incorrect decimal value some of the time?

Re: :Incorrect decimal value: '' for column `zm`.`Server_Stats`.`CpuSystemPercent` at row 1

Posted: Thu Nov 30, 2023 1:53 am
by Simpler
I noticed that bbunge is experiencing the same thing:
viewtopic.php?p=132218&hilit=incorrect+ ... ue#p132218

Re: :Incorrect decimal value: '' for column `zm`.`Server_Stats`.`CpuSystemPercent` at row 1

Posted: Thu Nov 30, 2023 7:37 pm
by iconnor
It runs: top -b -n 1 | grep "^%Cpu(s)" | awk '{print $2, $4}'
Sometimes we don't get a value. Not sure why.

Re: :Incorrect decimal value: '' for column `zm`.`Server_Stats`.`CpuSystemPercent` at row 1

Posted: Thu Nov 30, 2023 8:50 pm
by Simpler
Thanks. That makes sense.

if we don't get user_utilization, we probably don't get system_utilization. We should either set both to 0 if user_utilization is not returned properly or have two separate checks and set system_utilization to 0 if not returned properly.

Looks like sometimes the "%Cpu(s):" is not returned at the beginning, so the command ends up returning "us, sy," (what should be the 3rd and 5th fields):

Code: Select all

$top -b -n 1 | grep "^%Cpu(s)"
%Cpu(s):  5.6 us,  6.9 sy,  0.0 ni, 81.9 id,  0.0 wa,  0.0 hi,  5.6 si,  0.0 st