Code

if the perl bindings are to be installed together with rrdtool, make sure INSTALL_BAS...
[rrdtool-all.git] / contrib / php4 / examples / rrd_create.php
1 <?
3  ## the following line is only needed if built as a self-contained
4  ## extension.  If you build the rrdtool module as an embedded
5  ## extension, the rrd_* functions will always be available, so you
6  ## do not need the dl() call.
7  dl("rrdtool.so");
9  ##
10  ## demonstration of the rrd_create() command
11  ##
13   $_opts = array( "--step", "300", "--start", 0,
14                  "DS:input:COUNTER:900:0:U",
15                  "DS:output:COUNTER:900:0:U",
16                  "RRA:AVERAGE:0.5:1:1000",
17                  "RRA:MIN:0.5:1:1000",
18                  "RRA:MAX:0.5:1:1000"
19                );
21   $ret = rrd_create("/tmp/test.rrd", $_opts, count($_opts));
23   if ( $ret == 0 )
24   {
25       $err = rrd_error();
26       echo "Create error: $err\n";
27   }
28   /*  else rrd_create was successful  */
31 ?>