reset it to zero and increment the digit just before the 9 so the
number becomes "00010". Leading zeros we don't write except if it is
the only digit (number 0). And of course, we write zeros if they occur
-anywhere inside or at the end of a number:
+anywhere inside or at the end of a number:
"00010" -> " 0010" -> " 010" -> " 10", but not " 1 ".
(2) (8) (10) (16)
00000 0 0 0
00001 1 1 1
- 00010 2 2 2
+ 00010 2 2 2
00011 3 3 3
00100 4 4 4
00101 5 5 5
has the advantage that you can see very easily if you should write down
a zero or a one: if you divide by two the remainder will be zero if it
is an even number and one if it is an odd number:
-
+
41029 / 2 = 20514 remainder 1
20514 / 2 = 10257 remainder 0
10257 / 2 = 5128 remainder 1
||
-=back
+=back
Processing the stack (step 5) will retrieve one value from the stack
(from the right at step 4). This is the operation multiply and this
This is not very intuitive (at least most people don't think so). For
the function f(A,B) you reverse the position of "f", but you do not
-reverse the order of the variables.
+reverse the order of the variables.
=head1 Converting your wishes to RPN
router1.rrd:link2in
router2.rrd:link1in
router3.rrd:link1in
- router3.rrd:link2in
+ router3.rrd:link2in
-------------------- +
(outcome of the sum)
not matter if you add a to b and then add c to the result or first
add b to c and then add a to the result. This makes it possible to
rewrite the RPN into C<CDEF:result=a,b,c,d,e,+,+,+,+> which is
-evaluated differently:
+evaluated differently:
push value of variable a on the stack: a
push value of variable b on the stack: a b
and process it: S (where S == a+R)
As you can see the RPN expression C<a,b,c,d,e,+,+,+,+,+> will evaluate in
-C<((((d+e)+c)+b)+a)> and it has the same outcome as C<a,b,+,c,+,d,+,e,+>.
+C<((((d+e)+c)+b)+a)> and it has the same outcome as C<a,b,+,c,+,d,+,e,+>.
This is called the commutative law of addition,
but you may forget this right away, as long as you remember what it
means.
First in normal math: C<let result = a+b*c>. In this case you can't
choose the order yourself, you have to start with the multiplication
and then add a to it. You may alter the position of b and c, you must
-not alter the position of a and b.
+not alter the position of a and b.
You have to take this in consideration when converting this expression
into RPN. Read it as: "Add the outcome of b*c to a" and then it is
similar to one of the expressions in the previous paragraph, only the
multiplication and the addition changed places.
-When you have problems with RPN or when RRDtool is complaining, it's
+When you have problems with RPN or when RRDtool is complaining, it's
usually a good thing to write down the stack on a piece of paper
and see what happens. Have the manual ready and pretend to be RRDtool.
Just do all the math by hand to see what happens, I'm sure this will
where x represents "time>937521357"
where a represents the original value
where b represents the outcome of the previous example
-
+
time>937521357 --> TIME,937521357,GT
if (x) then a else b --> x,a,b,IF
them when viewing what they do. Starting with the first CDEF we would
get:
- idat1,UN --> a
- 0 --> b
- idat1 --> c
+ idat1,UN --> a
+ 0 --> b
+ idat1 --> c
if (a) then (b) else (c)
The result is therefore "0" if it is true that "idat1" equals "UN".
the other half of your graph. This can be done in a relatively simple
way: what you need is the "wipeout" variable and place a negative
sign before it: "CDEF:wipeout2=wipeout,-1,*"
-
+
=head2 Filtering data
You may do some complex data filtering:
Now consider "2,1,LE". This RPN expression could be read as "is
two less than or equal to one?". The natural response is "no"
-and thus the RPN expression 2,1,LE evaluates to 0.
+and thus the RPN expression 2,1,LE evaluates to 0.
=head1 Reading the IF Operator
1) 20,10,GT,10,20,IF eval is 20,10,GT = 1 result is 1,10,20,IF
read the eval as pop "20 is greater than 10" so push 1
-
+
2) 1,10,20,IF eval is 1,10,20,IF = 10 result is 10
read pop "if 1 then 10 else 20" so push 10. Only 10 is left so
Read eval as "if input > 10 then true" and replace "input,10,GT"
with "A":
-
+
2) A,10,input,IF eval is A,10,input,IF
read "if A then 10 else input". Now replace A with it's verbose
Answer 1:
3*2+1 = 7 and 3*(2+1) = 9. These expressions have
- different answers because the altering of the plus and
+ different answers because the altering of the plus and
times operators alter the order of their evaluation.
-=head1 NAME
+=head1 NAME
rrd-beginners - RRDtool Beginners' Guide
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
=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;
tar zxf zlib-1.2.2.tar.gz
cd zlib-1.2.2
env CFLAGS="-O3 -fPIC" ./configure --prefix=$BUILD_DIR/lb
- make
+ make
make install
=item Building libpng
files. This is done via environment variables. Depending on the shellyou are running, the syntax for setting
environment variables is different. Under csh/tcsh you use:
- set IR=-I$BUILD_DIR/lb/include
+ set IR=-I$BUILD_DIR/lb/include
setenv CPPFLAGS "$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
setenv LDFLAGS -L$BUILD_DIR/lb/lib
setenv CFLAGS -O3
If you are running bash/sh/ash/ksh/zsh use this:
- IR=-I$BUILD_DIR/lb/include
+ IR=-I$BUILD_DIR/lb/include
CPPFLAGS="$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng"
LDFLAGS="-L$BUILD_DIR/lb/lib"
CFLAGS=-O3
export CPPFLAGS LDFLAGS CFLAGS
And finally try building again:
-
+
./configure --prefix=$INSTALL_DIR && make && make install
Now go to I<$INSTALL_DIR>B</examples> and run them to see if your
In the end it will printout a web page including the necessary CGI headers.
B<rrdcgi> parses the contents of the template in 3 steps. In each step it looks
-only for a subset of tags. This allows nesting of tags.
+only for a subset of tags. This allows nesting of tags.
The argument parser uses the same semantics as you are used from your C-shell.
Inserts the CGI variable of the given name, quotes it and makes sure
it starts neither with a '/' nor contains '..'. This is to make
-sure that no problematic pathnames can be introduced through the
+sure that no problematic pathnames can be introduced through the
CGI interface.
=item RRD::GETENV I<variable>
Analog to SETENV but for local variables.
-=item RRD::GETVAR I<variable>
+=item RRD::GETVAR I<variable>
Analog to GETENV but for local variables.
=head1 EXAMPLE 2
-This script is slightly more elaborate, it allows you to run it from
+This script is slightly more elaborate, it allows you to run it from
a form which sets RRD_NAME. RRD_NAME is then used to select which RRD
you want to use as source for your graph.
<INPUT TYPE=SUBMIT></FORM>
<H2>Graph</H2>
<P>
- <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
+ <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
--title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
LINE2:cel#00a000:"D. Celsius">
=head1 SYNOPSIS
-B<rrdtool> B<create> I<filename>
-S<[B<--start>|B<-b> I<start time>]>
-S<[B<--step>|B<-s> I<step>]>
+B<rrdtool> B<create> I<filename>
+S<[B<--start>|B<-b> I<start time>]>
+S<[B<--step>|B<-s> I<step>]>
S<[B<DS:>I<ds-name>B<:>I<DST>B<:>I<dst arguments>]>
S<[B<RRA:>I<CF>B<:>I<cf arguments>]>
=over 4
-=item B<GAUGE>
+=item B<GAUGE>
is for things like temperatures or number of people in a room or the
value of a RedHat share.
=back
-=item B<ABSOLUTE>
+=item B<ABSOLUTE>
is for counters which get reset upon reading. This is used for fast counters
which tend to overflow. So instead of reading them normally you reset them
=back
I<heartbeat> defines the maximum number of seconds that may pass
-between two updates of this data source before the value of the
+between two updates of this data source before the value of the
data source is assumed to be I<*UNKNOWN*>.
I<min> and I<max> define the expected range values for data supplied by a
The purpose of an B<RRD> is to store data in the round robin archives
-(B<RRA>). An archive consists of a number of data values or statistics for
+(B<RRA>). An archive consists of a number of data values or statistics for
each of the defined data-sources (B<DS>) and is defined with an B<RRA> line.
When data is entered into an B<RRD>, it is first fit into time slots
HWPREDICT I<rra-num> is the index of the SEASONAL B<RRA>.
-=item *
+=item *
SEASONAL I<rra-num> is the index of the HWPREDICT B<RRA>.
-=item *
+=item *
DEVPREDICT I<rra-num> is the index of the DEVSEASONAL B<RRA>.
DEVSEASONAL I<rra-num> is the index of the HWPREDICT B<RRA>.
-=item *
+=item *
FAILURES I<rra-num> is the index of the DEVSEASONAL B<RRA>.
=head1 EXAMPLE 2
- rrdtool create monitor.rrd --step 300 \
- DS:ifOutOctets:COUNTER:1800:0:4294967295 \
+ rrdtool create monitor.rrd --step 300 \
+ DS:ifOutOctets:COUNTER:1800:0:4294967295 \
RRA:AVERAGE:0.5:1:2016 \
- RRA:HWPREDICT:1440:0.1:0.0035:288
+ RRA:HWPREDICT:1440:0.1:0.0035:288
This example is a monitor of a router interface. The first B<RRA> tracks the
traffic flow in octets; the second B<RRA> generates the specialized
The same RRD file and B<RRAs> are created with the following command,
which explicitly creates all specialized function B<RRAs>.
- rrdtool create monitor.rrd --step 300 \
- DS:ifOutOctets:COUNTER:1800:0:4294967295 \
- RRA:AVERAGE:0.5:1:2016 \
- RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
- RRA:SEASONAL:288:0.1:2 \
- RRA:DEVPREDICT:1440:5 \
- RRA:DEVSEASONAL:288:0.1:2 \
- RRA:FAILURES:288:7:9:5
+ rrdtool create monitor.rrd --step 300 \
+ DS:ifOutOctets:COUNTER:1800:0:4294967295 \
+ RRA:AVERAGE:0.5:1:2016 \
+ RRA:HWPREDICT:1440:0.1:0.0035:288:3 \
+ RRA:SEASONAL:288:0.1:2 \
+ RRA:DEVPREDICT:1440:5 \
+ RRA:DEVSEASONAL:288:0.1:2 \
+ RRA:FAILURES:288:7:9:5
Of course, explicit creation need not replicate implicit create, a
number of arguments could be changed.
=head1 EXAMPLE 3
- rrdtool create proxy.rrd --step 300 \
- DS:Total:DERIVE:1800:0:U \
- DS:Duration:DERIVE:1800:0:U \
- DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
- RRA:AVERAGE:0.5:1:2016
+ rrdtool create proxy.rrd --step 300 \
+ DS:Total:DERIVE:1800:0:U \
+ DS:Duration:DERIVE:1800:0:U \
+ DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \
+ RRA:AVERAGE:0.5:1:2016
-This example is monitoring the average request duration during each 300 sec
+This example is monitoring the average request duration during each 300 sec
interval for requests processed by a web proxy during the interval.
In this case, the proxy exposes two counters, the number of requests
processed since boot and the total cumulative duration of all processed
=head1 SYNOPSIS
-B<rrdtool> B<dump> I<filename.rrd> E<gt> I<filename.xml>
+B<rrdtool> B<dump> I<filename.rrd> E<gt> I<filename.xml>
=head1 DESCRIPTION
On the same system where the RRD was created, use B<rrdtool> B<dump>
to export the data to XML format.
-=item 2.
+=item 2.
Transfer the XML dump to the target system.
=head1 SYNOPSIS
-B<rrdtool> B<fetch> I<filename> I<CF>
-S<[B<--resolution>|B<-r> I<resolution>]>
-S<[B<--start>|B<-s> I<start>]>
-S<[B<--end>|B<-e> I<end>]>
+B<rrdtool> B<fetch> I<filename> I<CF>
+S<[B<--resolution>|B<-r> I<resolution>]>
+S<[B<--start>|B<-s> I<start>]>
+S<[B<--end>|B<-e> I<end>]>
=head1 DESCRIPTION
=over 8
-=item I<filename>
+=item I<filename>
the name of the B<RRD> you want to fetch the data from.
-=item I<CF>
+=item I<CF>
the consolidation function that is applied to the data you
want to fetch (AVERAGE,MIN,MAX,LAST)
=head2 RESOLUTION INTERVAL
-In order to get RRDtool to fetch anything other than the finest resolution RRA
-B<both> the start and end time must be specified on boundaries that are
+In order to get RRDtool to fetch anything other than the finest resolution RRA
+B<both> the start and end time must be specified on boundaries that are
multiples of the desired resolution. Consider the following example:
rrdtool create subdata.rrd -s 10 DS:ds0:GAUGE:300:0:U \
=back
-So, if time now is called "t", do
+So, if time now is called "t", do
end time == int(t/900)*900,
- start time == end time - 1hour,
+ start time == end time - 1hour,
resolution == 900.
Using the bash shell, this could look be:
=item I<--rraindex number>
The index number of the B<RRA> that is to be examined. If not specified, the
-index defaults to zero. B<RRA> index numbers can be determined through
+index defaults to zero. B<RRA> index numbers can be determined through
B<rrdtool info>.
=back
rrdtool graph - Create a graph based on data from one or several RRD
-=for html <div align="right"><a href="rrdgraph.pdf">PDF</a> version.</div>
+=for html <div align="right"><a href="rrdgraph.pdf">PDF</a> version.</div>
=head1 SYNOPSIS
-B<rrdtool> B<graph> I<filename>
-S<[B<-s>|B<--start> I<seconds>]>
+B<rrdtool> B<graph> I<filename>
+S<[B<-s>|B<--start> I<seconds>]>
S<[B<-e>|B<--end> I<seconds>]>
S<[B<-x>|B<--x-grid> I<x-axis grid and label>]>
S<[B<-y>|B<--y-grid> I<y-axis grid and label>]>
S<[B<-X>|B<--units-exponent>]> I<value>]>
S<[B<-v>|B<--vertical-label> I<text>]>
S<[B<-w>|B<--width> I<pixels>]>
-S<[B<-h>|B<--height> I<pixels>]>
-S<[B<-i>|B<--interlaced>]>
-S<[B<-f>|B<--imginfo> I<formatstring>]>
-S<[B<-a>|B<--imgformat> B<SVG>|B<PNG>]>
-S<[B<-z>|B<--lazy>]>
+S<[B<-h>|B<--height> I<pixels>]>
+S<[B<-i>|B<--interlaced>]>
+S<[B<-f>|B<--imginfo> I<formatstring>]>
+S<[B<-a>|B<--imgformat> B<SVG>|B<PNG>]>
+S<[B<-z>|B<--lazy>]>
S<[B<-o>|B<--logarithmic>]>
-S<[B<-u>|B<--upper-limit> I<value>]>
+S<[B<-u>|B<--upper-limit> I<value>]>
S<[B<-l>|B<--lower-limit> I<value>]>
S<[B<-g>|B<--no-legend>]>
S<[B<-r>|B<--rigid>]>
=over
-=item I<filename>
+=item I<filename>
The name of the graph to generate. Since B<RRDtool> outputs
SVGs and PNGs, it's recommended that the filename end in either
Place Y grid dynamically based on graph Y range. Algorithm ensures
that you always have grid, that there are enough but not too many
-grid lines and the grid is metric. That is grid lines are placed
+grid lines and the grid is metric. That is grid lines are placed
every 1, 2, 5 or 10 units. (contributed by Sasha Mikheev)
=item B<--alt-autoscale>
-Compute Y range based on function absolute minimum and
-maximum values. Default algorithm uses predefined set of ranges.
+Compute Y range based on function absolute minimum and
+maximum values. Default algorithm uses predefined set of ranges.
This is good in many cases but it fails miserably when you need
-to graph something like 260 + 0.001 * sin(x). Default algorithm
+to graph something like 260 + 0.001 * sin(x). Default algorithm
will use Y range from 250 to 300 and on the graph you will see
almost straight line. With --alt-autoscale Y range will be
from slightly less the 260 - 0.001 to slightly more then 260 + 0.001
=item B<--alt-autoscale-max>
Where --alt-autoscale will modify both the absolute maximum AND minimum
-values, this option will only affect the maximum value. The minimum
+values, this option will only affect the maximum value. The minimum
value, if not defined on the command line, will be 0. This option can
be useful when graphing router traffic when the WAN line uses compression,
and thus the throughput may be higher than the WAN line speed.
=item B<-a>|B<--imgformat> B<SVG>|B<PNG> (default: PNG)
-Allows you to produce PNG output from RRDtool.
+Allows you to produce PNG output from RRDtool.
=item B<-z>|B<--lazy> (default: false)
Create a new virtual data source by evaluating a mathematical expression,
specified in Reverse Polish Notation (RPN). If you have ever used a traditional
-HP calculator you already know RPN. The idea behind RPN notation is,
+HP calculator you already know RPN. The idea behind RPN notation is,
that you have a stack and push your data onto this stack. When ever
you execute an operation, it takes as many data values from the stack
as needed. The pushing of data is implicit, so when ever you specify a number
-or a variable, it gets pushed automatically.
+or a variable, it gets pushed automatically.
If this is all a big load of incomprehensible words for you, maybe an
example helps (a more complete explanation is given in [1]): The
The I<rpn-expression> in the B<CDEF> function takes both, constant values
as well as I<vname> variables. The following operators can be used on these
-values:
+values:
=over
=item +, -, *, /, %
-pops two values from the stack applies the selected operator and pushes
+pops two values from the stack applies the selected operator and pushes
the result back onto the stack. The % operator stands for the modulo
operation.
=item COUNT
-Pushes the number 1 if it is at the first value of the data set, the
-number 2 if it is at the second, and so on. This special value, allows
-you to make calculations based on the position of the value within
+Pushes the number 1 if it is at the first value of the data set, the
+number 2 if it is at the second, and so on. This special value, allows
+you to make calculations based on the position of the value within
the data set.
=item INF, NEGINF
=item B<LINE>{B<1>|B<2>|B<3>}B<:>I<vname>[B<#>I<rrggbb>[B<:>I<legend>]]
Plot for the requested data, using the color specified. Write a legend
-into the graph. The 3 possible keywords B<LINE1>, B<LINE2>, and B<LINE3>
-generate increasingly wide lines. If no color is defined,
-the drawing is done 'blind' this is useful in connection with the
-B<STACK> function when you want to ADD the values of two
+into the graph. The 3 possible keywords B<LINE1>, B<LINE2>, and B<LINE3>
+generate increasingly wide lines. If no color is defined,
+the drawing is done 'blind' this is useful in connection with the
+B<STACK> function when you want to ADD the values of two
data-sources without showing it in the graph.
=item B<AREA>:I<vname>[B<#>I<rrggbb>[B<:>I<legend>]]
-Does the same as B<LINE?>, but the area between 0 and
+Does the same as B<LINE?>, but the area between 0 and
the graph will be filled with the color specified.
=item B<STACK>:I<vname>[B<#>I<rrggbb>[B<:>I<legend>]]
previous graph, the B<STACK> will be either a B<LINE?> or an B<AREA>.
This obviously implies that the first B<STACK> must be preceded by an
B<AREA> or B<LINE?> -- you need something to stack something onto in
-the first place ;)
+the first place ;)
Note, that when you STACK onto *UNKNOWN* data, RRDtool will not draw
any graphics ... *UNKNOWN* is not zero ... if you want it to be zero
CDEF:aggoutput=odat1,UN,0,odat1,IF,odat2,UN,0,odat2,IF,+,8,* \
AREA:agginput#00cc00:Input Aggregate \
LINE1:agginput#0000FF:Output Aggregate
-
-Assuming that idat1 has a data value of I<*UNKNOWN*>, the CDEF expression
- idat1,UN,0,idat1,IF
+Assuming that idat1 has a data value of I<*UNKNOWN*>, the CDEF expression
+
+ idat1,UN,0,idat1,IF
leaves us with a stack with contents of 1,0,NaN and the IF function
will pop off the 3 values and replace them with 0. If idat1 had a
real value like 7942099, then the stack would have 0,0,7942099 and the
-real value would be the replacement.
+real value would be the replacement.
=head1 EXAMPLE 3
The start and end of the time series you would like to display, and which
B<RRA> the data should come from. Defaults are: 1 day ago until
-now, with the best possible resolution. B<Start> and B<end> can
+now, with the best possible resolution. B<Start> and B<end> can
be specified in several formats, see
L<AT-STYLE TIME SPECIFICATION|rrdfetch/> and L<rrdgraph_examples>.
By default, B<rrdtool graph> calculates the width of one pixel in
[B<-N>|B<--no-gridfit>]
-In order to avoid anti-aliasing effects gridlines are placed on
-integer pixel values. This is by default done by extending
-the scale so that gridlines happens to be spaced using an
+In order to avoid anti-aliasing effects gridlines are placed on
+integer pixel values. This is by default done by extending
+the scale so that gridlines happens to be spaced using an
integer number of pixels and also start on an integer pixel value.
This might extend the scale too much for some logarithmic scales
and for linear scales where B<--alt-autoscale> is needed.
I<vname> can then be used throughout the rest of the script. By
default, an B<RRA> which contains the correct consolidated data
at an appropriate resolution will be chosen. The resolution can
-be overridden with the L<--step|rrdgraph/item_Time> option.
+be overridden with the L<--step|rrdgraph/item_Time> option.
The resolution can again be overridden by specifying the B<step size>.
The time span of this data is the same as for the graph by default,
you can override this by specifying B<start and end>. Remember to
-=pod
+=pod
-=head1 NAME
+=head1 NAME
rrdgraph_graph - rrdtool graph command reference
on top of the previous element. There must be something to stack
upon.
-You can use an B<invisible> LINE or AREA to stacked upon.
+You can use an B<invisible> LINE or AREA to stacked upon.
An B<unknown> value makes the entire stack unknown from that moment on.
You don't know where to begin (the unknown value) and therefore do
-=head1 NAME
+=head1 NAME
rrdgraph_rpn - About RPN Math in rrdtool graph
=item Comparing values
-B<MIN, MAX>
+B<MIN, MAX>
Pops two elements from the stack and returns the smaller or larger,
respectively. Note that I<infinite> is larger than anything else.
delay t0
<--------------->
delay t1
- <--------------->
+ <--------------->
delay t2
<--------------->
B<COUNT>
-Pushes the number 1 if this is the first value of the data set, the
-number 2 if it is the second, and so on. This special value allows
-you to make calculations based on the position of the value within
+Pushes the number 1 if this is the first value of the data set, the
+number 2 if it is the second, and so on. This special value allows
+you to make calculations based on the position of the value within
the data set. This function cannot be used in B<VDEF> instructions.
Z<>
YEAR = 365 * DAY
fd,path = tempfile.mkstemp('.png')
- rrdtool.graph(path,
+ rrdtool.graph(path,
'--imgformat', 'PNG',
'--width', '540',
'--height', '100',
=over 8
-=item I<filename>
+=item I<filename>
the name of the B<RRD> you want to alter.
-=item I<rra-num>
+=item I<rra-num>
the B<RRA> you want to alter. You can find the number using B<rrdtool info>.
-=item B<GROW>
+=item B<GROW>
used if you want to add extra rows to an RRA. The extra rows will be inserted
as the rows that are oldest.
-=item B<SHRINK>
+=item B<SHRINK>
used if you want to remove rows from an RRA. The rows that will be removed
are the oldest rows.
-=item I<rows>
+=item I<rows>
the number of rows you want to add or remove.
=head1 NOTES
-The new .rrd file, with the modified RRAs, is written to the file
+The new .rrd file, with the modified RRAs, is written to the file
B<resize.rrd> in the current directory. B<The original .rrd file is not
modified>.
=over
-=item *
+=item *
Link with F<librrd_th> instead of F<librrd> (use C<-lrrd_th> when
linking)
-=item *
+=item *
Use the "C<_r>" functions instead of the normal API-functions
-=item *
+=item *
Do not use any at-style time specifications. Parsing of such time
specifications is terribly non-thread-safe.
-=item *
+=item *
Never use non *C<_r> functions unless it is explicitly documented that
the function is tread-safe.
-=item *
+=item *
Every thread SHOULD call C<rrd_get_context()> before its first call to
any C<librrd_th> function in order to set up thread specific data. This
time and that old data is automatically eliminated. By using the
consolidation feature, you can still keep data for a very long time,
while gradually reducing the resolution of the data along the time
-axis.
+axis.
Using different consolidation functions (B<CF>) allows you to store
exactly the type of information that actually interests you: the maximum
rrdtool help cd|mkdir|ls|quit
-When a command is completed, RRDtool will print the string 'C<OK>',
-followed by timing information of the form B<u:>I<usertime>
-B<s:>I<systemtime>. Both values are the running totals of seconds
-since RRDtool was started. If an error occurs, a line of the
+When a command is completed, RRDtool will print the string 'C<OK>',
+followed by timing information of the form B<u:>I<usertime>
+B<s:>I<systemtime>. Both values are the running totals of seconds
+since RRDtool was started. If an error occurs, a line of the
form 'C<ERROR:> I<Description of error>' will be printed. B<RRDtool>
will not abort, if possible, but follow the ERROR line with an OK line.
-If a B<workdir> is specified and the UID is 0, RRDtool will do a
+If a B<workdir> is specified and the UID is 0, RRDtool will do a
chroot to that workdir. If the UID is not 0, RRDtool only changes the
current directory to B<workdir>.
=head2 RRD Server
-If you want to create a RRD-Server, you must choose a TCP/IP Service
+If you want to create a RRD-Server, you must choose a TCP/IP Service
number and add them to I</etc/services> like this:
rrdsrv 13900/tcp # RRD server
With this configuration you can add RRDtool as meta-server to
I</etc/inetd.conf>. For example:
-
+
rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd
Don't forget to create the database directory /var/rrd and
=head1 SYNOPSIS
-B<rrdtool> B<tune> I<filename>
-S<[B<--heartbeat>|B<-h> I<ds-name>:I<heartbeat>]>
+B<rrdtool> B<tune> I<filename>
+S<[B<--heartbeat>|B<-h> I<ds-name>:I<heartbeat>]>
S<[B<--minimum>|B<-i> I<ds-name>:I<min>]>
S<[B<--maximum>|B<-a> I<ds-name>:I<max>]>
S<[B<--data-source-type>|B<-d> I<ds-name>:I<DST>]>
The tune option allows you to alter some of the basic configuration
values stored in the header area of a Round Robin Database (B<RRD>).
-One application of the B<tune> function is to relax the
+One application of the B<tune> function is to relax the
validation rules on an B<RRD>. This allows to fill a new B<RRD> with
data available in larger intervals than what you would normally want
to permit. Be very careful with tune operations for COMPUTE data sources.
Alter the number of confidence bound violations that constitute a failure for
purposes of the FAILURES B<RRA>. This must be an integer less than or equal to
the window length of the FAILURES B<RRA>. This restriction is not verified by
-the tune option, so one can reset failure-threshold and window-length
+the tune option, so one can reset failure-threshold and window-length
simultaneously. Setting this option will reset the count of violations to 0.
=item S<B<--window-length> I<window-length>>
of smoothing is not data source specific. This means that utilizing
reset for one data source will delay running the smoothing algorithm
for all data sources in the file. This is unlikely to have serious
-consequences, unless the data being collected for the non-reset data sources
-is unusually volatile during the reinitialization period of the reset
+consequences, unless the data being collected for the non-reset data sources
+is unusually volatile during the reinitialization period of the reset
data source.
-Use of this tuning option is advised when the behavior of the data source
+Use of this tuning option is advised when the behavior of the data source
time series changes in a drastic and permanent manner.
=back
C<rrdtool tune data.rrd -h in:100000 -h out:100000 -h through:100000>
-Set the minimum required heartbeat for data sources 'in', 'out'
+Set the minimum required heartbeat for data sources 'in', 'out'
and 'through' to 10'000 seconds which is a little over one day in data.rrd.
This would allow to feed old data from MRTG-2.0 right into
RRDtool without generating *UNKNOWN* entries.
contador, sin embargo, sigue contando en bytes! En el mundo
SNMP, la mayoría de los contadores tienen una
longitud de 32 bits. Esto significa que pueden contar desde 0 hasta
-4294967295. Usaremos estos valores en los ejemplos. El dispositivo, cuando
+4294967295. Usaremos estos valores en los ejemplos. El dispositivo, cuando
le preguntamos, retorna el valor actual del contador. Como sabemos el
tiempo transcurrido desde la última vez que le preguntamos, sabemos
cuantos bytes se han transferido C<***en promedio***> por
fecha 920804700, valor 12345
fecha 920805000, valor 12357
-
+
etcétera.
Como ves, pueden introducirse más de un valor en la base de datos
Debes obtener esto como salida:
speed
-
+
920804400: NaN
920804700: NaN
920805000: 4.0000000000e-02
Los cálculos son más complejos ahora. Para calcular la velocidad "aceptable":
- Verifica si la velocidad en kmh es mayor que 100 ( kmh,100 ) GT
+ Verifica si la velocidad en kmh es mayor que 100 ( kmh,100 ) GT
Si es así, retorna 0, si no, retorna la velocidad ((( kmh,100 ) GT ), 0, kmh) IF
Para calcular la parte de velocidad "excesiva":
1.3.6.1.2.1 . Ahora, nos interesa la rama ``interfaces'', que tiene el
número dos (o sea, 1.3.6.1.2.1.2, o 1.3.6.1.2.1.interfaces).
-Lo primero es hacernos con un programa SNMP. Busca algún
+Lo primero es hacernos con un programa SNMP. Busca algún
paquete pre-compilado para tu plataforma, si no, puedes
buscar el código fuente y compilarlo tu mismo. En Internet encontrarás
muchos programas, búscalos con un motor de búsqueda o como prefieras.
Si obtienes una lista de interfaces, ya casi hemos llegado. Aquí
tienes un ejemplo del resultado:
- [user@host /home/alex]$ snmpwalk cisco public 2.2.1.2
+ [user@host /home/alex]$ snmpwalk cisco public 2.2.1.2
interfaces.ifTable.ifEntry.ifDescr.1 = "BRI0: B-Channel 1"
interfaces.ifTable.ifEntry.ifDescr.2 = "BRI0: B-Channel 2"
interfaces.ifTable.ifEntry.ifDescr.3 = "BRI0" Hex: 42 52 49 30
Viendo que es la cuarta, pruebo con:
[user@host /home/alex]$ snmpget cisco public 2.2.1.10.4 2.2.1.16.4
-
+
interfaces.ifTable.ifEntry.ifInOctets.4 = 2290729126
interfaces.ifTable.ifEntry.ifOutOctets.4 = 1256486519
Entonces, tengo 2 OIDs que monitorizar, y son (en el formato largo, ahora):
1.3.6.1.2.1.2.2.1.10
-
+
y
-
+
1.3.6.1.2.1.2.2.1.16
, ambas con el número de interfaz de 4
mientras no sea el fin del universo
hacer
- tomar el resultado de
+ tomar el resultado de
snmpget router community 2.2.1.10.4
en la variable $in
tomar el resultado de
=item *
-Línea B:
+Línea B:
No hay nada que calcular, los valores son los mismos que se
introdujeron en la base de datos.
=item *
-Línea C:
+Línea C:
De nuevo, no conocemos el valor
inicial antes de la primera medición, así que se aplica el mismo
razonamiento que para la línea A. En este
el valor máximo del contador + 1. Para nuestro coche, tendríamos:
Delta = 7 - 999987 = -999980 (en vez de 1000007-999987=20)
-
+
Delta real= -999980 + 999999 + 1 = 20
Al momento de escribir este documento, RRDtool maneja contadores de
- 32 bits: (4294967295+1) = 4294967296
- 64 bits: (18446744073709551615+1)-correction1 = 18446744069414584320
-
+
Antes: 4294967200
Incremento: 100
Debería ser: 4294967300
Pero es: 4
Diferencia: -4294967196
Corrección #1: -4294967196 + 4294967296 = 100
-
+
Antes: 18446744073709551000
Incremento: 800
Debería ser: 18446744073709551800
Diferencia: -18446744073709550816
Corrección #1: -18446744073709550816 +4294967296 = -18446744069414583520
Corrección #2: -18446744069414583520 +18446744069414584320 = 800
-
+
Antes: 18446744073709551615 ( valor máximo )
- Incremento: 18446744069414584320 ( incremento absurdo,
- Debería ser: 36893488143124135935 mínimo para que
- Pero es: 18446744069414584319 funcione el ejemplo)
+ Incremento: 18446744069414584320 ( incremento absurdo,
+ Debería ser: 36893488143124135935 mínimo para que
+ Pero es: 18446744069414584319 funcione el ejemplo)
Diferencia: -4294967296
Corrección #1: -4294967296 + 4294967296 = 0 (positivo,
- por tanto no se hace
+ por tanto no se hace
la segunda corrección)
-
+
Antes: 18446744073709551615 ( valor máximo )
- Incremento: 18446744069414584319
+ Incremento: 18446744069414584319
Debería ser: 36893488143124135934
Pero es: 18446744069414584318
Diferencia: -4294967297
debe ser.
en RRD en realidad
- tiempo+000: 0 delta="U" tiempo+000: 0 delta="U"
+ tiempo+000: 0 delta="U" tiempo+000: 0 delta="U"
tiempo+300: 300 delta=300 tiempo+300: 300 delta=300
tiempo+600: 600 delta=300 tiempo+603: 603 delta=303
tiempo+900: 900 delta=300 tiempo+900: 900 delta=297
started as a tiny little script for graphing the use of a university's
connection to the Internet. MRTG was later (ab-)used as a tool for
graphing other data sources including temperature, speed, voltage,
-number of printouts and the like.
+number of printouts and the like.
Most likely you will start to use RRDtool to store and process data
collected via SNMP. The data will most likely be bytes (or bits)
units of our data, it just works with dimensionless numbers.
If we had measured our distances in meters, this would have been
-(12'357'000-12'345'000)/300 = 12'000/300 = 40.
+(12'357'000-12'345'000)/300 = 12'000/300 = 40.
As most people have a better feel for numbers in this range, we'll
correct that. We could recreate our database and store the correct
Should become: 18'446'744'073'709'551'800
But really is: 184
Delta: -18'446'744'073'709'550'816
- Correction1: -18'446'744'073'709'550'816
+ Correction1: -18'446'744'073'709'550'816
+ 4'294'967'296 = -18'446'744'069'414'583'520
- Correction2: -18'446'744'069'414'583'520
+ Correction2: -18'446'744'069'414'583'520
+ 18'446'744'069'414'584'320 = 800
Before: 18'446'744'073'709'551'615 ( maximum value )
View both images together (add them to your index.html file)
and compare. Both graphs should show the same, despite the
-input being different.
+input being different.
=head1 WRAPUP
=head1 SYNOPSIS
-B<rrdtool> {B<update> | B<updatev>} I<filename>
-S<[B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...]>
-S<B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]>
-S<I<at-timestamp>B<@>I<value>[B<:>I<value>...]>
+B<rrdtool> {B<update> | B<updatev>} I<filename>
+S<[B<--template>|B<-t> I<ds-name>[B<:>I<ds-name>]...]>
+S<B<N>|I<timestamp>B<:>I<value>[B<:>I<value>...]>
+S<I<at-timestamp>B<@>I<value>[B<:>I<value>...]>
S<[I<timestamp>B<:>I<value>[B<:>I<value>...] ...]>
=head1 DESCRIPTION
While it appears possible with the template switch to update data sources
asynchronously, B<RRDtool> implicitly assigns non-COMPUTE data sources missing
-from the template the I<*UNKNOWN*> value.
+from the template the I<*UNKNOWN*> value.
Do not specify a value for a COMPUTE B<DST> in the B<update>
function. If this is done accidentally (and this can only be done
=head1 SYNOPSIS
-B<rrdtool> B<xport>
-S<[B<-s>|B<--start> I<seconds>]>
+B<rrdtool> B<xport>
+S<[B<-s>|B<--start> I<seconds>]>
S<[B<-e>|B<--end> I<seconds>]>
S<[B<-m>|B<--maxrows> I<rows>]>
S<[B<--step> I<value>]>
The B<xport> function's main purpose is to write an XML formatted
representation of the data stored in one or several B<RRD>s. It
-can also extract numerical reports.
+can also extract numerical reports.
If no I<XPORT> statements are found, there will be no output.
The output is enclosed in an B<xport> element and contains two
blocks. The first block is enclosed by a B<meta> element and
-contains some meta data. The second block is enclosed by a
+contains some meta data. The second block is enclosed by a
B<data> element and contains the data rows.
Let's assume that the I<xport> command looks like this:
The resulting meta data section is (the values will depend on the
RRD characteristics):
-
+
<meta>
<start>1020611700</start>
<step>300</step>
<entry>in and out bits</entry>
</legend>
</meta>
-
+
The resulting data section is:
<data>