Convert sar text output into RRDTool Graphs

 Background

sar2rrd.pl is a Perl script that can be used to generate RRDTool graphs from sar output.

It creates a PNG Graph for each statistics group collected by sar.
Version 2.0 handles both Linux and Solaris sar output.
Each statistics of the group is represented as a single line in the graph.

Only the filename to parse is mandatory. This filename if produced by a command such as "sar -A -f filename"

Without any additional parameters, sar2rrd.pl creates graphs for the period of time specified in the given filename.

Starting with the version 2.4, the script is able to concatenate data in an existing RRD file. It can truncate archives to a maximum size.

A new "companion" script : sar2rrd-graph.pl can generate graphs from existing RRD archives without re-parsing the "sar" data.

Before running the script, make sure the path to "rrdtool" command is correct.

 Requirements

  • Perl
  • rrdtool
  • Getopt::Std
  • Time::Local
  • Date::Calc

 FAQ

  • I get this error message:

    Argument "07-06-06" isn't numeric in integer ge (>=) at /usr/lib/perl5/5.8.8/Time/Local.pm line 103, <FD> line 5.

    This is probably because the date format in the SAR output is not the default month-day-year format. You should try the "-t DMY" option.

  • How do I concatenate data to an existing graph ?

    Imagine you run "sar" and get a single output file per day. The new -C option allows you to add new values to an existing RRD file.

  • Is there a way to limit the size of the RRD files when I use the concatenation ?

    Yes, you can add the -T #days option with the -C option.

  • Is there a way to generate new graphs without re-parsing the data ?

    Yes, you can. Since v2.4, the main script sar2rrd.pl writes in a XML file, which contains all the necessary parameters to build new graphs with the same RRD files. The graphs can be rebuilt with the new sar2rdd-graph.pl script.

 Downloads

VersionsDateArchiveMD5 checksum
2.4 21 Feb 2009 sar2rrd-2.4.pl (Linux & Solaris) d51bd231562376e034db26a471329842
sar2rrd-graph-2.4.pl c8d282e71afba0ddfd579debf0ef91a9
2.3 25 Oct 2008 sar2rrd-2.3.pl (Linux & Solaris) 782f5adb30e06831cfd000d7fa69302f
2.2 25 Sep 2007 sar2rrd-2.2.pl (Linux & Solaris) 51fda390599794bef44d529a34b5e524
2.1 21 Aug 2007 sar2rrd-2.1.pl (Linux & Solaris) 7b1ca3797c94db90c50b79ff9c173dfb
2.0b 11 Jun 2007 sar2rrd-2.0b.pl (Linux & Solaris) 9afe57acf18fa9dbe1d3972d7ac3b96e
2.0a 10 May 2007 sar2rrd-2.0a.pl (Linux & Solaris) d80522f936b0b32bc5585159848a1cc8
2.0 26 Mar 2007 sar2rrd-2.0.pl (Linux & Solaris) 3e40f6f99dbd19b0a84efcc3abb1c8e7
1.2 05 Feb 2007 sar2rrd-1.2.pl (Linux) bb0103985647f1563cbaeaa51294d705
1.1 15 Jan 2007 sar2rrd-1.1.pl (Linux) c41726ed384333885ccb49585852e857
1.0 30 Nov 2006 sar2rrd-1.0.pl (Linux) 46681888a800ce1bc46b0e49eecbc356

Dagobert Michelsen has packaged sar2rrd for Solaris for OpenCSW.
You can download his package here http://www.opencsw.org/packages/sar2rrd.


This site is maintained by jdelamarche@maje.biz