sar should detect compressed files and decompress
It's nice to see you added compression to older sar files. The feature is underdocumented and only partly supported. I'd like to help. I've written a wrapper to sar. See my repo here: https://github.com/otheus/sar-helper Essentially, if sar is told (with -f) to use a file that is compressed, it tries to decompress it.
To me, this code should be within sar itself. I've forked the project. I await your comments on how to proceed.
Good feature being able to easily read compressed files. How tricky would it be to make sar itself able to read compressed files natively by making use of zlib ? Would the various seek() backward calls make it impossible?
The short-answer is: it's very easy to use zlib to open files. See http://www.zlib.net/manual.html#Gzip. But with zlib you only get zlib's inflate/deflate or gzip. It would be nice for the future to support opening xz files, and according to that project's faq page "liblzma is a compression library with an API similar to that of zlib." I suspect bzip2 is not on anyone's mind anymore, but I believe a library exists for this also. (I included it in the script for users who might be doing that on older systems). So we need a wrapper routine, a way to detect the file format, and then we get a filehandle to the uncompressed data.
BTW: I know of two software packages that graph sar data, and both are very weak. One is java-based and craps out with large amounts of data; the other is php based and very very old and have not yet gotten it to work. Do you know of a good project that is doing this? Otherwise, I'd like to work on it.
You can use sadf to get data in other formats and use graphing backends, there is already a script to generate graphs in the contrib section: https://github.com/sysstat/sysstat/tree/master/contrib/sargraph
I am also working in one: https://github.com/sanxiago/sargraphjs I built it as a service, you can feed data to it piping it with netcat I still have to work to do on the parser and render I am using sadf for output, you can try it by running sadf -- -A | nc graph.sanxiago.com it should then reply with a url of your graphs, it works well with chrome in firefox it may complain about the script execution time, but will work.
On Feb 7, 2016 3:24 AM, "Otheus" [email protected] wrote:
BTW: I know of two software packages that graph sar data, and both are very weak. One is java-based and craps out with large amounts of data; the other is php based and very very old and have not yet gotten it to work. Do you know of a good project that is doing this? Otherwise, I'd like to work on it.
— Reply to this email directly or view it on GitHub https://github.com/sysstat/sysstat/issues/93#issuecomment-180982703.
FYI I'm currently working on a new output format for sadf: SVG, which will make it easy to get graphs using sysstat standard tools.
Wrt file compression, I don't have any time left to work on this. If this feature was to be added to sysstat, it should actually handle compression within sar, depend on an external library (don't implement compression algorithms yourself), be configurable out (sysstat commands must be able to be compiled even if this library is not installed), and be almost transparent to existing code to avoid regressions.
@sysstat Understood. I will try to find time to work on this.