RRD Tool is a Round Robin database tool developed by Tobias Oetiker, a system manager at the Swiss Federal Institute of Technology.
RRD tool is mostly used to store and process the data collected via SNMP. It can be used on any operating system. The data is mostly in bytes (or bits) transferred from and to a network or a computer. It can also be used to display solar radiation, power consumption, number of visitors at an exhibition, noise levels near an airport, etc. Only a sensor is needed to measure the data and feed the numbers into the rrd tool.
RRD Tool database is mainly used for monitoring purposes. Defining any tables with columns and other parameters is not required as they are simple in structure. In RRD database, data is stored in a round robin fashion (i.e. in a circular buffer). It is implemented like a FIFO queue, that is when new data gets entered into database, the old data is removed from it. As this database is like round robin, it will always contain the fixed amount of information throughout its lifetime.
RRD Tool database works as a back end tool as well as front end tool. At back end, RRD Tool can be used as a database to store data and at front end it can be used for plotting graphs. The main advantage of RRD Tool is that the size of the database always remains constant. Whereas in linear databases, the size of the database increases as new data is always appended at the bottom of the table.
Linear databases are updated when values are supplied to it, but the RRD Tool database needs data at specific time intervals. So while using this database, it is better to use the scripts that run at regular intervals, so that RRD Tool will receive the new data at regular intervals for updating the database. If it does not receive the new data during any interval, it will store an unknown value for that interval. After all the values are updated in database, you can fetch the values and generate graphs using them. The rrd commands are executed from command prompt to fetch and update values from database and to generate graphs.
RRDtool can be used directly from languages like Perl, python, PHP etc. Cacti, SmokePing, MRTG, Zenoss, collectd, Nmon are the popular graphing programs, whose database is based on RRDtool.
Installing RRD Tool :
Installing RRD Tool is very easy and simple.
Create a folder named RRDTool on any of the drives, download the latest version of rrdtool and extract the zip file into the newly created RRDTool folder.
Then open the command prompt and type in the following command:
After this, you are ready to use rrd tool.
Generating graphs using RRD Tool :
- For plotting graphs using rrd tool you need to create rrd file for storing the data.
- Then you need to execute the update command at regular intervals to keep on updating the data with new values in rrd.
- Finally, execute the graph command for generating the graph of updated values in rrd.
create : This command is used to create rrd files that initially stores the unknown data.
Syntax :- rrdtool create filename.rrd -s 60 DS:input:GAUGE:600:U:U DS:output:GAUGE:600:U:U RRA:AVERAGE:0.5:1:10080
- DS is the name used to reference the data source from rrd.
- RRA is round robin archive that consist of a number of data values for each of the defined data sources.
update : This command provides new data to the rrd.
Syntax :- rrdtool update filename.rrd N:value1:value2
- It updates the filename.rrd file with two known values.
graph : This command is used to present the data from rrd to user in the form of graphs.
Syntax :- rrdtool graph filename.png –imgformat PNG –font DEFAULT:7: –lazy –height=117 –width=201 –alt-autoscale-max –lower-limit=0 –slope-mode –vertical-label=Amps DEF:IN=54_oooo_voltage.rrd:input:AVERAGE: DEF:OUT=54_oooo_voltage.rrd:output:AVERAGE: AREA:IN#00CF00:Input LINE1:OUT#0000FF:Output –end now –start end-10m –title title
- imgformat specifies the format of the image to be created.
- font specifies the type of font and its size.
- alt- autoscale modifies the absolute minimum and maximum values.
- limit specifies the upper and lower limit of y axis.
- vertical- label specifies the vertically placed string at the left hand side of the graph.
- LINE and AREA specifies the value and color for the line drawn and the area.
- start and end specify the start and end of the time series that you want to display.
- title specifies the title for graph at the top of it.