Nice post :-) One BIG question that I still have is how do you point (within the graph creation commands) to the correct data-set?
Dirk. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bob Apthorpe Sent: Wednesday, December 10, 2003 11:00 PM To: [EMAIL PROTECTED] Subject: [SA-list] More fun with RRDtool: building historical graphs Hi, I'm testing a change to the RRD (round robin database) creation script to watch more than just the last 24 hours of data. The syntax for rrdcreate (or 'rrdtool.exe create') is rather convoluted and it usually takes a few minutes in a quiet place with a cup of coffee to sort out. See http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdcreate.html if you don't believe me. Servers Alive writes a db creation script of the form: rrdtool.exe create salive.1.rrd -s 120 DS:roundtrip:GAUGE:720:U:U RRA:MAX:0.5:1:720 Going a little into the gory details of this command, we have a step time of 2 minutes (-s 120), a data source definition "DS:roundtrip:GAUGE:720:U:U", and one round-robin archive (RRA) definition of "RRA:MAX:0.5:1:720" "DS:roundtrip:GAUGE:720:U:U" basically tells rrdtool to create a new data source called "roundtrip" as a gauge (ranges between some min and max value) that will return "UNKNOWN" as the data value if more than 720 seconds (12 min) past since the last data point. The min and max are set to unknown ("U".) That's all well and good but it doesn't tell us much about how historical data is stored. The great thing about RRDs is that they never grow in size once they've been created; the downside is that you have to tell RRDtool how to consolidate data points into RRAs - therein lies the most confusing part of configuring RRDtool. One quick note before the brain-hurting part of the post: my goal is to generate trends in system response time and availability, not calculate good availability statistics (e.g. for SLA monitoring.) For that, you'd need raw data, not the consolidated data stored in the RRAs. For now I'm trying to produce graphs which show that my systems have been consistently available over some recent interval (i.e. eye candy.) In SA, the RRA definition (and you can have more than one) defaults to "RRA:MAX:0.5:1:720". Translating this to english, this means "create an RRA using the MAX consolidation function, storing a known value if up to half (0.5) of the raw data is UNKNOWN (any more than that and the consolidated value is also UNKNOWN), consolidating 1 step (2 minute interval; from -s above) into a single row and saving the last 720 rows. That should probably make your head hurt. Now, take 720 rows * 1 step/row * 2 minutes/step to get 1440 minutes of saved data in this RRA. That's one day's worth of data, sliced into 2 minute intervals. That's all well and good, but what I want is up to two years of consolidated data, with different consolidation intervals. That is, if I look at the last quarter's performance, maybe this data needs to be sliced into days, not 2 minute intervals. I could get the same information from 2 minute intervals but that consumes a lot of processing power and disk space and it's not really taking advantage of RRDtool's strength in consolidating data. Being lazy, and knowing that MRTG's RRD creation script builds RRDs that do what I want, I looked for the sections on how it calculates steps and rows and came up with this (all one line): rrdtool.exe create salive.1.rrd -s 120 DS:roundtrip:GAUGE:720:U:U RRA:MAX:0.5:1:720 RRA:MAX:0.5:15:800 RRA:MAX:0.5:60:800 RRA:MAX:0.5:720:800 RRA:AVERAGE:0.5:1:720 RRA:AVERAGE:0.5:15:800 RRA:AVERAGE:0.5:60:800 RRA:AVERAGE:0.5:720:800 Here's a brief description: RRA:MAX:0.5:1:720 - consolidates into 720 2-minute time slices (1d) RRA:MAX:0.5:15:800 - consolidates into 800 30-minute slices (16d 16h) RRA:MAX:0.5:60:800 - consolidates into 800 120-minute slices (66d 16h) RRA:MAX:0.5:720:800 - consolidates into 800 1440-minute slices (800d) The last four RRA arguments do the same but use the AVERAGE consolidation function. How does one make use of that? "Easy" - just change your graph creation script from: rrdtool.exe graph hour_salive.1.png -s -3600 --imgformat PNG --title="Test 1: max response time" DEF:sa_1=salive.1.rrd:roundtrip:MAX LINE1:sa_1#0000FF:"Response Time (ms)" to rrdtool.exe graph hour_salive.1.png -s -3600 --imgformat PNG --title="Test 1: avg response time" DEF:sa_1=salive.1.rrd:roundtrip:AVERAGE LINE1:sa_1#0000FF:"Response Time (ms)" (I added the "--imgformat PNG" part because PNG images are smaller than GIFs and despite the expiration of the LZW compression patent, I still hold a grudge against proprietary, patent-encumbered data formats.) Plotting min/avg/max response time on the same graph is left as an exercise for bored admins. :) I made the change about 90 minutes ago so I won't see if this worked until this time tomorrow. Note that running rrdcreate against extant databases will completely reset them so it's important to design your RRAs well the first time; you won't want to change them once you start saving substantial amounts of data. In this case, I lose a day's worth of data so it's no big deal. However, other people have other needs, so I'm forwarding this along to the list as an FYI. Ideally we can get some nice one-size-fits-all presets built into SA and nobody (else) will have to hurt their brain trying to sort out the arguments to rrdcreate. :) hth, -- Bob To unsubscribe from a list, send a mail message to [EMAIL PROTECTED] With the following in the body of the message: unsubscribe SAlive To unsubscribe from a list, send a mail message to [EMAIL PROTECTED] With the following in the body of the message: unsubscribe SAlive
