-=head1 NAME
+=head1 NAME
rrd-beginners - RRDtool Beginners' Guide
=back
RRDtool is designed to store time series of data. With every data
-update, an assosiated time stamp is stored. Time is always expressed
-in seconds passed since epoch (01-01-1971). RRDtool can be installed
+update, an associated time stamp is stored. Time is always expressed
+in seconds passed since epoch (01-01-1970). RRDtool can be installed
on Unix as well as Windows. It comes with a command set to carry out
various operations on RRD databases. This command set can be accessed
from the command line, as well as from Shell or Perl scripts. The
This value is also called Primary Data Point B<(PDP)>. In our example
mentioned above, a new PDP is generated every 300 seconds.
-Note, that if you do NOT supply new datapoints exactly every 300 seconds,
+Note, that if you do NOT supply new data points exactly every 300 seconds,
this is not a problem, RRDtool will interpolate the data accordingly.
B<DST> (Data Source Type) defines the type of the DS. It can be
the previous value is greater than 0). Traffic counters on a router
are an ideal candidate for using COUNTER as DST. DERIVE is the same as
COUNTER, but it allows negative values as well. If you want to see the
-rate of I<change> in free diskspace on your server, then you might
+rate of I<change> in free disk space on your server, then you might
want to use the DERIVE data type. ABSOLUTE also saves the rate of
change, but it assumes that the previous value is set to 0. The
difference between the current and the previous value is always equal
Values = 300, 600, 900, 1200
Step = 300 seconds
- COUNTER DS = 1, 1, 1, 1
+ COUNTER DS = 1, 1, 1, 1
DERIVE DS = 1, 1, 1, 1
- ABSOLUTE DS = 1, 2, 3, 4
+ ABSOLUTE DS = 1, 2, 3, 4
GAUGE DS = 300, 600, 900, 1200
The next parameter is B<heartbeat>. In our example, heartbeat is 600
other number which might also be a valid data value. For example, the
traffic flow counter on a router keeps increasing. Lets say, a value
is missed for an interval and 0 is stored instead of UNKNOWN. Now when
-hte next value becomes available, it will calculate the difference
+the next value becomes available, it will calculate the difference
between the current value and the previous value (0) which is not
correct. So, inserting the value UNKNOWN makes much more sense here.
=head3 Perl script (retrieves data from database and generates graphs and statistics)
#!/usr/bin/perl -w
- # This script fetches data from target.rrd, creates a graph of memory
+ # This script fetches data from target.rrd, creates a graph of memory
# consumption on the target (Dual P3 Processor 1 GHz, 656 MB RAM)
# call the RRD perl module
my $start_time = $end_time - 2592000; # set start 30 days in the past
# fetch average values from the RRD database between start and end time
- my ($start,$step,$ds_names,$data) =
- RRDs::fetch("target.rrd", "AVERAGE",
+ my ($start,$step,$ds_names,$data) =
+ RRDs::fetch("target.rrd", "AVERAGE",
"-r", "600", "-s", "$start_time", "-e", "$end_time");
# save fetched values in a 2-dimensional array
my $rows = 0;
# calculate the average of the array
my $tot_mem_ave = $tot_mem_sum/($count);
# create the graph
- RRDs::graph ("/images/mem_$count.png", \
- "--title= Memory Usage", \
- "--vertical-label=Memory Consumption (MB)", \
- "--start=$start_time", \
- "--end=$end_time", \
- "--color=BACK#CCCCCC", \
- "--color=CANVAS#CCFFFF", \
- "--color=SHADEB#9999CC", \
- "--height=125", \
- "--upper-limit=656", \
- "--lower-limit=0", \
- "--rigid", \
- "--base=1024", \
- "DEF:tot_mem=target.rrd:mem:AVERAGE", \
- "CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/",\
- "CDEF:machine_mem=tot_mem,656,+,tot_mem,-",\
- "COMMENT:Memory Consumption between $start_time",\
- "COMMENT: and $end_time ",\
- "HRULE:656#000000:Maximum Available Memory - 656 MB",\
- "AREA:machine_mem#CCFFFF:Memory Unused", \
+ RRDs::graph ("/images/mem_$count.png",
+ "--title= Memory Usage",
+ "--vertical-label=Memory Consumption (MB)",
+ "--start=$start_time",
+ "--end=$end_time",
+ "--color=BACK#CCCCCC",
+ "--color=CANVAS#CCFFFF",
+ "--color=SHADEB#9999CC",
+ "--height=125",
+ "--upper-limit=656",
+ "--lower-limit=0",
+ "--rigid",
+ "--base=1024",
+ "DEF:tot_mem=target.rrd:mem:AVERAGE",
+ "CDEF:tot_mem_cor=tot_mem,0,671744,LIMIT,UN,0,tot_mem,IF,1024,/",
+ "CDEF:machine_mem=tot_mem,656,+,tot_mem,-",
+ "COMMENT:Memory Consumption between $start_time",
+ "COMMENT: and $end_time ",
+ "HRULE:656#000000:Maximum Available Memory - 656 MB",
+ "AREA:machine_mem#CCFFFF:Memory Unused",
"AREA:tot_mem_cor#6699CC:Total memory consumed in MB");
my $err=RRDs::error;
if ($err) {print "problem generating the graph: $err\n";}