RRDGRAPH_GRAPH(1)
π NAME π
rrdgraph_graph β the rrdtool graph command reference, aka the cheat sheet for every single thing you can yell at your graph π
(also hi, this is from the rrdtool manual, section 1 β RRDGRAPH_GRAPH(1), if you're keeping track π)
β¨ SYNOPSIS β¨
okay so here's the whole cast of characters, no cap π«Ά these are the graph-command building blocks, exactly as written:
PRINT:vname:format[:strftime|:valstrftime|:valstrfduration]
GPRINT:vname:format
COMMENT:text
VRULE:time#color[:[legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
HRULE:value#color[:[legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
LINE[width]:value[#color][:[legend][:STACK][:skipscale][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
AREA:value[#color][:[legend][:STACK][:skipscale]]
TICK:vname#rrggbb[aa][:fraction[:legend]]
SHIFT:vname:offset
TEXTALIGN:{left|right|justified|center}
and then the little deprecated corner π these still exist, they're just the legacy vibe:
PRINT:vname:CF:format (deprecated)
GPRINT:vname:CF:format (deprecated)
STACK:vname#color[:legend] (deprecated)
bestie listen to me β those three at the bottom are marked deprecated in the original, so don't go building your whole personality on them, mkay? π the non-deprecated forms above are right there.
seriously though, copy these exactly β every colon, every bracket, every on_s/off_s, every dash-offset=offset. the colons are load-bearing π
π DESCRIPTION π
okay so this is the part where you actually make the thing π These instructions are what let you generate your image or your report. And here's the vibe check: if you don't use any graph elements, no graph gets generated. Same energy the other way β no report happens if you don't use print options. So like, you have to actually ask for it, bestie. β¨
π PRINT π
PRINT:vname:format[:strftime|:valstrftime|:valstrfduration]
Depending on the context, you're printing either the value component of a VDEF (that's no suffix, valstrftime, or valstrfduration) or the time component of a VDEF (strftime), using format. And ngl, it is an error to specify a vname that was generated by a DEF or a CDEF. Like, don't do that. π
Any text in format gets printed literally, with exactly one exception: the percent character % is what introduces a formatter string. π
πΈ For printing values πΈ
%%β just prints a literal%character, that's it, that's the whole job.%#.#leβ prints numbers like1.2346e+04. The optional integers#denote field width and decimal precision.%#.#lfβ prints numbers like12345.6789(%5.4lf), with optional field width and precision.%sβ place this after%le,%lf, or%lg. It gets replaced by the appropriate SI magnitude unit and the value gets scaled accordingly (123456->123.456 k).%Sβ similar to%s, but plot twist π it uses a previously defined magnitude unit. If there isn't one yet, it tries to define one (just like%sdoes) β unless the value is zero, in which case the magnitude unit stays undefined. So like, formatter strings using%Sand no%swill all use the same magnitude unit except for zero values. iykyk.
π¦ Printing the time β¨
If you PRINT a VDEF value, you can also print the time associated with it by appending the string :strftime to the format. Note that RRDtool uses the strftime function of your OS's C library β which means the conversion specifier may vary. Check the manual page if you're uncertain, bestie, fr fr.
The following is a list of conversion specifiers usually supported across the board. Formatting values interpreted as timestamps with :valstrftime is done likewise. π«Ά
%aβ the abbreviated weekday name according to the current locale.%Aβ the full weekday name according to the current locale.%bβ the abbreviated month name according to the current locale.%Bβ the full month name according to the current locale.%cβ the preferred date and time representation for the current locale.%dβ the day of the month as a decimal number (range01to31).%Hβ the hour as a decimal number using a 24-hour clock (range00to23).%Iβ the hour as a decimal number using a 12-hour clock (range01to12).%jβ the day of the year as a decimal number (range001to366).%mβ the month as a decimal number (range01to12).%Mβ the minute as a decimal number (range00to59).%pβ eitherAMorPMaccording to the given time value, or the corresponding strings for the current locale. Noon is treated aspmand midnight asam. Note that in many locales apmnotation is unsupported and in such cases%pwill return an empty string. π%sβ the second as a decimal number (range00to61).%Sβ the seconds since the epoch (1.1.1970) (libc dependent non standard!). π%Uβ the week number of the current year as a decimal number, range00to53, starting with the first Sunday as the first day of week01. See also%Vand%W.%Vβ the ISO 8601:1988 week number of the current year as a decimal number, range01to53, where week1is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also%Uand%W.%wβ the day of the week as a decimal, range0to6, Sunday being0. See also%u.%Wβ the week number of the current year as a decimal number, range00to53, starting with the first Monday as the first day of week01.%xβ the preferred date representation for the current locale without the time.%Xβ the preferred time representation for the current locale without the date.%yβ the year as a decimal number without a century (range00to99).%Yβ the year as a decimal number including the century.%Zβ the time zone or name or abbreviation.%%β a literal%character.
π Durations, aka valstrfduration π
You can format values as a duration using :valstrfduration, with the value being interpreted as milliseconds. Using printf-like conversion specifications, you can extract properties from the duration:
- All non-conversion specification chars are copied unchanged
- A conversion specification has format
'%' [ ['0'] minwidth ] [ '.' precision ] conversion-specifier
With conversion-specifier being one of:
%β a raw%is output, width and precision are ignoredWβ number of weeksdβ number of days, modulus number of weeksDβ number of dayshβ number of hours, modulus number of daysHβ number of hoursmβ number of minutes, modulus number of hoursMβ number of minutessβ number of seconds, modulus number of minutesSβ number of secondsfβ number of milliseconds, modulus seconds
π§ the deprecated one π§
PRINT:vname:CF:format
Deprecated. Use the new form of this command in new scripts. The first form of this command is to be used with CDEF vnames. (We're not mad, we're just disappointed. π)
π GRAPH π
GPRINT:vname:format
This is literally the same as PRINT, but printed inside the graph. β¨
GPRINT:vname:CF:format
Deprecated. Use the new form of this command in new scripts. This is the same as PRINT, but printed inside the graph.
COMMENT:text
Text is printed literally in the legend section of the graph. π Note that in RRDtool 1.2 you have to escape colons in COMMENT text in the same way you have to escape them in *PRINT commands, by writing '\:'.
VRULE:time#color[:[legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
Draw a vertical line at time. π― Its color is composed from three hexadecimal numbers specifying the rgb color components (00 is off, FF is maximum) red, green and blue, followed by an optional alpha. Optionally, a legend box and string get printed in the legend section. time may be a number or a variable from a VDEF. It is an error to use vnames from DEF or CDEF here. Dashed lines can be drawn using the dashes modifier β see LINE for more details. π
HRULE:value#color[:[legend][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
Draw a horizontal line at value. HRULE acts much like LINE except that it will have no effect on the scale of the graph. If an HRULE is outside the graphing area, it just won't be visible, and it will not appear in the legend by default. π
LINE[width]:value[#color][:[legend][:STACK][:skipscale][:dashes[=on_s[,off_s[,on_s,off_s]...]][:dash-offset=offset]]]
Draw a line of the specified width onto the graph. width can be a floating point number. If the color is not specified, the drawing is done 'invisibly' β which is genuinely so useful when you're stacking something else on top of this line. π Also optional is the legend box and string, which gets printed in the legend section if specified. The value can be generated by DEF, VDEF, and CDEF.
If the optional STACK modifier is used, this line is stacked on top of the previous element β which can be a LINE or an AREA.
Normally the graphing function makes sure the entire LINE or AREA is visible in the chart, and the scaling of the chart will be modified accordingly if necessary. Any LINE or AREA can be excluded from this process by adding the option skipscale.
The dashes modifier enables dashed line style. Without any further options, a symmetric dashed line with a segment length of 5 pixels will be drawn. The dash pattern can be changed if the dashes= parameter is followed by either one value or an even number (1, 2, 4, 6, ...) of positive values. Each value provides the length of alternate on_s and off_s portions of the stroke. The dash-offset parameter specifies an offset into the pattern at which the stroke begins. π
When you do not specify a color, you cannot specify a legend. Should you want to useSTACK, use the"LINEx:<value>::STACK"form. (Yeah, that's the trick. You're welcome. π )
AREA:value[#color[#color2]][:[legend][:STACK][:skipscale][:gradheight=y]
See LINE, however the area between the x-axis and the line will be filled. πΈ
If color2 is specified, the area will be filled with a gradient. π¦
The gradheight parameter can create three different behaviors:
- If
gradheight > 0, then the gradient is a fixed height, starting at the line going down. - If
gradheight < 0, then the gradient starts at a fixed height above the x-axis, going down to the x-axis. - If
height == 0, then the gradient goes from the line to x-axis.
The default value for gradheight is 50.
TICK:vname#rrggbb[aa][:fraction[:legend]]
Plot a tick mark (a vertical line) for each value of vname that is non-zero and not *UNKNOWN*. The fraction argument specifies the length of the tick mark as a fraction of the y-axis; the default value is 0.1 (that's 10% of the axis, bestie). π Note that the color specification is not optional. The TICK marks normally start at the lower edge of the graphing area. If the fraction is negative, they start at the upper border of the graphing area.
SHIFT:vname:offset
Using this command, RRDtool will graph the following elements with the specified offset. For instance, you can specify an offset of (7*24*60*60 = ) 604'800 seconds to "look back" one week. π Make sure to tell the viewer of your graph you did this ... because otherwise they'll be so confused. As with the other graphing elements, you can specify a number or a variable here.
TEXTALIGN:{left|right|justified|center}
Labels are placed below the graph. When they overflow to the left, they wrap to the next line. By default, lines are justified left and right. The TEXTALIGN function lets you change this default. β This is a command and not an option, so you can change the default several times in your argument list. Iconic, honestly.
STACK:vname#color[:legend]
Deprecated. Use the STACK modifiers on the other commands instead! π
π§ Some notes on stacking π§
When stacking, an element is not placed above the X-axis but rather on top of the previous element. So like β there must be something to stack upon. π«Ά
You can use an invisible LINE or AREA to stack upon.
An unknown value makes the entire stack unknown from that moment on. Think about it: you don't know where to begin (the unknown value) and therefore you do not know where to end. π
If you want to make sure you'll be displaying a certain variable, make sure you never stack upon the unknown value. Use a CDEF instruction with IF and UN to do so. π
π NOTES on legend arguments π
Okay bestie, this is where legend strings get their whole main-character moment β escaping, alignment markers, and even Pango markup. Stay with me, itβs lowkey iconic. π β¨
π Escaping the colon π
So a colon ':' in a legend argument marks the end of the legend. If you want an actual ':' as part of the legend, you have to escape it with a backslash: '\:'. Important vibe check: lots of environments process backslashes themselves, so you may need to write two backslashes so that one actually gets passed onto rrd_graph. π
β¨ String Formatting β¨
The text printed below the actual graph can be formatted by appending special escape characters at the end of a text. Whenever one of those characters shows up, all pending text is pushed onto the graph according to the character you specified. π«Ά
Valid markers are:
\jβ justified\lβ left aligned\rβ right aligned\cβ centered
Thereβs an example showing how to use centered formatting in the next section. π
\n is a valid alias for \l, because incomplete parsing in earlier versions of RRDtool led to this behavior, and a number of people have been using it. No cap. πΈ
Normally there are two space characters inserted between every two items printed into the graph. The space following a string can be suppressed by putting a \g at the end of the string. The \g also ignores any space inside the string if it is at the very end of the string. This can be used in connection with %s to suppress empty unit strings. For example:
GPRINT:a:MAX:%lf%s\g
A special case is COMMENT:\s, which inserts some additional vertical space before placing the next row of legends. π
If you want left and right aligned legends on the same line, use COMMENT:\u to go one line back, like this:
COMMENT:left\l
COMMENT:\u
COMMENT:right\r
There is also a 'nop' control for situations where you want a string to actually end in a backslash character sequence \.. Like this:
COMMENT:OS\2\.
When using a proportional font in your graph, the tab characters or the sequence \t will line-up legend elements. Note that the tabs inserted are relative to the start of the current legend element! π
Since RRDtool 1.3 is using Pango for text rendering, you can use Pango markup. Pango uses the XML span tags for inline formatting instructions. A simple example of a marked-up string might be:
<span foreground="blue" size="x-large">Blue text</span> is <i>cool</i>!
The complete list of attributes for the span tag (taken from the pango documentation) is:
font_descβ A font description string, such as"Sans Italic 12"; note that any other span attributes will override this description. So if you have"Sans Italic"and also astyle="normal"attribute, you will getSans normal, notitalic.font_familyβ A font family name.faceβ Synonym forfont_family.sizeβ Font size in 1024ths of a point, or one of the absolute sizes'xx-small','x-small','small','medium','large','x-large','xx-large', or one of the relative sizes'smaller'or'larger'. If you want to specify an absolute size, itβs usually easier to take advantage of the ability to specify a partial font description using'font_desc'; you can usefont_desc='12.5'rather thansize='12800'. πstyleβ One of'normal','oblique','italic'.weightβ One of'ultralight','light','normal','bold','ultrabold','heavy', or a numeric weight.variantβ'normal'or'smallcaps'.stretchβ One of'ultracondensed','extracondensed','condensed','semicondensed','normal','semiexpanded','expanded','extraexpanded','ultraexpanded'.foregroundβ An RGB color specification such as'#00FF00'or a color name such as'red'.backgroundβ An RGB color specification such as'#00FF00'or a color name such as'red'.underlineβ One of'none','single','double','low','error'.underline_colorβ The color of underlines; an RGB color specification such as'#00FF00'or a color name such as'red'.riseβ Vertical displacement, in 10000ths of an em. Can be negative for subscript, positive for superscript.strikethroughβ'true'or'false'whether to strike through the text.strikethrough_colorβ The color of crossed out lines; an RGB color specification such as'#00FF00'or a color name such as'red'.fallbackβ'true'or'false'whether to enable fallback. If disabled, then characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text. Fallback is enabled by default. Most applications should not disable fallback.langβ A language code, indicating the text language.letter_spacingβ Inter-letter spacing in 1024ths of a point.gravityβ One of'south','east','north','west','auto'.gravity_hintβ One of'natural','strong','line'.
To save you some typing, there are also some shortcuts:
bβ Bold.bigβ Makes font relatively larger, equivalent to<span size="larger">.iβ Italic.sβ Strike through.subβ Subscript.supβ Superscript.smallβ Makes font relatively smaller, equivalent to<span size="smaller">.ttβ Monospace font.uβ Underline.
π SEE ALSO π
rrdgraphgives an overview of howrrdtool graphworks.rrdgraph_datadescribesDEF,CDEFandVDEFin detail.rrdgraph_rpndescribes the RPN language used in the?DEFstatements.rrdgraph_graphpage describes all of the graph and print functions.- Make sure to read
rrdgraph_examplesfortips&tricks. π«Ά
π AUTHOR π
- Program by Tobias Oetiker
<tobi@oetiker.ch> - This manual page by Alex van den Bogaerdt
<alex@vandenbogaerdt.nl>with corrections and/or additions by several people
Thatβs the whole page, bestie β the footer says version 1.11.0, dated 2026-10-17, and it belongs to RRDGRAPH_GRAPH(1). Slay. π
β¨
π¦ where this page comes from
- arch rolling: rrdtool 1.11.0-2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms