2010-02-24 13:46:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function rrdtool_update($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
return rrdtool("update", $rrdfile, $rrdupdate);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool_create($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-31 10:51:02 +00:00
|
|
|
global $config, $debug;
|
2010-07-21 18:29:04 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
|
2010-07-21 18:29:04 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
if ($debug) { echo($command."\n"); }
|
2010-07-21 18:29:04 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
return shell_exec($command);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool_fetch($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
return rrdtool("fetch", $rrdfile, $rrdupdate);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool_graph($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
return rrdtool("graph", $rrdfile, $rrdupdate);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool_last($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
return rrdtool("last", $rrdfile, $rrdupdate);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool_lastupdate($rrdfile, $rrdupdate)
|
|
|
|
{
|
2011-03-23 09:54:56 +00:00
|
|
|
return rrdtool("lastupdate", $rrdfile, $rrdupdate);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function rrdtool($command, $file, $options)
|
|
|
|
{
|
2011-03-31 10:51:02 +00:00
|
|
|
global $config, $debug;
|
2010-07-04 21:09:22 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
$command = $config['rrdtool'] . " $command $file $options";
|
|
|
|
if ($config['rrdcached'])
|
|
|
|
{
|
|
|
|
$command .= " --daemon " . $config['rrdcached'];
|
|
|
|
}
|
2010-07-04 21:09:22 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
if ($debug) { echo($command."\n"); }
|
2011-03-31 10:51:02 +00:00
|
|
|
|
2011-03-23 09:54:56 +00:00
|
|
|
return shell_exec($command);
|
2010-02-24 13:46:12 +00:00
|
|
|
}
|
|
|
|
|
2011-03-31 10:51:02 +00:00
|
|
|
?>
|