### Set Build and Install Directories Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Define environment variables for the build and installation directories. Ensure the build directory exists and is accessible. ```bash BUILD_DIR=/tmp/rrdbuild INSTALL_DIR=/opt/rrdtool-1.7.1 ``` ```bash mkdir -p $BUILD_DIR cd $BUILD_DIR ``` -------------------------------- ### Build pkgconfig Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Instructions to download, compile, and install pkgconfig version 0.23. Ensure pkgconfig is installed for the build process to be smoother. ```shell wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz gunzip -c pkg-config-0.23.tar.gz | tar xf - cd pkg-config-0.23 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Install Development Packages on Debian/Ubuntu Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Use apt-get to install required development libraries for compiling RRDtool on Debian-based systems. ```bash apt-get install libpango1.0-dev libxml2-dev ``` -------------------------------- ### Specifying Time Ranges for Graphs Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_examples.en.html Provides examples of common time range specifications using --start and --end arguments. These examples cover relative times (weeks, hours) and absolute dates. ```bash --start end-4w --end 00:00 ``` ```bash --start 20010101 --end start+31d ``` ```bash --start 20010101 --end 20010201 ``` ```bash --start end-1h ``` ```bash ``` ```bash --end 00:00 ``` -------------------------------- ### Build LibXML2 Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Instructions to download, compile, and install LibXML2 version 2.6.32 with position-independent code support. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz gunzip -c libxml2-2.6.32.tar.gz | tar xf - cd libxml2-2.6.32 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Build Pixman Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Instructions to download, compile, and install Pixman version 0.10.0 with position-independent code support. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz gunzip -c pixman-0.10.0.tar.gz | tar xf - cd pixman-0.10.0 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Install Development Packages on OpenSolaris Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Install necessary development tools and libraries for compiling RRDtool on OpenSolaris using the pkg install command. ```bash pkg install sunstudioexpress pkg install SUNWgnome-common-devel ``` -------------------------------- ### Build Glib Library Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Download, configure, and build the Glib library. Specify the installation prefix and optimization flags for CFLAGS. ```bash cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz gunzip -c glib-2.15.4.tar.gz | tar xf - cd glib-2.15.4 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Database Table Schema Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_libdbi.en.html An example CREATE TABLE statement for a MySQL database, defining columns for RRD data storage. ```sql CREATE TABLE RRDValue ( RRDKeyID bigint(20) NOT NULL, UnixTimeStamp int(11) NOT NULL, value double default NOT NULL, PRIMARY KEY (RRDKeyID,UnixTimeStamp) ); ``` -------------------------------- ### Build zlib Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Steps to download, compile, and install zlib version 1.2.3 with shared library support and position-independent code. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz gunzip -c zlib-1.2.3.tar.gz | tar xf - cd zlib-1.2.3 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared $MAKE $MAKE install ``` -------------------------------- ### Build freetype Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Steps to download, compile, and install freetype version 2.3.5 with position-independent code support. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz gunzip -c freetype-2.3.5.tar.gz | tar xf - cd freetype-2.3.5 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Build Pango Library Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Download, configure, and build the Pango text layout library. Set the installation prefix, CFLAGS for optimization, and disable X support. ```bash cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2 bunzip2 -c pango-1.21.1.tar.bz2 | tar xf - cd pango-1.21.1 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x $MAKE $MAKE install ``` -------------------------------- ### Build libpng Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Instructions to download, compile, and install libpng version 1.2.18. This build requires zlib. CFLAGS are set for position-independent code. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz gunzip -c libpng-1.2.18.tar.gz | tar xf - cd libpng-1.2.18 env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR $MAKE $MAKE install ``` -------------------------------- ### Optimistic RRDtool Build and Install Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Attempt to download, extract, configure, compile, and install RRDtool assuming all dependencies are met. This is an optimistic approach that may fail if libraries are missing. ```bash wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.7.1.tar.gz gunzip -c rrdtool-1.7.1.tar.gz | tar xf - cd rrdtool-1.7.1 ./configure --prefix=$INSTALL_DIR && make && make install ``` -------------------------------- ### PING Command Output Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html The PING command is used for connection testing and expects a PONG response from the daemon. ```text 0 PONG ``` -------------------------------- ### Set Build Environment Variables Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Set PKG_CONFIG_PATH and PATH to include the installation directory for pkgconfig and other tools. This is crucial for dynamically linked libraries to find each other. ```shell export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig export PATH=$INSTALL_DIR/bin:$PATH ``` -------------------------------- ### Create RRD file with daemon Source: https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html This example shows how to create an RRD file using the rrdcached daemon for management. Ensure the daemon is running and accessible at the specified address. ```bash rrdtool create --daemon unix:/var/run/rrdcached.sock /var/lib/rrd/foo.rrd I ``` -------------------------------- ### Example of rrdcached base directory usage Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Illustrates how paths provided on the command line are resolved relative to the base directory. Absolute paths are unaffected. ```text +------------------------+------------------------+ ! Command line ! File updated ! +------------------------+------------------------+ ! foo.rrd ! /tmp/foo.rrd ! ! foo/bar.rrd ! /tmp/foo/bar.rrd ! ! /var/lib/rrd/foo.rrd ! /var/lib/rrd/foo.rrd ! +------------------------+------------------------+ Paths given on the command line and paths actually updated by the daemon, assuming the base directory "/tmp". ``` -------------------------------- ### RRDcgi Demo Page Source: https://oss.oetiker.ch/rrdtool/doc/rrdcgi.en.html An example of a complete RRDcgi page that includes an RRD graph. This demonstrates the basic structure of an RRDcgi script. ```rrdcgi #!/usr/local/bin/rrdcgi RRDCGI Demo

RRDCGI Example Page

``` -------------------------------- ### Example rrdcached Protocol Command Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Demonstrates the format of a command sent to the rrdcached daemon, including the command keyword, arguments, and the line feed terminator. ```text FLUSH /tmp/foo.rrd ``` -------------------------------- ### rrdcached RESUMEALL Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Resume writing to all RRD files that were suspended. This flushes all cached metrics to their respective files. ```shell RESUMEALL ``` -------------------------------- ### CREATE Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html The CREATE command is used to create a new RRD file with specified parameters, including step size, begin time, data sources, and Round Robin Archives. ```bash CREATE [-s ] [-b ] [-r ...] [-t ] [-O] ... ... ``` -------------------------------- ### Example rrdcached Protocol Responses Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Illustrates the expected responses from the rrdcached daemon, showing success codes and multi-line responses. ```text 0 Success ``` ```text 2 Two lines follow This is the first line And this is the second line ``` -------------------------------- ### RRDTool CDEF Example: Transforming Bytes to Bits Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html Demonstrates using CDEF to transform data before graphing. This specific example multiplies the 'ds0' data source by 8, effectively converting bytes to bits for visualization. ```bash CDEF:new=ds0,8,* ``` -------------------------------- ### RRDtool as a Meta-Server in /etc/inetd.conf Source: https://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html Configure inetd to run RRDtool as a server. This example sets up 'rrdsrv' to stream TCP connections, running RRDtool with a specified directory. ```bash rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd ``` -------------------------------- ### RRDtool Graphv Output Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html Illustrates the key=value output format of the graphv option, providing detailed information about the graph's properties and image data. ```text print[0] = "0.020833" print[1] = "0.0440833" graph_left = 51 graph_top = 22 graph_width = 400 graph_height = 100 graph_start = 1232908800 graph_end = 1232914200 image_width = 481 image_height = 154 value_min = 0.0000000000e+00 value_max = 4.0000000000e-02 image = BLOB_SIZE:8196 [... 8196 bytes of image data ...] ``` -------------------------------- ### STATS Command Output Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html The STATS command returns performance metrics and status information about the rrdcached daemon. The output format is key-value pairs. ```text 9 Statistics follow QueueLength: 0 UpdatesReceived: 30 FlushesReceived: 2 UpdatesWritten: 13 DataSetsWritten: 390 TreeNodesNumber: 13 TreeDepth: 4 JournalBytes: 190 JournalRotate: 0 ``` -------------------------------- ### Build Cairo Library Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Download, configure, and build the Cairo graphics library. Ensure to set the installation directory and disable specific backends if not needed. CFLAGS are set for optimization and position-independent code. ```bash cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz gunzip -c cairo-1.6.4.tar.gz | tar xf - cd cairo-1.6.4 ./configure --prefix=$INSTALL_DIR \ --enable-xlib=no \ --enable-xlib-render=no \ --enable-win32=no \ CFLAGS="-O3 -fPIC" $MAKE $MAKE install ``` -------------------------------- ### Display RRD Header Information Source: https://oss.oetiker.ch/rrdtool/doc/rrdinfo.en.html This example shows the typical output of the rrdinfo command for an RRD file. It details data source properties, RRA configurations, and last update times. ```text filename = "random.rrd" rrd_version = "0001" step = 300 last_update = 955892996 header_size = 2872 ds[a].type = "GAUGE" ds[a].minimal_heartbeat = 600 ds[a].min = NaN ds[a].max = NaN ds[a].last_ds = "UNKN" ds[a].value = 2.1824421548e+04 ds[a].unknown_sec = 0 ds[b].type = "GAUGE" ds[b].minimal_heartbeat = 600 ds[b].min = NaN ds[b].max = NaN ds[b].last_ds = "UNKN" ds[b].value = 3.9620838224e+03 ds[b].unknown_sec = 0 rra[0].cf = "AVERAGE" rra[0].pdp_per_row = 1 rra[0].cdp_prep[0].value = nan rra[0].cdp_prep[0].unknown_datapoints = 0 rra[0].cdp_prep[1].value = nan rra[0].cdp_prep[1].unknown_datapoints = 0 ``` -------------------------------- ### rrdcached LIST Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html The LIST command helps discover RRD files managed by rrdcached. Use LIST RECURSIVE to search subdirectories. ```shell LIST [RECURSIVE] I/ ``` -------------------------------- ### rrdcached RESUME Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Resume writing to an RRD file that was previously suspended. Metrics cached in memory will be written to the file. ```shell RESUME _filename_ ``` -------------------------------- ### RRDtool xport Command Structure Source: https://oss.oetiker.ch/rrdtool/doc/rrdxport.en.html This example shows the general structure of the rrdtool xport command, including DEF, CDEF, and XPORT operations. ```bash rrdtool xport \ --start now-1h --end now \ DEF:xx=host-inout.lo.rrd:output:AVERAGE \ DEF:yy=host-inout.lo.rrd:input:AVERAGE \ CDEF:aa=xx,yy,+,8,* \ XPORT:xx:"out bytes" \ XPORT:aa:"in and out bits" ``` -------------------------------- ### Export data with rrdxport using a daemon Source: https://oss.oetiker.ch/rrdtool/doc/rrdxport.en.html This example shows how to use rrdxport to export data, specifying the rrdcached daemon address for fresh data retrieval. ```bash rrdtool xport --daemon unix:/var/run/rrdcached.sock ... ``` -------------------------------- ### Set PKG_CONFIG Environment Variable Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html After installing pkgconfig in a custom directory, set the PKG_CONFIG environment variable to point to its executable. ```shell export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config ``` -------------------------------- ### Emerging RRDtool on Gentoo Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Install RRDtool on Gentoo using the emerge command. Dependencies and USE flags are managed by the Portage system. Consult the Gentoo handbook for USE flag details. ```bash # emerge -va rrdtool ``` -------------------------------- ### Set MAKE Environment Variable Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html If GNU make is installed and not named 'make', set the MAKE and GNUMAKE environment variables. Otherwise, use the default 'make'. ```shell export MAKE=gmake export GNUMAKE=gmake ``` ```shell export MAKE=make ``` -------------------------------- ### RRDcgi Script with Separate Directories Source: https://oss.oetiker.ch/rrdtool/doc/rrdcgi.en.html This example demonstrates how to configure rrdcgi when RRD files, generated graphs, and the cgi-bin are in separate directories. Replace '/.../' with your actual directory paths. ```rrdcgi #!/.../bin/rrdcgi RRDCGI Demo

RRDCGI test Page

' --lazy --start -1d --end now DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE AREA:http_src#00ff00:http_src > ``` -------------------------------- ### rrdcached BATCH Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Use the BATCH command for high-volume updates to minimize network overhead. Commands are processed sequentially, with errors reported only after all commands are sent. ```shell client: BATCH server: 0 Go ahead. End with dot '.' on its own line. client: UPDATE x.rrd 1223661439:1:2:3 <--- command #1 client: UPDATE y.rrd 1223661440:3:4:5 <--- command #2 client: and so on... client: . server: 2 Errors server: 1 message for command 1 server: 12 message for command 12 ``` -------------------------------- ### Build fontconfig Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Steps to download, compile, and install fontconfig version 2.4.2. This build requires freetype and sets CFLAGS for position-independent code. ```shell cd $BUILD_DIR wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz gunzip -c fontconfig-2.4.2.tar.gz | tar xf - cd fontconfig-2.4.2 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --with-freetype-config=$INSTALL_DIR/bin/freetype-config $MAKE $MAKE install ``` -------------------------------- ### RRDtool Help Command Source: https://oss.oetiker.ch/rrdtool/doc/rrdtool.en.html Use this command to get help on specific RRDtool server commands. It provides detailed usage information for commands like 'cd'. ```bash rrdtool help cd ``` -------------------------------- ### RRDtool xport Single Data Source Export Source: https://oss.oetiker.ch/rrdtool/doc/rrdxport.en.html This example demonstrates exporting a single data source ('outoctets') from an RRD file with a specific label. ```bash rrdtool xport \ DEF:out=if1-inouts.rrd:outoctets:AVERAGE \ XPORT:out:"out bytes" ``` -------------------------------- ### Stack Depth Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Demonstrates the DEPTH operator, which pushes the current number of elements on the stack onto the stack itself. This can be useful for debugging or complex stack manipulations. ```rrdtool a,b,DEPTH -> a,b,2 ``` -------------------------------- ### Create RRD with Seconds Specification Source: https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html Creates an RRD file for power values using seconds for step and heartbeat. This example defines four RRAs for different data retention periods. ```bash rrdtool create power.rrd \ --start now-2h --step 1 \ DS:watts:GAUGE:300:0:24000 \ RRA:AVERAGE:0.5:1:864000 \ RRA:AVERAGE:0.5:60:129600 \ RRA:AVERAGE:0.5:3600:13392 \ RRA:AVERAGE:0.5:86400:3660 ``` -------------------------------- ### Setting rrdcached Log Level Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Example of setting the maximum log level for rrdcached to control log verbosity. Higher values mean more detailed logging. ```shell rrdcached -V LOG_INFO ``` -------------------------------- ### Fetch RRD Data with --align-start Flag Source: https://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html Fetches RRD data using the --align-start flag to automatically align the start time to the nearest valid boundary for the specified resolution. ```bash rrdtool fetch subdata.rrd AVERAGE -a -r 15m -s -1h ``` -------------------------------- ### RRDtool xport Multiple Data Sources and CDEF Export Source: https://oss.oetiker.ch/rrdtool/doc/rrdxport.en.html This example shows exporting multiple data sources and a computed data source (sum of two sources) with distinct labels. ```bash rrdtool xport \ DEF:out1=if1-inouts.rrd:outoctets:AVERAGE \ DEF:out2=if2-inouts.rrd:outoctets:AVERAGE \ CDEF:sum=out1,out2,+, \ XPORT:out1:"if1 out bytes" \ XPORT:out2:"if2 out bytes" \ XPORT:sum:"output sum" ``` -------------------------------- ### RRDTool VDEF PERCENT/PERCENTNAN Examples Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Use PERCENT or PERCENTNAN to find a value such that a given percentage of the data set is less than or equal to it. PERCENTNAN ignores unknown values, while PERCENT treats them as lower than any finite number. ```rpn VDEF:perc95=mydata,95,PERCENT ``` ```rpn VDEF:percnan95=mydata,95,PERCENTNAN ``` -------------------------------- ### Build RRDtool Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html Configure and build the RRDtool library after its dependencies are installed. This command disables Python and Tcl bindings and cleans the build before compiling and installing. ```bash cd $BUILD_DIR/rrdtool-1.7.1 ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python $MAKE clean $MAKE $MAKE install ``` -------------------------------- ### RRDTool CDEF Example: Bytes to Bits Conversion Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html Use CDEF to create a new data series by applying an RPN expression to existing data. This example multiplies data points by 8, likely converting bytes to bits. ```bash CDEF:mydatabits=mydata,8,* ``` -------------------------------- ### Create RRD Database for Web Proxy Metrics Source: https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html This example creates an RRD file to monitor average request duration for a web proxy. It defines data sources for requests, duration, and a computed average, along with a round-robin archive. ```bash rrdtool create proxy.rrd --step 300 \ DS:Requests:DERIVE:1800:0:U \ DS:Duration:DERIVE:1800:0:U \ DS:AvgReqDur:COMPUTE:Duration,Requests,0,EQ,1,Requests,IF,/ \ RRA:AVERAGE:0.5:1:2016 ``` -------------------------------- ### rrdc_first Source: https://oss.oetiker.ch/rrdtool/doc/librrd.en.html Gets the first value of the first sample of a specified RRA in an RRD file. ```APIDOC ## rrdc_first(const char *filename, int rraindex) ### Description Get the first value of the first sample of the RRD `filename`, of the `rraindex` RRA (Round Robin Archive) index number. The RRA index number can be determined by pulling the rrd_info_t off the RRD. ### Parameters #### Path Parameters - **filename** (const char *) - Required - The path to the RRD file. - **rraindex** (int) - Required - The index of the RRA. ``` -------------------------------- ### rrdcached QUIT Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Disconnect from the rrdcached server. This command terminates the client's connection. ```shell QUIT ``` -------------------------------- ### RRDTool VDEF STDEV Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Use the STDEV operator to calculate the standard deviation of a data set. ```rpn VDEF:stdev=mydata,STDEV ``` -------------------------------- ### rrd_client_first Source: https://oss.oetiker.ch/rrdtool/doc/librrd.en.html Gets the first value of the first sample for a specific RRA in an RRD file using a client object. ```APIDOC ## rrd_client_first(rrd_client_t *client, const char *filename, int rraindex) ### Description Get the first value of the first sample of the RRD `filename`, of the `rraindex` RRA (Round Robin Archive) index number, using the provided client connection. ### Parameters #### Path Parameters - **client** (rrd_client_t *) - Required - The client connection object. - **filename** (const char *) - Required - The path to the RRD file. - **rraindex** (int) - Required - The index of the RRA. ``` -------------------------------- ### rrdcached SUSPENDALL Command Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Suspend writing to all RRD files managed by rrdcached. All incoming metrics will be cached in memory. ```shell SUSPENDALL ``` -------------------------------- ### Get Environment Variable Source: https://oss.oetiker.ch/rrdtool/doc/rrdcgi.en.html Retrieves the value of an environment variable. Useful for accessing server-side information like user authentication. ```rrdcgi ``` -------------------------------- ### Get RRD Daemon Statistics Source: https://oss.oetiker.ch/rrdtool/doc/librrd.en.html Retrieves statistics from the connected RRD daemon. The statistics are returned as a linked list of rrdc_stats_t structures. ```c rrdc_stats_get(rrd_client_t *client, rrdc_stats_t **ret_stats) ``` ```c rrdc_stats_get(rrdc_stats_t **ret_stats) ``` -------------------------------- ### Configure freetype on Solaris Source: https://oss.oetiker.ch/rrdtool/doc/rrdbuild.en.html If encountering issues building freetype on Solaris, prepend 'env EGREP=egrep' to the configure command. ```shell env EGREP=egrep ``` -------------------------------- ### Create Directory with Parents using rrd_mkdir_p Source: https://oss.oetiker.ch/rrdtool/doc/librrd.en.html Creates a directory specified by pathname, including any necessary parent directories, similar to 'mkdir -p'. Returns 0 on success, a negative value on failure, setting errno accordingly. Does not fail if the directory already exists. ```c /* Example usage would involve calling rrd_mkdir_p with a path and mode */ ``` -------------------------------- ### Enable Pango Markup Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html Use the --pango-markup option to enable Pango markup for all text rendering in RRDtool. ```bash -P | --pango-markup ``` -------------------------------- ### Format Image Information Output Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html The --imginfo option uses printf to format output after image creation, providing filename, xsize, and ysize. Useful for generating HTML IMG tags. ```bash --imginfo 'Demo' ``` -------------------------------- ### RRDTool VDEF LSLSLOPE Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Use LSLSLOPE to calculate the slope (m) of a least squares line approximation for the provided dataset, related to the COUNT position. ```rpn VDEF:slope=mydata,LSLSLOPE ``` -------------------------------- ### RRDTool VDEF LAST/FIRST Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Use LAST or FIRST operators to retrieve the last or first non-NaN/infinite value from a data stream, including its timestamp. ```rpn VDEF:first=mydata,FIRST ``` -------------------------------- ### Create RRD file for router interface monitoring (explicit RRAs) Source: https://oss.oetiker.ch/rrdtool/doc/rrdcreate.en.html Configures an RRD file for router interface monitoring with explicit creation of specialized RRAs. This includes AVERAGE, HWPREDICT, SEASONAL, DEVSEASONAL, DEVPREDICT, and FAILURES. It uses shorthand for time intervals (e.g., 5m, 30m, 5d, 1d) and specifies parameters for forecasting and deviation detection. ```bash rrdtool create monitor.rrd --step 5m \ DS:ifOutOctets:COUNTER:30m:0:4294967295 \ RRA:AVERAGE:0.5:1:2016 \ RRA:HWPREDICT:5d:0.1:0.0035:1d:3 \ RRA:SEASONAL:1d:0.1:2 \ RRA:DEVSEASONAL:1d:0.1:2 \ RRA:DEVPREDICT:5d:5 \ RRA:FAILURES:1d:7:9:5 ``` -------------------------------- ### Applying Command Restrictions to Specific Sockets Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html Demonstrates how to apply command restrictions to a specific network socket while using a default UNIX domain socket for other operations. ```shell rrdcached -l unix:/some/path -P FLUSH,PENDING -l 10.0.0.1 ``` -------------------------------- ### QUEUE Command Output Source: https://oss.oetiker.ch/rrdtool/doc/rrdcached.en.html The QUEUE command shows files on the output queue. Each line indicates the number of values to be written for a specific file. ```text ``` -------------------------------- ### RRDTool VDEF LSLINT Example Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Use LSLINT to calculate the y-intercept (b) of a least squares line approximation, which corresponds to the first data point on the graph. ```rpn VDEF:intercept=mydata,LSLINT ``` -------------------------------- ### RRDTool Graph Example with Prediction and Uncertainty Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html A comprehensive RRDTool graph command that visualizes predicted values, upper and lower certainty limits (based on sigma), and highlights when actual values exceed these limits. It demonstrates the practical application of PREDICT, PREDICTSIGMA, and LIMIT operators. ```bash rrdtool graph image.png --imgformat=PNG \ --start=-7days --end=+3days --width=1000 --height=200 --alt-autoscale-max \ DEF:value=value.rrd:value:AVERAGE:start=-14days \ LINE1:value#ff0000:value \ CDEF:predict=86400,-7,1800,value,PREDICT \ CDEF:sigma=86400,-7,1800,value,PREDICTSIGMA \ CDEF:upper=predict,sigma,3,*,+ \ CDEF:lower=predict,sigma,3,*,- \ LINE1:predict#00ff00:prediction \ LINE1:upper#0000ff:upper\ certainty\ limit \ LINE1:lower#0000ff:lower\ certainty\ limit \ CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \ TICK:exceeds#aa000080:1 \ ``` -------------------------------- ### Viewing Current and Previous Week Together Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_examples.en.html Shows how to display data from the current week and the previous week on the same graph. It involves defining data for both periods and then shifting the previous week's data forward by one week's duration. ```bash --end now --start end-1w DEF:thisweek=router.rrd:ds0:AVERAGE DEF:lastweek=router.rrd:ds0:AVERAGE:end=now-1w:start=end-1w ``` ```bash SHIFT:lastweek:604800 AREA:lastweek#0000FF:Last\ week LINE1:thisweek#FF0000:This\ week ``` -------------------------------- ### DEF Instruction Source: https://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html The DEF instruction fetches data from an RRD file. It allows specifying the RRD file, data source name, consolidation function (CF), and optional parameters like step, start, end, reduce CF, and daemon address. ```APIDOC ## DEF: =::[:step=][:start=