I want to convert the output of ifstat command into JSON and serve it over http on the fly to be used for a javascript graph app. Are there any lightweight — sed or awk — command-line solutions which I can use? I do not want to store JSON output on the disk and it would be good if the web-server was a small lightweight command line tool into which I can pipe JSON output.
EDIT 1:
This is the live streaming chart library which will use the data. I’m not keen on a specific web server; any webserver that does the job would be fine.
This is what I have tried.
Terminal #1
Terminal #2
firefox
open: http://localhost:8000
I know little about
JSON. Maybe the output is invalid. You should rewrite theawkcommand.