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 head-
16 ers.
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.
31 Inserts the CGI variable of the given name.
34 Inserts the CGI variable of the given name but quotes it, ready
35 for use as an argument in another RRD:: tag. So even when there
36 are spaces in the value of the CGI variable it will still be
37 considered to be one argument.
40 Inserts the CGI variable of the given name, quotes it and makes
41 sure it starts neither with a '/' nor contains '..'. This is to
42 make sure that no problematic pathnames can be introduced
43 through the CGI interface.
46 Get the value of an environment variable.
48 <RRD::GETENV REMOTE_USER>
50 might give you the name of the remote user given you are using
51 some sort of access control on the directory.
54 Specify the number of seconds this page should remain valid.
55 This will prompt the rrdcgi to output a Last-Modified, an
57 header.
60 Include the contents of the specified file into the page
61 returned from the cgi.
64 If you want to present your graphs in another time zone than
65 your own, you could use
67 <RRD::SETENV TZ UTC>
69 to make sure everything is presented in Universal Time. Note
70 that the values permitted to TZ depend on your OS.
73 Analog to SETENV but for local variables.
76 Analog to GETENV but for local variables.
78 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
79 This gets replaced by the last modification time of the
81 specified in the second argument.
84 This gets replaced by the current time of day. The time is
87 Note that if you return : (colons) from your strftime format
88 you may have to escape them using \ if the time is to be used
89 as an argument to a GRAPH command.
91 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
92 This gets replaced by a strftime-formatted time using the for-
93 mat _\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 depending
94 on whether _\bS_\bT_\bA_\bR_\bT or _\bE_\bN_\bD is specified. Both _\bs_\bt_\ba_\br_\bt_\b-_\bs_\bp_\be_\bc and _\be_\bn_\bd_\b-
96 This is intended to allow pretty titles on graphs with times
97 that are easier for non RRDtool folks to figure out than
98 "-2weeks".
100 Note that again, if you return : (colon) from your strftime
101 format, you may have to escape them using \ if the time is to
102 be used as an argument to a GRAPH command.
105 This tag creates the RRD graph defined by its argument and then
106 is replaced by an appropriate <IMG ... > tag referring to the
108 that graphs are only regenerated when they are out of date. The
109 arguments to the R\bRR\bRD\bD:\b::\b:G\bGR\bRA\bAP\bPH\bH tag work as described in the r\brr\brd\bd-\b-
113 load on your server. This option makes sure that graphs are
114 only regenerated when the old ones are out of date.
117 will be used:
119 <IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu">
121 Note that %s stands for the filename part of the graph gener-
122 ated, all directories given in the PNG file argument will get
123 dropped.
126 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,
131 RRD::INTERNAL <var>
132 This tag gets replaced by an internal var. Currently these vars
133 are known: VERSION, COMPILETIME. These vars represent the
134 compiled-in values.
137 The example below creates a web pages with a single RRD graph.
139 #!/usr/local/bin/rrdcgi
140 <HTML>
141 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
142 <BODY>
143 <H1>RRDCGI Example Page</H1>
144 <P>
145 <RRD::GRAPH demo.png --lazy --title="Temperatures"
146 DEF:cel=demo.rrd:exhaust:AVERAGE
147 LINE2:cel#00a000:"D. Celsius">
149 </P>
150 </BODY>
151 </HTML>
154 This script is slightly more elaborate, it allows you to run it from a
155 form which sets RRD_NAME. RRD_NAME is then used to select which RRD you
156 want to use as source for your graph.
158 #!/usr/local/bin/rrdcgi
159 <HTML>
160 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
161 <BODY>
162 <H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
163 <H2>Selection</H2>
164 <FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
165 <INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
166 <INPUT TYPE=SUBMIT></FORM>
167 <H2>Graph</H2>
168 <P>
169 <RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
170 --title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
171 DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
172 LINE2:cel#00a000:"D. Celsius">
174 </P>
175 </BODY>
176 </HTML>
179 This example shows how to handle the case where the RRD, graphs and
180 cgi-bins are seperate directories
182 #!/.../bin/rrdcgi
183 <HTML>
184 <HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
185 <BODY>
186 <H1>RRDCGI test Page</H1>
187 <RRD::GRAPH
188 /.../web/pngs/testhvt.png
189 --imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
190 --lazy --start -1d --end now
191 DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
192 AREA:http_src#00ff00:http_src
193 >
194 </BODY>
195 </HTML>
197 Note 1: Replace /.../ with the relevant directories
199 Note 2: The SRC=/.../pngs should be paths from the view of the web-
200 server/browser
203 Tobias Oetiker <tobi@oetiker.ch>
207 1.3.1 2008-03-15 RRDCGI(1)