Sysstat Graph
Current version: 0.4 - released 2011-04-07
Page last updated: 2011-04-07
Author: Peter Mescalchin
About
Sysstat Graph renders in-browser graphs driven from daily activity reports generated by the SYSSTAT collection of performance monitoring tools for Linux.
Daily reporting data is collated and processed by PHP5 on the server and rendered in the browser using JavaScript via the <canvas> element, originally implemented in the Safari web browser and now available in most current generation browsers including:
Installation is simple with all generated data kept in a single flat data file - no database required.
The web utility was created to:
- Visualise the comprehensive amount of data SYSSTAT can collect, but is often hard to analyse via text file reports.
- An easy way to view your server's daily/recent performance without having to login into the server itself.
If you have any questions, comments, or possible improvements please contact me.
Follow magnetikonline on Twitter to stay up to date with new Sysstat Graph versions as they are released.
Metrics displayed
The following system metrics from SYSSTAT reports are rendered:
- Tasks created (per second)
- Context switches (per second)
- CPU utilisation (User/System/IOwait)
- Memory usage / Swap usage (megabytes)
- Running/sleeping task count (threads)
- System load averages
- Network packets (received/transmitted per second) - per adapter
- Network kilobytes (received/transmitted per second) - per adapter
Updates
-
2011-04-07
Version 0.4 now allows multiple network adapters to be graphed, note the configuration file has changed slightly to support this. Also:
- Cleanup of file line endings (all Linux LF ended now).
- A few small re-factors, nothing visible with the UI.
- Hopefully will have some time in the near future to add disk level statistics and test/fix to work with newer SYSSTAT releases.
-
2010-05-27
Version 0.3 brings a number of bug fixes, error reporting and stability after some great user feedback:
- Supports reading of sarXX files with 12 hour timestamps - which seems to be dependent on the system locale.
- Presents error message if current file system permissions don't allow the creation of the JSONSTRUCTUREFILENAME data file.
- Better handing and graphing of metrics with very low values (e.g. low network traffic), which has been known to crash previous versions.
- Some updates to the formatting of this document to hopefully improve readability.
- Coming in next release: Support for disk level statistics & multiple network adapter support.
-
2009-12-26
A few handy enhancements in this 0.2 release:
- Firstly a "jump to graph" fly-out side box, similar in implementation to another other project of mine Webalizer PHP.
- Added min/max values for each metric in the footer of the graph legend area.
- Task count graph now includes both running and sleeping tasks.
- Plus some small speed enhancements to the sarXX file importer on the PHP code side.
-
2009-06-15
Initial release.
Screenshots
Demo
You can view a demonstration version of Sysstat Graph here.
Requirements
- PHP5 (tested with 5.3.2, should work with PHP 5.2 or greater)
- Working installation of SYSSTAT
- Development is currently against version 9.1.1 - 9.0.6 & 9.0.3 also known to work.
- Newer/previous versions may work, but the formatting of generated sarXX reports have known to change between versions. This may cause problems for Sysstat Graph with its ability to successfully parse sarXX files.
- Permissions for PHP to read SYSSTAT sarXX report files
- (Usually) placed in /var/log/sa/.
- Modification of open_basedir for your PHP install might be required.
- Web browser capable of rendering <canvas> elements for graph generation.
Installation
- Download, make & make install SYSSTAT 9.1.1/equivalent (or install binary package for your distro) - refer to Installation of sysstat.
- Setup cron jobs for /usr/lib/sa/sa1 & /usr/lib/sa/sa2 to collect system accounting information and generate daily report sarXX files - refer to Configuring sysstat / Cron information.
- Verify SYSSTAT cron jobs are successfully creating sarXX files in /var/log/sa.
- Allow a few executions of /usr/lib/sa/sa1 to generate a new /var/log/sa/saXX binary file.
- /usr/lib/sa/sa2 will then be able to generate a new /var/log/sa/sarXX text file, used via Sysstat Graph.
- Unzip/upload Sysstat Graph to desired web path.
- Open config.php and edit the following settings where required:
- SYSSTATDATAPATH: Location of SYSSTAT generated daily report sarXX files.
- JSONSTRUCTUREFILENAME: Location of the JSON data structure generated from imported statistics and used client side by the JavaScript renderer. This file/folder needs to be writable by PHP, the default data.json will usually be fine.
- NETWORKINTERFACELIST: List of network adapters to graph (e.g. "lo" and "eth0") - the device name(s) for your adapters as reported by SYSSTAT - viewing a generated sarXX report file under the "IFACE" section will give you these values.
- That should be it. On first run your SYSSTAT sarXX reports will be processed and a file defined by JSONSTRUCTUREFILENAME will be created for in-browser rendering. Subsequent updates to sarXX daily report files made by the /usr/lib/sa/sa2 cron job will automatically cause Sysstat Graph to re-process reporting data and rebuild the JSONSTRUCTUREFILENAME file as required.
- Any problems feel free to contact me for assistance.
Downloads
Links