ngx_rrd_graph

Note: this module is not distributed with the Nginx source. Installation instructions are below.

RRDtool stores and graphs time-series data. ngx_rrd_graph provides an HTTP interface to RRDtool's graphing facilities. By linking RRDtool directly into Nginx, ngx_rrd_graph is faster than scripts and CGIs with similar purposes.

Directives

rrd_graph

syntax: rrd_graph

default: n/a

context: location

ngx_rrd_graph can be enabled at a particular location with the "rrd_graph" directive, like so:

    location /rrdtool {
        rrd_graph;
    }

RRDtool graphing commands can then be appended to that location in request URLs. The syntax is just the same as the arguments to the "rrdtool graph" command, omitting the filename. (Refer to rrdgraph(1).) These commands should be URL-encoded, so that this command-line invocation:

    rrdtool graph --start now-300s \
                  --end now \
                  DEF:ds0=test.rrd:reading:AVERAGE \
                  LINE1:ds0#00FF00

becomes:

http://mysite.com/rrdtool--start%20now-300s%20--end%20now%20DEF%3Ads0%3Dtest.rrd%3Areading%3AAVERAGE%20LINE1%3Ads0%2300FF00

The module supports all the features of your copy of RRDtool. It can output PNG, PDF, SVG, and EPS graphics (see the --imgformat option of rrdgraph(1)), as well as plain-text output using RRD's PRINT command.

rrd_graph_root

syntax: rrd_graph_root /path/to/rrds

default: ""

context: location

If you'd prefer not to provide absolute paths to files referenced in DEF commands, you may supply a root directory with the "rrd_graph_root" directive. Files mentioned in DEF commands will be automatically prefixed with the value of rrd_graph_root.

Installation

ngx_rrd_graph requires RRDtool 1.3 or later.

After installing RRDtool, download the ngx_rrd_graph module here: ( ngx_rrd_graph-0.1.tar.gz )

Extract the archive and add the following option to your Nginx ./configure command:

    --add-module=/path/to/ngx_rrd_graph

As of this writing, RRDtool 1.3 is still in beta, and so you may need to set --with-cc-opt and --with-ld-opt to point at your local copy of the RRDtool development headers and library files, e.g.,

     ./configure --with-cc-opt=-I/usr/local/rrdtool/include \
                 --with-ld-opt=-L/usr/local/rrdtool/lib ...

Then "make" and "make install" as usual.

Bugs

Please report bugs to Evan Miller.

NginxNgx rrd graph (last edited 2008-03-12 09:44:57 by Emiller)