[ZBX-3173] server-side json parser does not handle whitespace properly Created: 2010 Nov 03  Updated: 2017 May 30  Resolved: 2011 Jan 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.8.4rc1
Fix Version/s: 1.8.5

Type: Incident report Priority: Major
Reporter: Aleksandrs Saveljevs Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Consider the following JSON for file system discovery:

{
"vfs.fs.type.discovery":[

{ "

{#FSNAME}":"\/", "{#FSTYPE}":"rootfs" },
{ "{#FSNAME}

":"\/sys", "

{#FSTYPE}":"sysfs" },
{ "{#FSNAME}":"\/proc", "{#FSTYPE}

":"proc" },
{ "

{#FSNAME}":"\/dev", "{#FSTYPE}":"devtmpfs" },
{ "{#FSNAME}

":"\/dev\/pts", "

{#FSTYPE}":"devpts" },
{ "{#FSNAME}":"\/", "{#FSTYPE}

":"ext3" },
{ "

{#FSNAME}":"\/lib\/init\/rw", "{#FSTYPE}":"tmpfs" },
{ "{#FSNAME}

":"\/dev\/shm", "

{#FSTYPE}":"tmpfs" },
{ "{#FSNAME}":"\/home", "{#FSTYPE}

":"ext3" },
{ "

{#FSNAME}":"\/tmp", "{#FSTYPE}":"ext3" },
{ "{#FSNAME}

":"\/usr", "

{#FSTYPE}":"ext3" },
{ "{#FSNAME}":"\/var", "{#FSTYPE}

":"ext3" },
{ "

{#FSNAME}

":"\/sys\/fs\/fuse\/connections", "

{#FSTYPE}

":"fusectl" }

]
}

Our JSON parser requires that there is no whitespace around the colon. If there is whitespace, server says "Wrong data in JSON.", which is not a very helpful error message.

We should improve our JSON parser so that we are more helpful to users wishing to implement their own discoveries in 2.0.



 Comments   
Comment by Aleksandrs Saveljevs [ 2010 Nov 03 ]

See http://www.json.org/ for more information on JSON.

Comment by Aleksandrs Saveljevs [ 2011 Jan 12 ]

Made our JSON parser ignore whitespace better. Development branch: svn://svn.zabbix.com/branches/dev/ZBX-3173.

Comment by Aleksandrs Saveljevs [ 2011 Jan 17 ]

Available in pre-1.8.5 in r16964.

Generated at Thu Mar 28 10:48:22 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.