From e995bb9048b6be4bcbc38692043c96f971907961 Mon Sep 17 00:00:00 2001 From: Blair Zajac Date: Sat, 29 Jun 2002 04:59:39 +0000 Subject: [PATCH] Load orca-0.22 into trunk/orca. --- CHANGES | 60 + INSTALL | 2 +- NEWS | 20 + TODO | 3 + configure | 2 +- configure.in | 2 +- lib/orcallator.cfg.in | 14 + packages/rrdtool-0.99.31/CHANGES | 9 +- packages/rrdtool-0.99.31/CONTRIBUTORS | 1 + packages/rrdtool-0.99.31/MANIFEST | 6 +- packages/rrdtool-0.99.31/Makefile.dist | 4 +- packages/rrdtool-0.99.31/doc/GNUmakefile.in | 2 +- packages/rrdtool-0.99.31/doc/RRDp.3 | 2 +- packages/rrdtool-0.99.31/doc/RRDs.3 | 2 +- packages/rrdtool-0.99.31/doc/rrdintro.pod | 1391 ------------------ packages/rrdtool-0.99.31/doc/rrdresize.1 | 240 +++ packages/rrdtool-0.99.31/doc/rrdresize.html | 126 ++ packages/rrdtool-0.99.31/doc/rrdresize.pod | 50 + packages/rrdtool-0.99.31/doc/rrdresize.txt | 66 + packages/rrdtool-0.99.31/doc/rrdtool.1 | 4 +- packages/rrdtool-0.99.31/doc/rrdtool.html | 2 +- packages/rrdtool-0.99.31/doc/rrdtool.pod | 2 +- packages/rrdtool-0.99.31/doc/rrdtool.txt | 10 +- packages/rrdtool-0.99.31/doc/rrdtutorial.pod | 2 +- packages/rrdtool-0.99.31/perl-piped/RRDp.pm | 2 +- packages/rrdtool-0.99.31/perl-shared/RRDs.pm | 2 +- packages/rrdtool-0.99.31/src/Makefile.in | 2 +- packages/rrdtool-0.99.31/src/rrd_create.c | 2 +- packages/rrdtool-0.99.31/src/rrd_diff.c | 2 +- packages/rrdtool-0.99.31/src/rrd_dump.c | 2 +- packages/rrdtool-0.99.31/src/rrd_error.c | 2 +- packages/rrdtool-0.99.31/src/rrd_fetch.c | 2 +- packages/rrdtool-0.99.31/src/rrd_format.c | 2 +- packages/rrdtool-0.99.31/src/rrd_format.h | 2 +- packages/rrdtool-0.99.31/src/rrd_graph.c | 2 +- packages/rrdtool-0.99.31/src/rrd_last.c | 2 +- packages/rrdtool-0.99.31/src/rrd_open.c | 2 +- packages/rrdtool-0.99.31/src/rrd_resize.c | 187 +++ packages/rrdtool-0.99.31/src/rrd_tool.c | 7 +- packages/rrdtool-0.99.31/src/rrd_tool.h | 4 +- packages/rrdtool-0.99.31/src/rrd_tune.c | 2 +- packages/rrdtool-0.99.31/src/rrd_update.c | 4 +- src/orca.pl | 682 +++++---- 43 files changed, 1181 insertions(+), 1753 deletions(-) delete mode 100644 packages/rrdtool-0.99.31/doc/rrdintro.pod create mode 100644 packages/rrdtool-0.99.31/doc/rrdresize.1 create mode 100644 packages/rrdtool-0.99.31/doc/rrdresize.html create mode 100644 packages/rrdtool-0.99.31/doc/rrdresize.pod create mode 100644 packages/rrdtool-0.99.31/doc/rrdresize.txt create mode 100644 packages/rrdtool-0.99.31/src/rrd_resize.c diff --git a/CHANGES b/CHANGES index f8c751d..7f03b55 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,63 @@ +Wed May 26 17:54:26 PDT 1999 + + Release version 0.22. + +Wed May 26 12:10:42 PDT 1999 + + Move the portions of the code that generate the RRDs::graph + options that do not change between invocations to the + _update_graph_options method. This method gets called when the + Orca::GIFFile is constructed and any time add_rrds is called. + This speeds Orca up slightly. + + Include RRDtool 0.99.31 but continue to only require 0.99.29. + + Add a new quarterly plot that shows the last 100 days. This is + a nice transition between the monthly and yearly plots. + + Change the number of days shown in the yearly plot from 500 to + 428, which is one year and two months. Reducing the number + of days from 500 by at least one day will speed up the GIF + generation time because by default the plot portion of the GIFs + are 500 pixels wide. + + Add two new classes Orca::Config::Plot and + Orca::Config::FilesGroup that do not do anything yet but + will provide an object-oriented interface to config_plots and + config_files. Currently all the values in @$config_plots and + %$config_files are now bless objects instead of unblessed objects. + +Thu May 20 10:59:26 PDT 1999 + + Put a closing ) in a error message in RRDtool 0.99.29.1. + + Fix a bug in queue_data where it was sending data to + rrd_update that was already in the RRD file. + +Wed May 19 10:43:48 PDT 1999 + + Restructured the code so each Orca::SourceDataFile has only + one anonymous subroutine to read in all the valued from a single + line of the source data file. This sped Orca up slightly. + + Add a -r option to Orca to have it not create any HTML or + GIF files and only update the RRD files. + + Fix a bug where if the number of columns changed in from one + source file to the next source file in a files group, the + column index used to get a particular value is the old index + for the old file and not the new index for the new file. This + fix involved having the Orca::SourceDataFile object run the + anonymous subroutines to pick the correct data from a line + instead of Orca::RRDFile. + + Remove some unused methods: Orca::OpenFileHash::list, + Orca::OpenFileHash::select, Orca::OpenFileHash::sysread_readline + Add some more documentation to orcallator.cfg. + + Skip a line in an input source data file if the word timestamp + is found in it. This is a temporary fix. + Mon May 17 16:26:17 PDT 1999 Release version 0.21. diff --git a/INSTALL b/INSTALL index 33bf765..a458385 100644 --- a/INSTALL +++ b/INSTALL @@ -124,7 +124,7 @@ Outline: ----------------------------------------------------------------------- Digest::MD5 version 2.00 or greater 2.07 Math::IntervalSearch 1.00 or greater 1.02 - RRDs version 0.99.29 or greater 0.99.29 + RRDs version 0.99.29 or greater 0.99.31 Storable 0.603 or greater 0.603 All four of these modules are included with the Orca distribution diff --git a/NEWS b/NEWS index a9856c2..95d3973 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +New in version 0.22. + 1) Add a new command line option (-r) that tells Orca to only update + the RRD data files and not to generate any HTML or GIF files. + This is useful if you are loading in a large amount of data in several + invocations of Orca and do not want to create the HTML and GIF files + in each run since it is time consuming. + 2) Fix a bug where if the number of columns changed in from one source + file to the next source file in a files group, the column index used + to get a particular value is the index for the old file and not the + index for the new file. This required some internal restructuring + the speeds Orca up slightly. + 3) Add a new plot called quarterly that displays the last 100 days + of data. This is a nice transition between the monthly and yearly + plots. + 4) A temporary fix: Skip and do not complain about input source data + file lines containing the word timestamp in it. + 5) Removed some unused methods to make Orca smaller. + 6) Added some more documentation to orcallater.cfg. + 7) Make Orca slightly faster. + New in version 0.21. 1) Every file containing the words percollator, percol and perc has been renamed to contain the word orcallator. A new make target named diff --git a/TODO b/TODO index f05e118..5c1a2d4 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ +Other: + Mention the AIX tool nmon. + Orca: Come up with a better error scheme than using warn() for some errors and the email warn for others. diff --git a/configure b/configure index 0fbb50b..5500341 100644 --- a/configure +++ b/configure @@ -651,7 +651,7 @@ CONFIGURE_COMMAND_LINE=${1+"$@"} # The path packages gets added where necessary. DIGEST_MD5_DIR=Digest-MD5-2.07 MATH_INTERPOLATE_DIR=Math-Interpolate-1.02 -RRDTOOL_DIR=rrdtool-0.99.29.1 +RRDTOOL_DIR=rrdtool-0.99.31 STORABLE_DIR=Storable-0.6@3 diff --git a/configure.in b/configure.in index 06a7b44..7d21529 100644 --- a/configure.in +++ b/configure.in @@ -14,7 +14,7 @@ AC_SUBST(CONFIGURE_COMMAND_LINE) # The path packages gets added where necessary. DIGEST_MD5_DIR=Digest-MD5-2.07 MATH_INTERPOLATE_DIR=Math-Interpolate-1.02 -RRDTOOL_DIR=rrdtool-0.99.29.1 +RRDTOOL_DIR=rrdtool-0.99.31 STORABLE_DIR=Storable-0.6@3 AC_SUBST(DIGEST_MD5_DIR) AC_SUBST(MATH_INTERPOLATE_DIR) diff --git a/lib/orcallator.cfg.in b/lib/orcallator.cfg.in index b02d416..373e432 100644 --- a/lib/orcallator.cfg.in +++ b/lib/orcallator.cfg.in @@ -1,8 +1,22 @@ # Orca configuration file for orcallator files. +# base_dir is prepended to the paths data_dir, find_files, html_dir, +# and state_file only if the path does not match the regular +# expression ^\\?\.{0,2}/, which matches /, ./, ../, and \./. base_dir @RRD_DIR@/orcallator + +# data_dir specifies the location of the generated RRD data files. +data_dir . + +# state_file specifies the location of the state file that remembers +# the modification time of each source data file. state_file orca.state + +# html_dir specifies the top of the HTML tree created by Orca. html_dir @HTML_DIR@ + +# By default create .meta tag files for all GIFs so that the web +# browser will automatically reload them. expire_gifs 1 # Find files at the following times: diff --git a/packages/rrdtool-0.99.31/CHANGES b/packages/rrdtool-0.99.31/CHANGES index a395b53..5f0cf38 100644 --- a/packages/rrdtool-0.99.31/CHANGES +++ b/packages/rrdtool-0.99.31/CHANGES @@ -1,5 +1,10 @@ -0.99.29b -0) from blair .. fix for Makefile.in +0.99.31 +From: Tobi +0) hmpf ... forgot to add rrdresize.pod and friends to MANIFEST + +0.99.30 +From: Alex +0) We can now alter the number of rows in an RRA with rrd_resize 0.99.29 From: Blair diff --git a/packages/rrdtool-0.99.31/CONTRIBUTORS b/packages/rrdtool-0.99.31/CONTRIBUTORS index a862ffe..73ce831 100644 --- a/packages/rrdtool-0.99.31/CONTRIBUTORS +++ b/packages/rrdtool-0.99.31/CONTRIBUTORS @@ -25,6 +25,7 @@ Debugging and code contributions Jeremy Fischer (Makefile changes & RPM builds) Alan Lichty Steen Linden + Alex van den Bogaerdt (rrd_resize.c) Documentation diff --git a/packages/rrdtool-0.99.31/MANIFEST b/packages/rrdtool-0.99.31/MANIFEST index a70959c..e01d57d 100644 --- a/packages/rrdtool-0.99.31/MANIFEST +++ b/packages/rrdtool-0.99.31/MANIFEST @@ -52,11 +52,14 @@ doc/rrdgraph.1 doc/rrdgraph.html doc/rrdgraph.pod doc/rrdgraph.txt -doc/rrdintro.pod doc/rrdlast.1 doc/rrdlast.html doc/rrdlast.pod doc/rrdlast.txt +doc/rrdresize.1 +doc/rrdresize.html +doc/rrdresize.pod +doc/rrdresize.txt doc/rrdtool.1 doc/rrdtool.html doc/rrdtool.pod @@ -112,6 +115,7 @@ src/rrd_format.c src/rrd_format.h src/rrd_graph.c src/rrd_open.c +src/rrd_resize.c src/rrd_last.c src/rrd_tool.c src/rrd_tool.h diff --git a/packages/rrdtool-0.99.31/Makefile.dist b/packages/rrdtool-0.99.31/Makefile.dist index 25d501b..dd485e2 100644 --- a/packages/rrdtool-0.99.31/Makefile.dist +++ b/packages/rrdtool-0.99.31/Makefile.dist @@ -9,8 +9,8 @@ SHELL = /bin/sh ### Things you might NOT want to play with ... ### -VER = 0.99.29 -PVER = 0.99029 +VER = 0.99.31 +PVER = 0.99031 ARCHIVE = rrdtool-$(VER).tar.gz DIRNAME = rrdtool-$(VER) diff --git a/packages/rrdtool-0.99.31/doc/GNUmakefile.in b/packages/rrdtool-0.99.31/doc/GNUmakefile.in index aee70ef..c6c9176 100644 --- a/packages/rrdtool-0.99.31/doc/GNUmakefile.in +++ b/packages/rrdtool-0.99.31/doc/GNUmakefile.in @@ -17,7 +17,7 @@ SHELL = /bin/sh VER = `date +%Y%m%d.%H` POD = rrdtool.pod rrdlast.pod rrdcreate.pod rrdupdate.pod rrdgraph.pod RRDs.pm RRDp.pm \ - rrdfetch.pod rrddump.pod rrdtune.pod + rrdfetch.pod rrddump.pod rrdtune.pod rrdresize.pod MAN = $(POD:.pod=.1) $(POD:.pl=.1) $(POD:.pm=.3) TXT = $(MAN:.1=.txt) $(POD:.3=.txt) diff --git a/packages/rrdtool-0.99.31/doc/RRDp.3 b/packages/rrdtool-0.99.31/doc/RRDp.3 index 5bc3505..7862356 100644 --- a/packages/rrdtool-0.99.31/doc/RRDp.3 +++ b/packages/rrdtool-0.99.31/doc/RRDp.3 @@ -93,7 +93,7 @@ .nr % 0 .rr F .\} -.TH RRDp 3 "19990512.01" "12/May/99" "rrdtool" +.TH RRDp 3 "19990527.00" "25/May/99" "rrdtool" .UC .if n .hy 0 .if n .na diff --git a/packages/rrdtool-0.99.31/doc/RRDs.3 b/packages/rrdtool-0.99.31/doc/RRDs.3 index 88e3a48..6ac9821 100644 --- a/packages/rrdtool-0.99.31/doc/RRDs.3 +++ b/packages/rrdtool-0.99.31/doc/RRDs.3 @@ -93,7 +93,7 @@ .nr % 0 .rr F .\} -.TH RRDs 3 "19990512.01" "12/May/99" "rrdtool" +.TH RRDs 3 "19990527.00" "25/May/99" "rrdtool" .UC .if n .hy 0 .if n .na diff --git a/packages/rrdtool-0.99.31/doc/rrdintro.pod b/packages/rrdtool-0.99.31/doc/rrdintro.pod deleted file mode 100644 index b11e7b9..0000000 --- a/packages/rrdtool-0.99.31/doc/rrdintro.pod +++ /dev/null @@ -1,1391 +0,0 @@ - -From alex@slot.hollandcasino.nl Tue May 4 23:16:13 1999 -Date: Sun, 2 May 1999 15:03:21 +0200 (MET DST) -From: Alex van den Bogaerdt -To: Tobias Oetiker -Subject: Corrected document - -Hi Tobi, - -Here are the two files again. I implemented the changes you suggested -and made some minor changes myself. - -We both agree that a native English speaker should correct it before -it goes online and do so for the same reason. I know that some parts may -sound odd. I think it may be wise to have two or even more people look -at it, at least one beginner and one experienced RRDtool user. - -You offered to convert it into the POD format, I suggest you do this -and then ask some people to look it over. - -I'm still looking for a document I once read about color usage. It -described a set of colors that are safe to use in an HTML document. -You once suggested to look at /usr/X11/lib/X11/rgb.txt but this contains -over 500 different colors (so: after removing descriptive labels and -going trough sort -u) and I know for sure that the document I talk about -describes about 240 different colors. I think it will be a valuable -addition to both MRTG and RRDtool. - -Regards, -Alex - -#!/bin/sh -# This is RRDbeginnersGuide, a shell archive (produced by GNU sharutils 4.2) -# To extract the files from this archive, save it to some FILE, remove -# everything before the `!/bin/sh' line above, then type `sh FILE'. -# -# Made on 1999-05-02 14:44 MET DST by . -# Source directory was `/mnt/sdb1/RrdDummy/workdir'. -# -# Existing files will *not* be overwritten unless `-c' is specified. -# This format requires very little intelligence at unshar time. -# "if test", "echo", "mkdir", and "sed" may be needed. -# -# This shar contains: -# length mode name -# ------ ---------- ------------------------------------------ -# 47151 -rw-r--r-- RRDbeginner -# 12288 -rw-r--r-- binhex -# -echo=echo -if mkdir _sh06095; then - $echo 'x -' 'creating lock directory' -else - $echo 'failed to create lock directory' - exit 1 -fi -# ============= RRDbeginner ============== -if test -f 'RRDbeginner' && test "$first_param" != -c; then - $echo 'x -' SKIPPING 'RRDbeginner' '(file already exists)' -else - $echo 'x -' extracting 'RRDbeginner' '(text)' - sed 's/^X//' << 'SHAR_EOF' > 'RRDbeginner' && -XNot so technical explanation of RRDtool (c) by Alex van den Bogaerdt -X -XRRDtool (c) 1999 by Tobias Oetiker -X -XRRDtool is written by Tobias Oetiker with -Xcontributions from many people all around the world. This document is -Xwritten by Alex van den Bogaerdt to help you -Xunderstand what RRDtool is and what it can do for you. -X -XThe documentation provided with RRDtool can be too technical for some -Xpeople and here we help you to understand the basics in order to -Xprepare you to read the documentation yourself. It also explains the -Xgeneral things about statistics with a focus on networking. -X -XThis document may not be redistributed by any means without prior -Xwritten permission from the author. -XPermission to distribute copies of this document for non-commercial -Xpurposes is hereby granted provided that the document is kept intact -Xincluding this copyright message and disclamer, and provided that -Xit comes together with the documentation for RRDtool. -X -XVersion: may 1999. -X -XPlease make sure you have a reasonable recent copy. If you do and you -Xfeel this document contains errors or is incomplete, please mail me -Xwith a description of the error/missing part, and why you think so. -XThis will help me to improve it. Your help is appreciated. -XPlease note that I will ignore request like -X"my copy is from may 1999, could you mail me a more recent one ?" -XIf there is a newer version, it will come with the RRDtool release. -X -XChange history: -X199903xx: Alex van den Bogaerdt -X Initial draft -X19990502: Alex van den Bogaerdt -X Made some textual improvements as suggested by Tobias Oetiker -X199905xx: Tobias Oetiker -X Converted document to POD format -X -X ============================== do not cut here =============================== -X -X0 IMPORTANT -X -XWe first have to do some uninteresting reading folks, don't skip this -Xpart! Later on, in the examples, you need to know the basics. -X -X1 What is RRDtool ? -X -XRRDtool means Round Robin Database tool. -XRound robin is a technique that works with a fixed amount of data, and a -Xpointer to the current element. Think of a circle with some dots plotted -Xon the edge, these dots are the places where data can be stored. Draw an -Xarrow from the center of the circle to one of the dots, this is the pointer. -XWhen the current data is read or written, the pointer moves to the next -Xelement. As we are on a circle there is no beginning nor an end, you can -Xgo on and on. After a while, all the available places will be used and -Xthe process automatically reuses old locations. -XRRDtool works with with Round Robin Databases (RRDs). It stores and retrieves -Xdata from them. -X -X2 What data can be put into an RDD ? -X -XYou name it, it will probably fit. You should be able to measure some value -Xat several points in time and provide this to RRDtool. If you can do this, -XRRDtool will probably be able to store it. -X -XMany examples talk about SNMP which is an acronym for -XSimple Network Management Protocol. The "simple" is about the protocol, -Xit does not mean it is simple to manage a network. After working your -Xway through this document, you will know enough to be able to understand -Xwhat people are talking about. For now, just assume SNMP is a way to -Xtalk to devices and ask those devices about counters they keep. -XIt is the value from those counters that are kept in the RRD. -X -X3 What can I do with this tool ? -X -XRRDtool originated from MRTG (multi router traffic grapher) which itself -Xcame from a tiny little script to monitor the performance of a connection -Xto the Internet. Since then, MRTG has also been used for several other -Xpurposes including temperature, speed, voltage, number of printouts and -Xmany other things. Most likely you will start to use the RRDtool to store -Xand process data collected via SNMP. The data will most likely be bytes -X(or bits) transfered from and to a network or a computer. -XRRDtool lets you create a database, store data in it, retrieve that data -Xand create graphs in GIF format for display on a web browser. Those GIF -Ximages are dependant on the data you collected and could be, for instance, -Xan overview of the average network usage, or rather the peaks that occurred. -XIt can also be used to display tidal waves, solar radiation, power -Xconsumption, number of visitors at an exibition, noise levels near an -Xairport, temperature on your favorite holiday location, temperature in the -Xfridge and whatever you imagination can come up with. You need a sensor to -Xmeasure the data and be able to feed the numbers to RRDtool. Many devices -Xhave such a sensor. -X -X4 What if I still have problems after reading this document ? -X -XMore exact, after re-reading this document :) -XIt all depends on the kind of problems you have. If you are unable to -Xcompile the sources and you have a fairly common OS, it will probably -Xnot be the fault of RRDtool. There may be precompiled versions around -Xon the Internet. If they come from trusted sources, get one of those. -XIf on the other hand the program works but does not give you the -Xexpected results, it will be a problem with configuring it. Review -Xyour configuration and compare it with the examples that follow. -X -XThere is a mailing list and an archive of it. Read the list for a few -Xweeks and search the archive. It is considered rude to just ask -Xa question without reading the list, your problem may already have been -Xsolved for somebody else and you will be helped without writing a new -Xa message at all ... This is true for most, if not all, mailing lists -Xand not only for this particular list! Look in the documentation that -Xcame with RRDtool for the location and usage of the list. -X -XI suggest you take a moment to subscribe to the mailing list right now -Xby sending an email to with a -Xsubject of "subscribe". If you ever want to leave this list, you write -Xan email to the same address but now with a subject of "unsubscribe". -X -X5 How will you help me ? -X -XBy giving you some detailed descriptions with detailed examples. -XIt is assumed that following the instructions in the order presented -Xwill build up enough knowledge of the program to experiment for yourself. -XIf it doesn't work the first time, don't give up. Reread the stuff that -Xyou did understand, you may have missed something. -XBy following the examples you get some hands-on experience and, even -Xmore important, some background information of how it works. -X -XYou will need to know something about hexadecimal numbers. If you don't -Xthen start with reading "binhex" before you continue here. -X -XIn my opinion the best way to learn something is to actually do it. -XWhy not start right now. We will create a database, put some values in -Xit and extract this data again. It is expected that you get the same -Xresults when you try these examples yourself so do that. -XWe will start with some easy stuff and compare a car with a router, -Xor compare kilometers (miles if you wish) with bits and bytes. It's -Xall the same: Some number over some time. -X -XAssume we have a device that transfers bytes to and from the Internet. -XThis device keeps a counter that starts at zero when it is turned on, -Xincreasing with every byte that is transfered. This counter will have -Xa maximum value, if that value is reached and an extra byte is counted, -Xthe counter starts all over at zero. This is the same as many counters -Xin the world such as the mileage counter in a car. -XMost discussions about networking talk about bits per second so lets -Xget used to that right away. Assume a byte is eight bits and start to -Xthink in bits not bytes. The counter however still counts bytes ! -XIn the SNMP world most of the counters are 32 bits. That means they are -Xcounting from 0 to 4294967295. We will use these values in the examples. -XThe device, when asked, returns the current value of the counter. We -Xknow the time that has passes since we last asked so we now know how -Xmany bytes have been transfered ***on average*** per second. This is -Xnot very hard to calculate. First in words, then in calculi: -X 1) Take the current counter, subtract the previous value from it. -X 2) Do the same with the current time and the previous time. -X 3) Divide the outcome of (1) by the outcome of (2), the result is -X the amount of bytes per second. Multiply by eight to get the -X number of bits per second (bps). -X bps = (counter_now - counter_before) / (time_now - time_before) * 8 -X -XFor some people it may help to translate this to a automobile example: -XDo not try this example, and if you do, don't blame me for the results. -X -XPeople who are not used to think in kilometers per hour can translate -Xmost into miles per hour by dividing km by 1.6 (close enough). -XI will use the following abbreviations: -XM: meter -XKM: kilometer (= 1000 meters). -XH: hour -XS: second -XKM/H: kilometers per hour -XM/S: meters per second -X -XYou're driving a car. At 12:05 you read the counter in the dashboard -Xand it tells you that the car has moved 12345 KM until that moment. -XAt 12:10 you look again, it reads 12357 KM. This means you have -Xtraveled 12 KM in five minutes. A scientist would translate that -Xinto meters per second and this makes a nice comparison towards the -Xproblem of (bytes per five minutes) versus (bits per second). -X -XWe traveled 12 kilometers which is 12000 meters. We did that in five -Xminutes which translates into 300 seconds. Our speed is 12000M / 300S -Xequals 40 M/S. -X -XWe could also calculate the speed in KM/H: twelve times five minutes -Xis an hour so we have to multiply 12 KM by 12 to get 144 KM/H. -XFor our native English speaking friends: this is ninety MPH and -Xtherefore not recommended to try for yourself where I live :) -X -XRemember: these numbers are averages and there is no way to figure out -Xfrom the numbers we got that you drove at a constant speed. -X -XI hope you understand that there is no difference in calculating M/S or -Xbps, only the way we collect the data is different. Even the K from kilo -Xis the same as in networking terms k also means 1000. -X -XWe will now create a database where we can keep all these interesting -Xnumbers. The method used to start the program may differ slightly from -XOS to OS but I assume you can figure it out if it works different on -Xyour OS. Make sure you do not overwrite any file on your system when -Xexecuting the following command (so: first look if it's safe!) and type -Xthe whole line as one long line (I had to split it for readability) -Xand skip all of the '\' characters. -X -X rrdtool create test.rrd \ -X --start 920804400 \ -X DS:speed:COUNTER:600:U:U \ -X RRA:AVERAGE:0.5:1:24 \ -X RRA:AVERAGE:0.5:6:10 -X -X (So enter: rrdtool create test.rrd --start 920804400 DS ...) -X -XWhat has been created ? -XWe created the round robin database called test (test.rrd) -Xwhich starts at noon the day I started (7th of march, 1999) writing -Xthis document. It holds one data source (DS) named "speed" that gets -Xbuilt from a counter. This counter is read every five minutes (default) -XIn the same database two round robin archives (RRAs) are kept, one -Xaverages the data every time it is read (so: there's nothing to average) -Xand keeps 24 samples (24 times 5 minutes is 2 hours). The other averages -X6 values (half hour) and contains 10 of such averages (so: 5 hours) -XThe remaining options will be discussed later on. -XChances are that you are not in the same part of the world as I am. -XThis means your time zone is different. In all examples where I talk -Xabout time, the hours may be wrong for you. This has little effect on -Xthe results of the examples, just correct the hours while reading. -X -XWe now have to fill our database with some numbers. We'll pretend to -Xhave read the following numbers: -X -X12:05 12345 KM -X12:10 12357 KM -X12:15 12363 KM -X12:20 12363 KM -X12:25 12363 KM -X12:30 12373 KM -X12:35 12383 KM -X12:40 12393 KM -X12:45 12399 KM -X12:50 12405 KM -X12:55 12411 KM -X13:00 12415 KM -X13:05 12420 KM -X13:10 12422 KM -X13:15 12423 KM -X -XWe fill the database as follows: -X -X rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363 -X rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373 -X rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399 -X rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415 -X rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423 -X -XThis reads: update our test database with the following numbers -X time 920804700, value 12345 -X time 920805000, value 12357 -X etcetera. -X -XAs you can see, it is possible to feed more than one value into the -Xdatabase in one command. I had to stop at three for readability but -Xthe real maximum will be OS dependent. -X -XThe time value may look strange to you, it is written in seconds since -Xthe first of January, 1970, midnight. Don't worry about this yet, just -Xnotice that there is a difference of 300 in between all values. -X -XIt is time to do some graphics now: -X -X rrdtool graph speed.gif \ -X --start 920804400 --end 920808000 \ -X DEF:myspeed=test.rrd:speed:AVERAGE \ -X LINE2:myspeed#FF0000 -X -XThis will create speed.gif which starts at 12:00 and ends at 13:00. -XThere is a definition of variable myspeed, it is the data from RRA -X"speed" out of database "test.rrd". The line drawn is 2 pixels high, -Xand comes from variable myspeed. The color is red. -XYou'll notice that the start of the graph is not at 12:00 but at 12:05 -Xand this is because we have insufficient data to tell the average before -Xthat time. This will only happen when you miss some samples, this will -Xnot happen a lot, hopefully. -X -XIf this has worked: Congratulations. If not, check what went wrong. -X -X -XThe colors are built up from red, green and blue. For each of the -Xcomponents, you specify how much to use in hexadecimal where 00 means -Xnot included and FF means fully included. -XThe color white is a mixture of red, green and blue: FFFFFF -XThe color black is all colors off: 000000 -X(Please, no discussions if black and white can be called colors) -X -X red #FF0000 -X green #00FF00 -X blue #0000FF -X purple #FF00FF (mixed red with blue) -X gray #555555 (one third of all components) -X -X -X -XThe GIF you just created can be displayed using a web browser or other -Xsoftware you like. I can not provide you with an example of that, there -Xare too many different setups, possibilities etc. -X -XWhen looking at the image, you notice that the horizontal axis displays -X12:10, 12:20, 12:30, 12:40 and 12:50. The two remaining times (12:00 and -X13:00) would not be displayed nicely so they are skipped. -XThe vertical axis displays the range we entered. We provided kilometers -Xand when divided by 300 seconds, we get very small numbers. To be exact, -Xthe first value was 12 (12357-12345) and divided by 300 this makes 0.04 -XRRDtool displays this as 40 m which means 40 mili (so: NOT meters). -XWhat we did wrong was that we should have measured in meters, this would -Xhave been (12357000-12345000)/300 = 12000/300 = 40. -X -XLet's correct that. We could recreate our database and store the correct -Xdata but there is another way: do some calculations while creating the -Xgif file ! -X -X rrdtool graph speed2.gif \ -X --start 920804400 --end 920808000 \ -X --vertical-label m/s \ -X DEF:myspeed=test.rrd:speed:AVERAGE \ -X CDEF:realspeed=myspeed,1000,* \ -X LINE2:realspeed#FF0000 -X -XAfter viewing this GIF, you notice the "m" has disappeared. This it what -Xthe correct result would be. Also, a label has been added to the image. -XApart from the things mentioned above, the GIF should be the same. -X -XThe calculations are done with the CDEF part. What it says is: take the -Xdata source myspeed and the number 1000, multiply those. The calculations -Xare done using Reverse Polish Notation. It is an easy way of performing -Xcalculations after you understand it. You will, eventually but for now -Xassume it is correct what I write and just keep to the examples in this -Xfile. Read the documentation that came with RRDtool (look in rrdgraph.doc) -Xwhen you're ready for it. -X -XHang on! If we can multiply values with 1000, it should also be possible -Xto display kilometers per hour from the same data ! -XWhat do we need to do ? If we have meters per second, we can make this -Xmeters per hour by multiplying the value with 3600 (there go 3600 seconds -Xin one hour). To get kilometers per hour, we need to divide by 1000. -XWe end up with: value * 3600 / 1000 = value * 3.6 . Remember we also have -Xto correct our mistake, so it is value * 3600 for us. -X -XNow lets create this GIF, and add some more magic ... -X -X rrdtool graph speed3.gif \ -X --start 920804400 --end 920808000 \ -X --vertical-label km/h \ -X DEF:myspeed=test.rrd:speed:AVERAGE \ -X CDEF:kmh=myspeed,3600,* \ -X CDEF:fast=0,kmh,kmh,100,GT,IF \ -X CDEF:good=kmh,0,kmh,100,GT,IF \ -X HRULE:100#0000FF:"Maximum allowed" \ -X AREA:good#00FF00:"Good speed" \ -X AREA:fast#FF0000:"Too fast" -X -XThis looks much better. Speed in KM/H and even an extra line with the -Xmaximum allowed speed (on the road I travel at). I also changed the -Xcolors used to display speed and changed it from a line into an area. -X -XThe calculations are more complex now. For the "good" speed they are: -X- Check if kmh is greater than 100 ( kmh,100 ) GT -X- If so, return 0, else kmh ( kmh,0, (( kmh,100 ) GT ) IF -XFor the other speed: -X- Check if kmh is greater than 100 ( kmh,100 ) GT -X- If so, return kmh, else return 0 ( 0,kmh, (( kmh,100) GT ) IF -X -X -XI like to believe there are virtually no limits about what RRDtool -Xcan do. I will not explain how it works, but look at the following -XGIF: -X -X rrdtool graph speed4.gif \ -X --start 920804400 --end 920808000 \ -X --vertical-label km/h \ -X DEF:myspeed=test.rrd:speed:AVERAGE \ -X CDEF:kmh=myspeed,3600,* \ -X CDEF:fast=0,100,kmh,100,GT,IF \ -X CDEF:over=0,kmh,100,-,kmh,100,GT,IF \ -X CDEF:good=kmh,0,kmh,100,GT,IF \ -X HRULE:100#0000FF:"Maximum allowed" \ -X AREA:good#00FF00:"Good speed" \ -X AREA:fast#550000:"Too fast" \ -X STACK:over#FF0000:"Over speed" -X -XLet's create a quick and dirty HTML page to view three GIFs: -X -X Speed -X Speed in meters per second -X
-X Speed in kilometers per hour -X
-X Traveled too fast? -X -X -XName the file "speed.html" or similar, and view it. -X -XNow, all you have to do is measure the values regularly and update the -Xdatabase. Every time you create these three GIFs and reload the page -Xand the GIFs (better reread this last three words!) you know how fast -Xyou traveled. -X -XYou already looked at the "update" tool. It took one or more parameters -Xin the form of "