LinuxCommandLibrary

rrdtool

Store and graph time-series data

SYNOPSIS

rrdtool command [options] [arguments]
Example: rrdtool create mydata.rrd DS:temp:GAUGE:600:U:U RRA:AVERAGE:0.5:1:120
Example: rrdtool update mydata.rrd N:25.5
Example: rrdtool graph mygraph.png --start -1d DEF:mydata=mydata.rrd:temp:AVERAGE LINE1:mydata#FF0000:Temperature

PARAMETERS

Subcommands
    rrdtool operates primarily through subcommands, each performing a specific function. General options for rrdtool itself are minimal; most options are specific to the subcommand being used.

create
    Creates a new RRD file. This involves defining data sources (DS) and Round Robin Archives (RRA) for data storage and aggregation.

update
    Adds new data points to an existing RRD file. This is the core operation for logging real-time or historical data.

graph
    Generates a graph (e.g., PNG, SVG) from the data stored in one or more RRD files. Offers extensive options for data definition, processing, and visual presentation.

fetch
    Retrieves raw data from an RRD file for a specified time range and consolidation function. Useful for scripting and further data analysis.

dump
    Outputs the contents of an RRD file into an XML format, which can be used for backup or inspection.

restore
    Restores an RRD file from an XML dump created by the dump subcommand.

tune
    Modifies various parameters of an existing RRD file (e.g., data source type, heartbeats) without losing existing data.

info
    Displays detailed information about an RRD file, including its data sources, archives, and internal structure.

xport
    Extracts data from multiple RRD files and presents it in a unified XML format, allowing for cross-RRD analysis.

DESCRIPTION

rrdtool is a powerful and versatile command-line tool for managing Round Robin Databases (RRDs). It's designed to store and display time-series data, such as network bandwidth, CPU load, temperature, or any other value that changes over time. Its key feature is the "Round Robin" aspect, where the database file has a fixed size, and older data points are automatically consolidated or overwritten as new data arrives. This prevents the database from growing indefinitely. rrdtool provides functionalities to create new RRDs, update them with new data, fetch data, and most notably, graph the stored data into various image formats (like PNG, SVG). It's widely used in system monitoring, network management, and performance analysis, often integrated with tools like Nagios, Cacti, or independently for custom monitoring solutions.

CAVEATS

Fixed Size Databases: RRD files have a fixed size. While this prevents indefinite growth, it means older, more granular data is automatically consolidated or lost. Careful planning of Round Robin Archives (RRAs) is crucial.
Time Synchronization: Accurate system time is critical for rrdtool's operation, as data is timestamped. Time jumps or synchronization issues can lead to invalid data updates.
Learning Curve: While powerful, rrdtool can have a steep learning curve, especially for defining complex RRD structures and advanced graphing options (e.g., CDEF, VDEF functions).
Error Handling: Error messages can sometimes be cryptic, requiring detailed knowledge of the RRD format and command syntax for debugging.
Data Source Types: Understanding the different data source types (GAUGE, COUNTER, DERIVE, ABSOLUTE, COMPUTE) is essential for correct data interpretation and storage.

RRD FILE FORMAT

An RRD file is a binary file optimized for storing time-series data. It contains definitions for Data Sources (DS), which describe the type of data being collected (e.g., COUNTER for increasing values, GAUGE for current values), and Round Robin Archives (RRA), which define how data is aggregated and stored over different time periods (e.g., average every 5 minutes for 1 day, average every 30 minutes for 1 month). Understanding this internal structure is key to effective rrdtool usage.

INTEGRATION WITH SCRIPTING

rrdtool is primarily a command-line utility, making it exceptionally well-suited for integration into shell scripts, Perl, Python, or other programming languages. This allows for automated data collection, updates, and graph generation, forming the backbone of many custom monitoring systems.

HISTORY

rrdtool was created by Tobias Oetiker in 1999 as a successor to mrtg (Multi Router Traffic Grapher), which also used RRD principles but was more limited. Tobias recognized the need for a more generic and flexible tool for handling time-series data beyond just network traffic. The "Round Robin Database" concept itself dates back earlier, but rrdtool popularized its use for general-purpose monitoring. Its design focus was on efficiency, speed, and providing a robust framework for managing time-series data without indefinite storage growth. It quickly became a de facto standard for many open-source monitoring solutions due to its power and flexibility, and continues to be actively maintained and widely used today.

SEE ALSO

collectd(1), nagios(8), icinga(8), cacti(1), munin(1), snmpwalk(1), graphite(1)

Copied to clipboard