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

Current Development version likely to have breaking changes
Post Reply
Simpler
Posts: 76
Joined: Mon Nov 02, 2015 12:40 am

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

Post 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?
Simpler
Posts: 76
Joined: Mon Nov 02, 2015 12:40 am

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

Post by Simpler »

I noticed that bbunge is experiencing the same thing:
viewtopic.php?p=132218&hilit=incorrect+ ... ue#p132218
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

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

Post 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.
Simpler
Posts: 76
Joined: Mon Nov 02, 2015 12:40 am

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

Post 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
Post Reply