2

さて、私はphpコードでrrdtoolを使用しようとしていますが、rrd_xportは認識しません.rrd_graphが機能するので、rrdコマンドはコードに完全に従っています:

  <?php
  $opts = array( "--start", "-1d", "--vertical-label=B/s",
                 "DEF:inoctets=net1.rrd:input:AVERAGE",
                 "DEF:outoctets=net1.rrd:output:AVERAGE",
                 "AREA:inoctets#00FF00:In traffic",
                 "LINE1:outoctets#0000FF:Out traffic\\r",
                 "CDEF:inbits=inoctets,8,*",
                 "CDEF:outbits=outoctets,8,*",
                 "COMMENT:\\n",
                 "GPRINT:inbits:AVERAGE:Avg In traffic\: %6.2lf %Sbps",
                 "COMMENT:  ",
                 "GPRINT:inbits:MAX:Max In traffic\: %6.2lf %Sbps\\r",
                 "GPRINT:outbits:AVERAGE:Avg Out traffic\: %6.2lf %Sbps",
                 "COMMENT: ",
                 "GPRINT:outbits:MAX:Max Out traffic\: %6.2lf %Sbps\\r"
               );
   $opts2 = array ("--json","--start", "1378750426", "--end", "N", 
           "DEF:myseepd=net1.rrd:input:AVERAGE",
           "XPORT:myspeed"                  
);  

  $ret = rrd_graph("net_1d.gif", $opts, count($opts));
  $js = rrd_xport($opts2);      

  if( !is_array($ret) )
  {
    $err = rrd_error();
    echo "rrd_graph() ERROR: $err\n";
  }
echo $js;
?>
4

1 に答える 1

8

これを試して :

$opts2 = Array(
    "--start", "1378750426",
    "--end", "now",
    "--json",
    "DEF:out=myspeed:net1.rrd:input:AVERAGE",
    "XPORT:out:\"myspeed\""
);

どうやら、他の誰かが問題を抱えていた:

PHP と rrd : rrd_xport 関数がエラーを返す

于 2013-10-07T05:33:50.513 に答える