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.6 handles Linux, HP-UX, AIX 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.

  • Is there a way to generate graphs with single indicators ?

    Yes, you can. The main script sar2rrd.pl allows you to generate graphs with all or some of the indicators for the same "sar data block". Using the '-g' option, you can precisely choose what you want to generate...

 Downloads

VersionsDateArchiveMD5 checksum
2.6.2 05 Sep 2011 sar2rrd-2.6.2.pl (Linux, HP-UX, AIX & Solaris) 4fd33a243ae11d4283e83f50d631c0e6
sar2rrd-graph-2.6.2.pl f000237f3687c233b7a7721f9c042dd0
2.6.1 23 Aug 2011 sar2rrd-2.6.1.pl (Linux, HP-UX, AIX & Solaris) 58dfce22a71cfe3e3268b0b221144410
sar2rrd-graph-2.6.1.pl cd1b77ebd5c5234b4e599594889bf3c6
2.6 01 Aug 2011 sar2rrd-2.6.pl (Linux, HP-UX, AIX & Solaris) f9eaeb820bd946a680e55ab5b453400c
sar2rrd-graph-2.6.pl c622e8326b724a9e62dcd8b28589f6d1
2.5 15 Jun 2010 sar2rrd-2.5.pl (Linux, HP-UX & Solaris) edbc29f61620afa8ca9c298cca23eba2
sar2rrd-graph-2.5.pl 1374f9a1cb7786ea64815781345ee911
2.4d 06 Jun 2010 sar2rrd-2.4.pl (Linux & Solaris) 663b60c642460f8563d415eef887f226
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