Add support for json style output fot all labels #176
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, atop data can only be viewed when logging into a machine.
But sometimes we need to aggregate atop data of multiple machines
belonging to the same cluster, such as aggregation of the same
application processes, and then draw and show historical graphs
for users to query and use.
Considering json is widely used in data processing, this patch will
add json style output as a secondary output path. Three types of
output are supported:
For 3, make unixsock in a non-blocking state to guarantee it will not
block main engine forever. Another point is atop will try to reconnect
to the server and continue to work even if the unix remote server
relaunches.
Usage examples:
./atop
./atop -P ALL
./atop -O only // overwrite parseout, show json to stdio only
./atop -O stdio -P ALL // both parseout and json stdio
./atop -O stdio -w atop.log // print to stdio, as well as file
./atop -O unixsock // overwrite parseout, show json to unixsock
./atop -O unixsock -P ALL // both parseout and json unixsock
./atop -O unixsock -w atop.log // write json to unixsock and file
The detail json style output format is as follows:
{"ip": "a.b.c.d", "timestamp": 1565256314, ...,
"CPU": {"hertz": 100, "cpu_nums": 40, ...},
"cpu": [{"hertz": 100, "cpu_id": 3, ...}, ...,
{"hertz": 100, "cpu_id": 39, ...}],
"PRC": [{"pid": 1, "p_name": "(systemd)", ...}, ...,
{"pid": 73, "p_name": "(migration/12)", ...}],
...
}
Signed-off-by: Fei Li lifei.shirley@bytedance.com
Signed-off-by: zhenwei pi pizhenwei@bytedance.com