Databases Reference
In-Depth Information
RRDTOOL
RRDTool is a leading open-source tool for high-performance logging and the graphing of time
series data. It integrates easily with shell scripts and many different scripting languages, including
Python, Ruby, Perl, Lua, and Tcl. RRDTool is written in C and compiles to most platforms.
It can easily run on Linux, Windows, and Mac OS X. You can download RRDTool from
http://oss.oetiker.ch/rrdtool/ .
RRDTool includes a database and a graph generation and rendering environment. The RRDTool
database is unlike a traditional RDBMS. It's more like a rolling log fi le. RRDTool serves as a very
helpful monitoring tool because it can be used to capture and graph performance, usage, and
utilization metrics.
Here I present a simple example to help you understand RRDTool. Say you need to capture a metric
like CPU utilization on a machine that runs a NoSQL database node. You may decide to capture the
utilization metric every 60 seconds (once every minute). In addition, you may want to average
the utilization metric for every hour and save such calculations for a day (24 hours). You can easily
store such data and graph the saved values for easy analysis.
The RRDTool database can be thought of as a storage scheme around the perimeter of a circle. This
means as data gets written around a circle you eventually come back to the starting point. When
you come back to the start, newer data values overwrite the old ones. This means the amount of
data you store is determined up front by the total storage allocated for the database. Continuing
with the circle analogy, the circumference of the circle is determined up front.
The easiest way to create an RRDTool database is via its command-line interface (CLI), which for
the rudimentary CPU utilization metric example could be as follows:
rrdtool create myrrddb.rrd \
--start 1303520400 \
--step 60 \
DS:cpu:GAUGE:120:0:100 \
RRA:AVERAGE:0.5:60:24 \
RRA:AVERAGE:0.5:1440:31
This command creates an RRDTool database named myrrddb.rrd . It creates the database by
initializing it with a set of properties that defi ne the metric it captures and how this metric gets
aggregated. Parsing the command line by line is a good idea to understand all the parameters.
The start and step parameters defi ne the start time and the interval of capture for the data-
base. The time value passed, as a parameter to the start argument, is a time value represented in
terms of number of seconds since epoch, which in the case of RRDTool is 1/1/1970. The step value
in seconds specifi es the frequency of recording and saving a metric. Because the intent is to save
CPU utilization values once every minute, the step value is specifi ed as 60 (60 seconds).
The line right after the step argument defi nes the metric being captured. The value DS:cpu:
GAUGE:120:0:100 follows this format:
DS:variable_name:data_source_type:heartbeat:min:max
Search WWH ::




Custom Search