Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sar should detect compressed files and decompress #93

Open
otheus opened this issue Feb 5, 2016 · 6 comments
Open

sar should detect compressed files and decompress #93

otheus opened this issue Feb 5, 2016 · 6 comments

Comments

@otheus
Copy link

otheus commented Feb 5, 2016

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.

@stevekay
Copy link
Contributor

stevekay commented Feb 5, 2016

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?

@otheus
Copy link
Author

otheus commented Feb 7, 2016

The short-answer is: it's very easy to use zlib to open files. See http:https://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.

@otheus
Copy link
Author

otheus commented Feb 7, 2016

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.

@sanxiago
Copy link

sanxiago commented Feb 7, 2016

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
#93 (comment).

@sysstat
Copy link
Owner

sysstat commented Feb 9, 2016

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.

@otheus
Copy link
Author

otheus commented Feb 24, 2016

@sysstat Understood. I will try to find time to work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants