The documentation provided with RRDtool can be too technical for some people and here we help you to understand the basics in order to prepare you to read the documentation yourself. It also explains the general things about statistics with a focus on networking.
Many examples talk about SNMP which is an acronym for Simple Network Management Protocol. The ``simple'' is about the protocol, it does not mean it is simple to manage a network. After working your way through this document, you will know enough to be able to understand what people are talking about. For now, just assume SNMP is a way to talk to devices and ask those devices about counters they keep. It is the value from those counters that are kept in the RRD.
There is a mailing list and an archive of it. Read the list for a few weeks and search the archive. It is considered rude to just ask a question without reading the list, your problem may already have been solved for somebody else and you will be helped without writing a new a message at all ... This is true for most, if not all, mailing lists and not only for this particular list! Look in the documentation that came with RRDtool for the location and usage of the list.
I suggest you take a moment to subscribe to the mailing list right now by sending an email to <rrd-users-request@list.ee.ethz.ch > with a subject of ``subscribe''. If you ever want to leave this list, you write an email to the same address but now with a subject of ``unsubscribe''.
You will need to know something about hexadecimal numbers. If you don't then start with reading ``bin_dec_hex'' before you continue here.
Assume we have a device that transfers bytes to and from the Internet. This
device keeps a counter that starts at zero when it is turned on, increasing
with every byte that is transfered. This counter will have a maximum value,
if that value is reached and an extra byte is counted, the counter starts
all over at zero. This is the same as many counters in the world such as
the mileage counter in a car. Most discussions about networking talk about
bits per second so lets get used to that right away. Assume a byte is eight
bits and start to think in bits not bytes. The counter however still counts
bytes ! In the SNMP world most of the counters are 32 bits. That means they
are counting from 0 to 4294967295. We will use these values in the
examples. The device, when asked, returns the current value of the counter.
We know the time that has passes since we last asked so we now know how
many bytes have been transfered ***on
average*** per second.
This is not very hard to calculate. First in words, then in calculi:
bps = (counter_now - counter_before) / (time_now - time_before) * 8
People who are not used to think in kilometers per hour can translate most into miles per hour by dividing km by 1.6 (close enough). I will use the following abbreviations:
M: meter KM: kilometer (= 1000 meters). H: hour S: second KM/H: kilometers per hour M/S: meters per second
You're driving a car. At 12:05 you read the counter in the dashboard and it tells you that the car has moved 12345 KM until that moment. At 12:10 you look again, it reads 12357 KM. This means you have traveled 12 KM in five minutes. A scientist would translate that into meters per second and this makes a nice comparison towards the problem of (bytes per five minutes) versus (bits per second).
We traveled 12 kilometers which is 12000 meters. We did that in five minutes which translates into 300 seconds. Our speed is 12000M / 300S equals 40 M/S.
We could also calculate the speed in KM/H: twelve times five minutes is an hour so we have to multiply 12 KM by 12 to get 144 KM/H. For our native English speaking friends: this is ninety MPH and therefore not recommended to try for yourself where I live :)
Remember: these numbers are averages and there is no way to figure out from the numbers we got that you drove at a constant speed.
I hope you understand that there is no difference in calculating M/S or bps, only the way we collect the data is different. Even the K from kilo is the same as in networking terms k also means 1000.
We will now create a database where we can keep all these interesting numbers. The method used to start the program may differ slightly from OS to OS but I assume you can figure it out if it works different on your OS. Make sure you do not overwrite any file on your system when executing the following command (so: first look if it's safe!) and type the whole line as one long line (I had to split it for readability) and skip all of the '\' characters.
rrdtool create test.rrd \ --start 920804400 \ DS:speed:COUNTER:600:U:U \ RRA:AVERAGE:0.5:1:24 \ RRA:AVERAGE:0.5:6:10
(So enter: rrdtool create test.rrd --start 920804400 DS ...
)
We now have to fill our database with some numbers. We'll pretend to have read the following numbers:
12:05 12345 KM 12:10 12357 KM 12:15 12363 KM 12:20 12363 KM 12:25 12363 KM 12:30 12373 KM 12:35 12383 KM 12:40 12393 KM 12:45 12399 KM 12:50 12405 KM 12:55 12411 KM 13:00 12415 KM 13:05 12420 KM 13:10 12422 KM 13:15 12423 KM
We fill the database as follows:
rrdtool update test.rrd 920804700:12345 920805000:12357 920805300:12363 rrdtool update test.rrd 920805600:12363 920805900:12363 920806200:12373 rrdtool update test.rrd 920806500:12383 920806800:12393 920807100:12399 rrdtool update test.rrd 920807400:12405 920807700:12411 920808000:12415 rrdtool update test.rrd 920808300:12420 920808600:12422 920808900:12423
This reads: update our test database with the following numbers
time 920804700, value 12345 time 920805000, value 12357
etcetera.
As you can see, it is possible to feed more than one value into the database in one command. I had to stop at three for readability but the real maximum will be OS dependent.
The time value may look strange to you, it is written in seconds since the first of January, 1970, midnight. Don't worry about this yet, just notice that there is a difference of 300 in between all values.
rrdtool graph speed.gif \ --start 920804400 --end 920808000 \ DEF:myspeed=test.rrd:speed:AVERAGE \ LINE2:myspeed#FF0000
This will create speed.gif which starts at 12:00 and ends at 13:00. There is a definition of variable myspeed, it is the data from RRA ``speed'' out of database ``test.rrd''. The line drawn is 2 pixels high, and comes from variable myspeed. The color is red. You'll notice that the start of the graph is not at 12:00 but at 12:05 and this is because we have insufficient data to tell the average before that time. This will only happen when you miss some samples, this will not happen a lot, hopefully.
If this has worked: Congratulations. If not, check what went wrong.
The colors are built up from red, green and blue. For each of the components, you specify how much to use in hexadecimal where 00 means not included and FF means fully included. The color white is a mixture of red, green and blue: FFFFFF The color black is all colors off: 000000 (Please, no discussions if black and white can be called colors)
red #FF0000 green #00FF00 blue #0000FF purple #FF00FF (mixed red with blue) gray #555555 (one third of all components)
The GIF you just created can be displayed using a web browser or other software you like. I can not provide you with an example of that, because there are too many different setups, possibilities etc.
Let's correct that. We could recreate our database and store the correct data but there is another way: do some calculations while creating the gif file !
rrdtool graph speed2.gif \ --start 920804400 --end 920808000 \ --vertical-label m/s \ DEF:myspeed=test.rrd:speed:AVERAGE \ "CDEF:realspeed=myspeed,1000,*" \ LINE2:realspeed#FF0000
After viewing this GIF, you notice the ``m'' has disappeared. This it what the correct result would be. Also, a label has been added to the image. Apart from the things mentioned above, the GIF should be the same.
The calculations are done with the CDEF part. What it says is: take the data source myspeed and the number 1000, multiply those. The calculations are done using Reverse Polish Notation. It is an easy way of performing calculations after you understand it. You will, eventually but for now assume it is correct what I write and just keep to the examples in this file. Read the documentation that came with RRDtool (look in rrdgraph.doc) when you're ready for it.
Hang on! If we can multiply values with 1000, it should also be possible to display kilometers per hour from the same data ! What do we need to do ? If we have meters per second, we can make this meters per hour by multiplying the value with 3600 (there go 3600 seconds in one hour). To get kilometers per hour, we need to divide by 1000. We end up with: value * 3600 / 1000 = value * 3.6 . Remember we also have to correct our mistake, so it is value * 3600 for us.
Now let's create this GIF, and add some more magic ...
rrdtool graph speed3.gif \ --start 920804400 --end 920808000 \ --vertical-label km/h \ DEF:myspeed=test.rrd:speed:AVERAGE \ "CDEF:kmh=myspeed,3600,*" \ CDEF:fast=kmh,100,GT,kmh,0,IF \ CDEF:good=kmh,100,GT,0,kmh,IF \ HRULE:100#0000FF:"Maximum allowed" \ AREA:good#00FF00:"Good speed" \ AREA:fast#FF0000:"Too fast"
This looks much better. Speed in KM/H and even an extra line with the maximum allowed speed (on the road I travel at). I also changed the colors used to display speed and changed it from a line into an area.
The calculations are more complex now. For the ``good'' speed they are:
rrdtool graph speed4.gif \ --start 920804400 --end 920808000 \ --vertical-label km/h \ DEF:myspeed=test.rrd:speed:AVERAGE \ "CDEF:kmh=myspeed,3600,*" \ CDEF:fast=kmh,100,GT,100,0,IF \ CDEF:over=kmh,100,GT,kmh,100,-,0,IF \ CDEF:good=kmh,100,GT,0,kmh,IF \ HRULE:100#0000FF:"Maximum allowed" \ AREA:good#00FF00:"Good speed" \ AREA:fast#550000:"Too fast" \ STACK:over#FF0000:"Over speed"
Let's create a quick and dirty HTML page to view three GIFs:
<HTML><HEAD><TITLE>Speed</TITLE></HEAD><BODY> <IMG src="speed2.gif" alt="Speed in meters per second"> <BR> <IMG src="speed3.gif" alt="Speed in kilometers per hour"> <BR> <IMG src="speed4.gif" alt="Traveled too fast?"> </BODY></HTML>
Name the file ``speed.html'' or similar, and view it.
Now, all you have to do is measure the values regularly and update the database. Every time you create these three GIFs and reload the page and the GIFs (better reread these last three words!) you know how fast you traveled.
perl -e 'print time, "\n" '
How you can run a program on regular intervals is OS specific, so I just give you an example script in a sort of pseudo code: (Do not try this with our test database, it is used in further examples)
Get the value, put it in variable "$speed" rrdtool update speed.rrd N:$speed
This is all. Run this script every five minutes. When you need to know what the graphics look like, run the examples above. You could put them in a script. After running that script, view index.html
One tool used in the example has been talked about very briefly in the beginning of this document, it is called SNMP. It is a way of talking to equipment. The tool I use below is called ``snmpget'' and this is how it works:
snmpget device password OID
For device you substitute the name of your device, for password you use the ``community'' as it is called. For most devices ``public'' will do but this can be disabled, altered or protected for privacy and security reasons. You will need to find this out as there is no way I can tell what you ( ...your device... ) are keeping a secret from me.
Then there is this third parameter, called OID. When you start to learn about SNMP it looks very confusing. It isn't all that difficult when you look at the Management Information Base or in short: the MIB. It is an upside-down tree, with a single node as the root and from there a number of branches. These branches end up in another node, they branch out, etc. All the branches have a name and they form the path that we follow all the way down. The branches that we follow are named: iso, org, dod, internet, mgmt and mib-2. These names can also be written down as numbers and are 1 3 6 1 2 1.
iso.org.dod.internet.mgmt.mib-2 (1.3.6.1.2.1)
From there, we are especially interested in the branch ``interfaces'' which has number 2 (so: 1.3.6.1.2.1.2 or 1.3.6.1.2.1.interfaces).
The SNMP programs that I know can take above path as a default, so I could walk to interfaces without writing it in full. To do that, the path has to be written as interfaces, without a leading dot. I could also use the long form, then I need to start with a dot.
I can intermix numbers and names as I like. 1.3.6.1.2.1 is the same as iso.org.dod.1.2.1 and 1.3.6.internet.2.mib-2 For interfaces I could write ``interfaces'', 2, or a long version by prefixing it with ``.1.3.6.1.2.1.''. Just try what works for you and do read the manual for the version of snmpget you are using.
First, we have to get some SNMP program. First look if there is a pre-compiled package available for your OS. This is the preferred way. If not, you will have to get yourself the sources and compile those. The Internet is full of sources, programs etc. Find information using a search engine or whatever you prefer. You are on your own here, sorry.
Assume you got the program. First try to collect some data that is available on most systems. Remember: there is a short name for the part of the tree that interests us most in the world we live in ! I will use the short version as I think this document is large enough as it is. If that doesn't work for you, prefix with .1.3.6.1.2.1 and try again. Also, Read The Fine Manual. Skip the parts you cannot understand yet, you should be able to find out how to start the program and use it.
snmpget myrouter public system.sysdescr.0
The device should answer with a description of itself, perhaps empty. Until you got a valid answer from a device, perhaps using a different ``password'', or a different device, there is no point in continuing.
snmpget myrouter public interfaces.ifnumber.0
Hopefully you get a number as a result, the number of interfaces. If so, you can carry on and try a different program called ``snmpwalk''.
snmpwalk myrouter public interfaces.iftable.ifentry.ifdescr
If it returns with a list of interfaces, you're almost there. Here's an example: [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 interfaces.ifTable.ifEntry.ifDescr.4 = "Ethernet0" interfaces.ifTable.ifEntry.ifDescr.5 = "Loopback0"
On this cisco equipment, I would like to monitor the ``Ethernet0'' interface and see that it is number four. I try:
[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
So now I have two OIDs to monitor and they are (in full, this time):
1.3.6.1.2.1.2.2.1.10
and
1.3.6.1.2.1.2.2.1.16
both with an interface number of 4.
Don't get fooled, this wasn't my first try. It took some time for me too to understand what all these numbers mean, it does help a lot when they get translated into descriptive text... At least, when people are talking about MIBs and OIDs you know what it's all about. Do not forget the interface number (0 if it is not interface dependent) and try snmpwalk if you don't get an answer from snmpget.
If you understand above part, and get numbers from your device, it is time to continue with the following. If not, then go back.
1 sample averaged stays 1 period of 5 minutes 6 samples averaged become one average on 30 minutes 24 samples averaged become one average on 2 hours 288 samples averaged become one average on 1 day
There are 600 samples of five minutes, together just over two days There are 600 samples of 30 minutes, almost two weeks There are 600 samples of 2 hours, 50 hour or almost two months There are 732 samples of 1 day, just over two years
For people used to MRTG that even have read the manuals, these numbers should look familiar...
rrdtool create myrouter.rrd \ DS:input:COUNTER:600:U:U \ DS:output:COUNTER:600:U:U \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:600 \ RRA:AVERAGE:0.5:24:600 \ RRA:AVERAGE:0.5:288:732 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:600 \ RRA:MAX:0.5:24:600 \ RRA:MAX:0.5:288:732
Next thing to do is collect data and store it. Here is an example. It is written partially in pseudo code so you will have to find out what to do exactly on your OS to make it work.
while not the end of the universe do get result of snmpget router community 2.2.1.10.4 into variable $in get result of snmpget router community 2.2.1.16.4 into variable $out
rrdtool update myrouter.rrd N:$in:$out
wait for 5 minutes done
Then, after collecting data for a day, try to create an image using:
rrdtool graph myrouter-day.gif --start -86400 \ DEF:inoctets=myrouter.rrd:input:AVERAGE \ DEF:outoctets=myrouter.rrd:output:AVERAGE \ AREA:inoctets#00FF00:"In traffic" \ LINE1:outoctets#0000FF:"Out traffic"
This should produce a picture with one day worth of traffic. One day is 24 hours of 60 minutes of 60 seconds: 24*60*60=86400, we start at now minus 86400 seconds. We DEFine inoctets and outoctets as the average values from the database myrouter.rrd and draw an area for the ``in'' traffic and a line for the ``out'' traffic.
View the image and keep logging for a few more days. If you like, you could try the examples from the test database and see if you can play around with the options and calculations.
Suggestion:
Display in bytes per second and in bits per second. Make the Ethernet graphics go red if they are over four megabits per second.
Recall all the stuff about the speed of the car. Suppose we drove at 144 KM/H during 5 minutes and then were stopped by the police for 25 minutes. At the end of the lecture we would take our laptop and create+view the image taken from the database. If we look at the second RRA we did create, we would have the average from 6 samples. The samples measured would be 144+0+0+0+0+0=144, divided by 30 minutes, corrected for the error by 1000, translated into KM/H, with a result of 24 KM/H. I would still get a ticket but not for speeding anymore :)
Obviously, in this case, we shouldn't look at the averages. In some cases they are handy. If you want to know how much KM you had traveled, the picture would be the right one to look at. On the other hand, for the speed that we traveled at, the maximum number seen is much more valuable. (later we will see more types)
It is the same for data. If you want to know the amount, look at the averages. If you want to know the rate, look at the maximum. Over time, they will grow apart more and more. In the last database we have created, there are two archives that keep data per day. The archive that keeps averages will show low numbers, the archive that shows maxima will have higher numbers. For my car this would translate in averages per day of 96/24=4 KM/H (as I travel about 94 kilometers on a day) during week days, and maximum of 120 KM/H on weekdays (my top speed that I reach every day).
Big difference. Do not look at the second graph to estimate the distances that I travel and do not look at the first graph to estimate my speed. This will work if the samples are close together, as they are in five minutes, but not if you average.
On some days, I go for a long ride. If I go across Europe and travel for over 12 hours, the first graph will rise to about 60 KM/H. The second one will show 180 KM/H. This means that I traveled a distance of 60 KM/H times 24 H = 1440 KM. I did this with a higher speed and a maximum around 180 KM/H. This doesn't mean that I traveled for 8 hours at a constant speed of 180 KM/H ! This is a real example: go with the flow through Germany and stop a few times for gas and coffee. Drive slowly through Austria and the Netherlands. Be careful in the mountains and villages. If you would look at the graphs created from the five-minute averages you would get a totally different picture. You would see the same values on the average and maximum graphs (provided I measured every 300 seconds). You would be able to see when I stopped, when I was in top gear, when I drove over fast motor-ways etc. The granularity of the data is much higher, so you can see more. However, this takes 12 samples per hour, or 288 values per day, so it would be too much to keep for a long period of time. Therefore we average it, eventually to one value per day. From this one value, we cannot see much detail.
Make sure you understand the last few paragraphs. There is no value in only a line and a few axis, you need to know what they mean and interpret the data in a good way. This is true for all data.
The biggest mistake you can make is to use the collected data for something that it is not suitable for. You would be better off if you would not have the graphics at all in that case.
RRDtool can do more than what we have learned up to now. Before you continue with the rest of this doc, I recommend that you reread from the start and try some modifications on the examples. Make sure you fully understand everything. It will be worth the effort and helps you not only with the rest of this doc but also in your day to day monitoring long after you read this introduction.
You know that in order to view a counter over time, you have to take two numbers and divide the difference of them between the time lapsed. This makes sense for the examples I gave you but there are other possibilities. For instance, I'm able to retrieve the temperature from my router in three places namely the inlet, the so called hot-spot and the exhaust. If I take the difference of the two samples and divide that by 300 (seconds) there would not be very much to display ... If there would be anything to display it would be the fluctuations in the temperature and if they produce noticeable results when divided by 300, I'd better look for a new computer room.
So, what can we do ? RRDtool can also store the values you measure directly as they are (this is not entirely true but close enough). The graphs we make look much better, they will show a rather constant value. I know when the router is busy (it works -> it uses more electricity -> it generates more heat -> the temperature rises). I know when the doors are left open (the room is cooled -> the warm air from the rest of the building flows into the computer room -> the inlet temperature rises) etc. The data type we use when creating the database before was counter, we now have a different data type and thus a different name for it. It is called GAUGE. There are more such data types:
- COUNTER we already know this one - GAUGE we just learned this one - DERIVE - ABSOLUTE
The two new types are DERIVE and ABSOLUTE. Absolute can be used like counter with one difference: RRDtool assumes the counter is reset when it's read. That is: its delta is known without calculation by RRDtool whereas RRDtool needs to calculate it for the counter type. Example: our first example (12345, 12357, 12363, 12363) would read: unknown, 12, 6, 0. The rest of the calculations stay the same. The other one, derive, is like counter. Unlike counter, it can also decrease so it can have a negative delta. Again, the rest of the calculations stay the same.
Let's try them all:
rrdtool create all.rrd --start 978300900 \ DS:a:COUNTER:600:U:U \ DS:b:GAUGE:600:U:U \ DS:c:DERIVE:600:U:U \ DS:d:ABSOLUTE:600:U:U \ RRA:AVERAGE:0.5:1:10 rrdtool update all.rrd \ 978301200:300:1:600:300 \ 978301500:600:3:1200:600 \ 978301800:900:5:1800:900 \ 978302100:1200:3:2400:1200 \ 978302400:1500:1:2400:1500 \ 978302700:1800:2:1800:1800 \ 978303000:2100:4:0:2100 \ 978303300:2400:6:600:2400 \ 978303600:2700:4:600:2700 \ 978303900:3000:2:1200:3000 rrdtool graph all1.gif -s 978300600 -e 978304200 -h 400 \ DEF:linea=all.rrd:a:AVERAGE LINE3:linea#FF0000:"Line A" \ DEF:lineb=all.rrd:b:AVERAGE LINE3:lineb#00FF00:"Line B" \ DEF:linec=all.rrd:c:AVERAGE LINE3:linec#0000FF:"Line C" \ DEF:lined=all.rrd:d:AVERAGE LINE3:lined#000000:"Line D"
- Line A: u u 1 1 1 1 1 1 1 1 1 u - Line B: u 1 3 5 3 1 2 4 6 4 2 u - Line C: u u 2 2 2 0 -2 -6 -2 0 2 u - Line D: u 1 2 3 4 5 6 7 8 9 10 u
If your GIF shows all this, you know you have typed the data correct, the RRDtool executable is working properly, your viewer doesn't fool you and you successfully entered the year 2000 :) You could try the same example four times, each time with only one of the lines.
Let's go over the data again:
Delta = 7 - 999987 = -999980 (instead of 1000007-999987=20)
Real delta = -999980 + 999999 + 1 = 20
At the moment of writing this document, RRDtool knows of counters that are either 32 bits or 64 bits of size. These counters can handle the following different values:
- 32 bits: 0 .. 4294967295 - 64 bits: 0 .. 18446744073709551615
If these numbers look strange to you, you would like to view them in their hexadecimal form:
- 32 bits: 0 .. FFFFFFFF - 64 bits: 0 .. FFFFFFFFFFFFFFFF
RRDtool handles both counters the same. If an overflow occurs and the delta would be negative, RRDtool first adds the maximum of a small counter + 1 to the delta. If the delta is still negative, it had to be the large counter that wrapped. Add the maximum possible value of the large counter + 1 and subtract the falsely added small value. There is a risk in this: suppose the large counter wrapped while adding a huge delta, it could happen in theory that adding the smaller value would make the delta positive. In this unlikely case the results would not be correct. The increase should be nearly as high as the maximum counter value for that to happen so chances are you would have several other problems as well and this particular problem would not even be worth thinking about. Even though I did include an example of it so you can judge that for yourself.
The next section gives you some numerical examples for counter-wraps. Try to do the calculations yourself or just believe me if your calculator can't handle the numbers :)
Correction numbers:
- 32 bits: (4294967295+1) = 4294967296 - 64 bits: (18446744073709551615+1)-correction1 = 18446744069414584320
Before: 4294967200 Increase: 100 Should become: 4294967300 But really is: 4 Delta: -4294967196 Correction1: -4294967196 +4294967296 = 100
Before: 18446744073709551000 Increase: 800 Should become: 18446744073709551800 But really is: 184 Delta: -18446744073709550816 Correction1: -18446744073709550816 +4294967296 = -18446744069414583520 Correction2: -18446744069414583520 +18446744069414584320 = 800
Before: 18446744073709551615 ( maximum value ) Increase: 18446744069414584320 ( absurd increase, minimum for Should become: 36893488143124135935 this example to work ) But really is: 18446744069414584319 Delta: -4294967296 Correction1: -4294967296 + 4294967296 = 0 (not negative -> no correction2)
Before: 18446744073709551615 ( maximum value ) Increase: 18446744069414584319 ( one less increase ) Should become: 36893488143124135934 But really is: 18446744069414584318 Delta: -4294967297 Correction1: -4294967297 +4294967296 = -1 Correction2: -1 +18446744069414584320 = 18446744069414584319
As you can see from the last two examples, you need strange numbers for RRDtool to fail (provided it's bug free of course) so this should not happen. However, SNMP or whatever method you choose to collect the data might also fail and it is not uncommon to get wrong numbers occasionally. We can't prevent all errors but there are some things we could do. RRDtool create takes two special parameters for this. They define the minimum and maximum allowed value. Until now, we made them ``U'' for Unknown. You may (not: must) provide values for one or both of them and if RRDtool receives values that are outside these limits, it will ignore them. For a thermometer in degrees Celsius, the absolute minimum is just under -273. For my router, I can assume this minimum is much higher so I would say it is 10. The maximum temperature for my router I would state as 80. Any higher and the device would be out of order. For my car, I would never expect negative numbers and also I would not expect numbers to be higher than 230. Anything else, and there must have been an error. Remember: the opposite is not true, if the numbers pass this check it doesn't mean that they are correct. Always judge the graph with a healthy dose of paranoia if it looks weird.
Suppose a counter increases with exactly one for every second. You want to measure it in 300 seconds intervals. You should retrieve values that are exactly 300 apart. However, due to various circumstances you are a few seconds late and the interval is 303. The delta will also be 303 in that case. Obviously RRDtool should not put 303 in the database and make you believe that the counter increased 303 in 300 seconds. This is where RRDtool interpolates: it alters the 303 value as if it would have been stored earlier and it will be 300 in 300 seconds. Next time you are at exactly the right time. This means that the current interval is 297 seconds and also the counter increased with 297. Again RRDtool alters the value and stores 300 as it should be.
in the RDD in real
time+000: 0 delta="U" time+000: 0 delta="U" time+300: 300 delta=300 time+300: 300 delta=300 time+600: 600 delta=300 time+603: 603 delta=303 time+900: 900 delta=300 time+900: 900 delta=297
Let's create two identical databases. I've chosen the time range 920805000 to 920805900 as this goes very well with the example numbers.
rrdtool create seconds1.rrd \ --start 920804700 \ DS:seconds:COUNTER:600:U:U \ RRA:AVERAGE:0.5:1:24
for Unix: cp seconds1.rrd seconds2.rrd for Dos: copy seconds1.rrd seconds2.rrd for vms: how would I know :)
rrdtool update seconds1.rrd \ 920805000:000 920805300:300 920805600:600 920805900:900 rrdtool update seconds2.rrd \ 920805000:000 920805300:300 920805603:603 920805900:900
rrdtool graph seconds1.gif \ --start 920804700 --end 920806200 \ --height 200 \ --upper-limit 1.05 --lower-limit 0.95 --rigid \ DEF:seconds=seconds1.rrd:seconds:AVERAGE \ CDEF:unknown=seconds,UN \ LINE2:seconds#0000FF \ AREA:unknown#FF0000 rrdtool graph seconds2.gif \ --start 920804700 --end 920806200 \ --height 200 \ --upper-limit 1.05 --lower-limit 0.95 --rigid \ DEF:seconds=seconds2.rrd:seconds:AVERAGE \ CDEF:unknown=seconds,UN \ LINE2:seconds#0000FF \ AREA:unknown#FF0000
Both graphs should show the same.
Alex van den Bogaerdt <alex@ergens.op.het.net>