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.

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

 Requirements

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

 Syntax

Usage: ./sar2rrd.pl \
                [-?ov] [-d rrd_dir] [-i img_dir] [-W width]
                [-H height] [-s start_date] [-e end_date] [-S step]
                [-g graph_spec] [-t DMY|MDY|YDM|YMD] -f sar_file

Options:
  -? : this help
  -v : verbose mode
  -o : use a logarithmic scale for Y scale
  -d rrd_dir : directory where RRD files must be created
  -i img_dir : directory where to place PNG images
  -W width : images width (in pixels)
  -H height : images height (in pixels)
  -s start_date : start date (MM-DD-YYYY HH:MM:SS)
  -e end_date : end date (MM-DD-YYYY HH:MM:SS)
  -S step : interval (in seconds) between to values in the graph
  -g graph_spec: by default all possible graphs are created
     graph_spec syntax is: data[:(+|-)column[,column...]]
     this creates only the graph and the specified columns
  -t MDY|DMY|YDM|YMD: indicates the format of the date on the 1st output line
  -f sar_file : file to analyse - created by the 'sar -f ...' command

Please use the "-t" option to fix the following error:

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.


 Downloads

VersionsDateArchiveMD5 checksum
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

This site is maintained by jdelamarche@maje.biz