mirror of
https://github.com/ntop/ntopng.git
synced 2026-07-28 09:08:08 +00:00
271 lines
9.9 KiB
HTML
271 lines
9.9 KiB
HTML
<?xml version="1.0" ?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>rrdcgi</title>
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
|
<link rev="made" href="mailto:root@localhost" />
|
|
</head>
|
|
|
|
<body style="background-color: white">
|
|
|
|
|
|
<!-- INDEX BEGIN -->
|
|
<div name="index">
|
|
<p><a name="__index__"></a></p>
|
|
<!--
|
|
|
|
<ul>
|
|
|
|
<li><a href="#name">NAME</a></li>
|
|
<li><a href="#synopsis">SYNOPSIS</a></li>
|
|
<li><a href="#description">DESCRIPTION</a></li>
|
|
<ul>
|
|
|
|
<li><a href="#keywords">Keywords</a></li>
|
|
</ul>
|
|
|
|
<li><a href="#example_1">EXAMPLE 1</a></li>
|
|
<li><a href="#example_2">EXAMPLE 2</a></li>
|
|
<li><a href="#example_3">EXAMPLE 3</a></li>
|
|
<li><a href="#author">AUTHOR</a></li>
|
|
</ul>
|
|
|
|
-->
|
|
|
|
|
|
</div>
|
|
<!-- INDEX END -->
|
|
|
|
<p>
|
|
</p>
|
|
<h1><a name="name">NAME</a></h1>
|
|
<p>rrdcgi - Create web pages containing RRD graphs based on templates</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="synopsis">SYNOPSIS</a></h1>
|
|
<p><code>#!/path/to/</code><strong>rrdcgi</strong> [<strong>--filter</strong>]</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="description">DESCRIPTION</a></h1>
|
|
<p><strong>rrdcgi</strong> is a sort of very limited script interpreter. Its purpose
|
|
is to run as a cgi-program and parse a web page template containing special
|
|
<RRD:: tags. <strong>rrdcgi</strong> will interpret and act according to these tags.
|
|
In the end it will printout a web page including the necessary CGI headers.</p>
|
|
<p><strong>rrdcgi</strong> parses the contents of the template in 3 steps. In each step it looks
|
|
only for a subset of tags. This allows nesting of tags.</p>
|
|
<p>The argument parser uses the same semantics as you are used from your C-shell.</p>
|
|
<dl>
|
|
<dt><strong><a name="filter" class="item"><strong>--filter</strong></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Assume that rrdcgi is run as a filter and not as a cgi.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<h2><a name="keywords">Keywords</a></h2>
|
|
<dl>
|
|
<dt><strong><a name="rrd_cv_name" class="item">RRD::CV <em>name</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Inserts the CGI variable of the given name.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_cv_quote_name" class="item">RRD::CV::QUOTE <em>name</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Inserts the CGI variable of the given name but quotes it, ready for
|
|
use as an argument in another RRD:: tag. So even when there are spaces in the
|
|
value of the CGI variable it will still be considered to be one argument.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_cv_path_name" class="item">RRD::CV::PATH <em>name</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Inserts the CGI variable of the given name, quotes it and makes sure
|
|
it starts neither with a '/' nor contains '..'. This is to make
|
|
sure that no problematic pathnames can be introduced through the
|
|
CGI interface.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_getenv_variable" class="item">RRD::GETENV <em>variable</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Get the value of an environment variable.</p>
|
|
<pre>
|
|
<RRD::GETENV REMOTE_USER></pre>
|
|
<p>might give you the name of the remote user given you are using
|
|
some sort of access control on the directory.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_goodfor_seconds" class="item">RRD::GOODFOR <em>seconds</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Specify the number of seconds this page should remain valid. This will prompt
|
|
the rrdcgi to output a Last-Modified, an Expire and if the number of
|
|
seconds is <em>negative</em> a Refresh header.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_include_filename" class="item">RRD::INCLUDE <em>filename</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Include the contents of the specified file into the page returned from the cgi.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_setenv_variable_value" class="item">RRD::SETENV <em>variable</em> <em>value</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>If you want to present your graphs in another time zone than your own, you
|
|
could use</p>
|
|
<pre>
|
|
<RRD::SETENV TZ UTC></pre>
|
|
<p>to make sure everything is presented in Universal Time. Note that the
|
|
values permitted to TZ depend on your OS.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_setvar_variable_value" class="item">RRD::SETVAR <em>variable</em> <em>value</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Analog to SETENV but for local variables.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_getvar_variable" class="item">RRD::GETVAR <em>variable</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>Analog to GETENV but for local variables.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_time_last_rrd_file_strftime_format" class="item">RRD::TIME::LAST <em>rrd-file</em> <em>strftime-format</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This gets replaced by the last modification time of the selected RRD. The
|
|
time is <em>strftime</em>-formatted with the string specified in the second argument.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_time_now_strftime_format" class="item">RRD::TIME::NOW <em>strftime-format</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This gets replaced by the current time of day. The time is
|
|
<em>strftime</em>-formatted with the string specified in the argument.</p>
|
|
<p>Note that if you return : (colons) from your strftime format you may
|
|
have to escape them using \ if the time is to be used as an argument
|
|
to a GRAPH command.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_time_strftime_start_end_start_spec_end_spec_strftime_format" class="item">RRD::TIME::STRFTIME <em>START|END</em> <em>start-spec</em> <em>end-spec</em> <em>strftime-format</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This gets replaced by a strftime-formatted time using the format
|
|
<em>strftime-format</em> on either <em>start-spec</em> or <em>end-spec</em> depending on
|
|
whether <em>START</em> or <em>END</em> is specified. Both <em>start-spec</em> and <em>end-spec</em>
|
|
must be supplied as either could be relative to the other. This is intended
|
|
to allow pretty titles on graphs with times that are easier for non RRDtool
|
|
folks to figure out than "-2weeks".</p>
|
|
<p>Note that again, if you return : (colon) from your strftime format,
|
|
you may have to escape them using \ if the time is to be used as an
|
|
argument to a GRAPH command.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_graph_rrdgraph_arguments" class="item">RRD::GRAPH <em>rrdgraph arguments</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This tag creates the RRD graph defined by its argument and then is
|
|
replaced by an appropriate <IMG ... > tag referring to the graph.
|
|
The <strong>--lazy</strong> option in RRD graph can be used to make sure that graphs
|
|
are only regenerated when they are out of date. The arguments
|
|
to the <strong>RRD::GRAPH</strong> tag work as described in the <strong>rrdgraph</strong> manual page.</p>
|
|
<p>Use the <strong>--lazy</strong> option in your RRD::GRAPH tags, to reduce the load
|
|
on your server. This option makes sure that graphs are only regenerated when
|
|
the old ones are out of date.</p>
|
|
<p>If you do not specify your own <strong>--imginfo</strong> format, the following will
|
|
be used:</p>
|
|
<pre>
|
|
<IMG SRC="%s" WIDTH="%lu" HEIGHT="%lu"></pre>
|
|
<p>Note that %s stands for the filename part of the graph generated, all
|
|
directories given in the PNG file argument will get dropped.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_print_number" class="item">RRD::PRINT <em>number</em></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>If the preceding <strong>RRD::GRAPH</strong> tag contained and <strong>PRINT</strong> arguments,
|
|
then you can access their output with this tag. The <em>number</em> argument refers to the
|
|
number of the <strong>PRINT</strong> argument. This first <strong>PRINT</strong> has <em>number</em> 0.</p>
|
|
</dd>
|
|
<dt><strong><a name="rrd_internal_var" class="item">RRD::INTERNAL <var></a></strong></dt>
|
|
|
|
<dd>
|
|
<p>This tag gets replaced by an internal var. Currently these vars are known:
|
|
VERSION, COMPILETIME.
|
|
These vars represent the compiled-in values.</p>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="example_1">EXAMPLE 1</a></h1>
|
|
<p>The example below creates a web pages with a single RRD graph.</p>
|
|
<pre>
|
|
#!/usr/local/bin/rrdcgi
|
|
<HTML>
|
|
<HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
|
|
<BODY>
|
|
<H1>RRDCGI Example Page</H1>
|
|
<P>
|
|
<RRD::GRAPH demo.png --lazy --title="Temperatures"
|
|
DEF:cel=demo.rrd:exhaust:AVERAGE
|
|
LINE2:cel#00a000:"D. Celsius"></pre>
|
|
<pre>
|
|
</P>
|
|
</BODY>
|
|
</HTML></pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="example_2">EXAMPLE 2</a></h1>
|
|
<p>This script is slightly more elaborate, it allows you to run it from
|
|
a form which sets RRD_NAME. RRD_NAME is then used to select which RRD
|
|
you want to use as source for your graph.</p>
|
|
<pre>
|
|
#!/usr/local/bin/rrdcgi
|
|
<HTML>
|
|
<HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
|
|
<BODY>
|
|
<H1>RRDCGI Example Page for <RRD::CV RRD_NAME></H1>
|
|
<H2>Selection</H2>
|
|
<FORM><INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomA> Room A,
|
|
<INPUT NAME=RRD_NAME TYPE=RADIO VALUE=roomB> Room B.
|
|
<INPUT TYPE=SUBMIT></FORM>
|
|
<H2>Graph</H2>
|
|
<P>
|
|
<RRD::GRAPH <RRD::CV::PATH RRD_NAME>.png --lazy
|
|
--title "Temperatures for "<RRD::CV::QUOTE RRD_NAME>
|
|
DEF:cel=<RRD::CV::PATH RRD_NAME>.rrd:exhaust:AVERAGE
|
|
LINE2:cel#00a000:"D. Celsius"></pre>
|
|
<pre>
|
|
</P>
|
|
</BODY>
|
|
</HTML></pre>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="example_3">EXAMPLE 3</a></h1>
|
|
<p>This example shows how to handle the case where the RRD, graphs and
|
|
cgi-bins are separate directories</p>
|
|
<pre>
|
|
#!/.../bin/rrdcgi
|
|
<HTML>
|
|
<HEAD><TITLE>RRDCGI Demo</TITLE></HEAD>
|
|
<BODY>
|
|
<H1>RRDCGI test Page</H1>
|
|
<RRD::GRAPH
|
|
/.../web/pngs/testhvt.png
|
|
--imginfo '<IMG SRC=/.../pngs/%s WIDTH=%lu HEIGHT=%lu >'
|
|
--lazy --start -1d --end now
|
|
DEF:http_src=/.../rrds/test.rrd:http_src:AVERAGE
|
|
AREA:http_src#00ff00:http_src
|
|
>
|
|
</BODY>
|
|
</HTML></pre>
|
|
<p>Note 1: Replace /.../ with the relevant directories</p>
|
|
<p>Note 2: The SRC=/.../pngs should be paths from the view of the
|
|
webserver/browser</p>
|
|
<p>
|
|
</p>
|
|
<hr />
|
|
<h1><a name="author">AUTHOR</a></h1>
|
|
<p>Tobias Oetiker <<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>></p>
|
|
|
|
</body>
|
|
|
|
</html>
|