1 RRDCGI(1) rrdtool RRDCGI(1)
6 rrdcgi - Create web pages containing RRD graphs based on templates
13 run as a cgi-program and parse a web page template containing special
15 the end it will printout a web page including the necessary CGI
16 headers.
19 looks only for a subset of tags. This allows nesting of tags.
21 The argument parser uses the same semantics as you are used from your
22 C-shell.
25 Assume that rrdcgi is run as a filter and not as a cgi.
29 Inserts the CGI variable of the given name.
32 Inserts the CGI variable of the given name but quotes it, ready
33 for use as an argument in another RRD:: tag. So even when there
34 are spaces in the value of the CGI variable it will still be
35 considered to be one argument.
38 Inserts the CGI variable of the given name, quotes it and makes
39 sure it starts neither with a '/' nor contains '..'. This is to
40 make sure that no problematic pathnames can be introduced
41 through the CGI interface.
44 Get the value of an environment variable.
46 <RRD::GETENV REMOTE_USER>
48 might give you the name of the remote user given you are using
49 some sort of access control on the directory.
52 Specify the number of seconds this page should remain valid.
53 This will prompt the rrdcgi to output a Last-Modified, an
55 header.
58 Include the contents of the specified file into the page
59 returned from the cgi.
62 If you want to present your graphs in another time zone than
63 your own, you could use
65 <RRD::SETENV TZ UTC>
67 to make sure everything is presented in Universal Time. Note
68 that the values permitted to TZ depend on your OS.
71 Analog to SETENV but for local variables.
74 Analog to GETENV but for local variables.
76 RRD::TIME::LAST _\br_\br_\bd_\b-_\bf_\bi_\bl_\be _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt
77 This gets replaced by the last modification time of the
79 specified in the second argument.
82 This gets replaced by the current time of day. The time is
85 Note that if you return : (colons) from your strftime format
86 you may have to escape them using \ if the time is to be used
87 as an argument to a GRAPH command.
89 RRD::TIME::STRFTIME _\bS_\bT_\bA_\bR_\bT_\b|_\bE_\bN_\bD _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc _\be_\bn_\bd_\b-_\bs_\bp_\be_\bc _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt
90 This gets replaced by a strftime-formatted time using the
91 format _\bs_\bt_\br_\bf_\bt_\bi_\bm_\be_\b-_\bf_\bo_\br_\bm_\ba_\bt on either _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc or _\be_\bn_\bd_\b-_\bs_\bp_\be_\bc
92 depending on whether _\bS_\bT_\bA_\bR_\bT or _\bE_\bN_\bD is specified. Both _\bs_\bt_\ba_\br_\bt_\b-
93 _\bs_\bp_\be_\bc and _\be_\bn_\bd_\b-_\bs_\bp_\be_\bc must be supplied as either could be relative
94 to the other. This is intended to allow pretty titles on
95 graphs with times that are easier for non RRDtool folks to
96 figure out than "-2weeks".
98 Note that again, if you return : (colon) from your strftime
99 format, you may have to escape them using \ if the time is to
100 be used as an argument to a GRAPH command.
103 This tag creates the RRD graph defined by its argument and then
104 is replaced by an appropriate <IMG ... > tag referring to the
106 that graphs are only regenerated when they are out of date. The
111 load on your server. This option makes sure that graphs are
112 only regenerated when the old ones are out of date.
115 will be used:
117 <IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu">
119 Note that %s stands for the filename part of the graph
120 generated, all directories given in the PNG file argument will
121 get dropped.
124 If the preceding R\bRR\bRD\bD:\b::\b:G\bGR\bRA\bAP\bPH\bH tag contained and P\bPR\bRI\bIN\bNT\bT arguments,
129 RRD::INTERNAL <var>
130 This tag gets replaced by an internal var. Currently these vars
131 are known: VERSION, COMPILETIME. These vars represent the
132 compiled-in values.
135 The example below creates a web pages with a single RRD graph.
137 #!/usr/local/bin/rrdcgi
138 <HTML>
139 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
140 <BODY>
141 <H1>RRDCGI Example Page</H1>
142 <P>
143 <RRD::GRAPH demo.png --lazy --title="Temperatures"
144 DEF:cel=demo.rrd:exhaust:AVERAGE
145 LINE2:cel#00a000:"D. Celsius">
147 </P>
148 </BODY>
149 </HTML>
152 This script is slightly more elaborate, it allows you to run it from a
153 form which sets RRD_NAME. RRD_NAME is then used to select which RRD you
154 want to use as source for your graph.
156 #!/usr/local/bin/rrdcgi
157 <HTML>
158 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
159 <BODY>
160 <H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
161 <H2>Selection</H2>
162 <FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
163 <INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
164 <INPUT TYPE=SUBMIT></FORM>
165 <H2>Graph</H2>
166 <P>
167 <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
168 --title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
169 DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
170 LINE2:cel#00a000:"D. Celsius">
172 </P>
173 </BODY>
174 </HTML>
177 This example shows how to handle the case where the RRD, graphs and
178 cgi-bins are separate directories
180 #!/.../bin/rrdcgi
181 <HTML>
182 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
183 <BODY>
184 <H1>RRDCGI test Page</H1>
185 <RRD::GRAPH
186 /.../web/pngs/testhvt.png
187 --imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
188 --lazy --start -1d --end now
189 DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
190 AREA:http_src#00ff00:http_src
191 >
192 </BODY>
193 </HTML>
195 Note 1: Replace /.../ with the relevant directories
197 Note 2: The SRC=/.../pngs should be paths from the view of the
198 webserver/browser
201 Tobias Oetiker <tobi@oetiker.ch>
205 1.4.2 2008-12-22 RRDCGI(1)