Bug 1309692

Summary: sadf -j does not output valid json
Product: [Fedora] Fedora Reporter: Bowe Strickland <bowe>
Component: sysstatAssignee: Peter Schiffer <pschiffe>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: pschiffe, varekova
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: sysstat-11.3.1-1.fc25 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-09 07:57:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bowe Strickland 2016-02-18 13:54:53 UTC
Description of problem:

sadf -j outputs invalid json


Version-Release number of selected component (if applicable):

sysstat-11.1.5-1.fc23.x86_64


How reproducible:
very

Steps to Reproduce:
1. sadf -j | python -c "import json, sys; print json.load(sys.stdin)"
2.
3.

Actual results:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib64/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib64/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python2.7/json/decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting , delimiter: line 17 column 12 (char 521)


Expected results:
loadable json


Additional info:

it looks like there's a comma missing before the 'fchosts' dict key?

[bowe@catbus ~]$ sadf -j | head -n 20 | tail -n 5
						{"cpu": "all", "user": 7.81, "nice": 0.09, "system": 1.77, "iowait": 0.11, "steal": 0.00, "idle": 90.22}
					]					"fchosts": [

					]
				},

Comment 1 Peter Schiffer 2016-03-01 11:16:55 UTC
Thanks for the bug report.

The issue was fixed in upstream in:
https://github.com/sysstat/sysstat/commit/54b03d154d46cbb94d2f29c2f85cafb69962660e

And currently is also fixed in rawhide. Is that enough for you? Not sure when I will have time to back-port this patch.

peter

Comment 2 Bowe Strickland 2016-03-08 21:40:17 UTC
yep, just raising the flag... thanks! --b

Comment 3 Peter Schiffer 2016-03-09 07:57:13 UTC
Thank you.

Comment 4 Peter Schiffer 2016-03-09 07:58:22 UTC
fixed in:
sysstat-11.3.1-1.fc25
http://koji.fedoraproject.org/koji/buildinfo?buildID=740001