Files
librenms-librenms/includes/rrdtool.inc.php
T

55 lines
1.0 KiB
PHP
Raw Normal View History

<?php
function rrdtool_update($rrdfile, $rrdupdate)
{
return rrdtool("update", $rrdfile, $rrdupdate);
}
function rrdtool_create($rrdfile, $rrdupdate)
{
2010-07-21 18:29:04 +00:00
global $config; global $debug;
$command = $config['rrdtool'] . " create $rrdfile $rrdupdate";
2010-07-22 21:58:49 +00:00
if ($debug) { echo($command."\n"); }
2010-07-21 18:29:04 +00:00
return shell_exec($command);
}
function rrdtool_fetch($rrdfile, $rrdupdate)
{
return rrdtool("fetch", $rrdfile, $rrdupdate);
}
function rrdtool_graph($rrdfile, $rrdupdate)
{
return rrdtool("graph", $rrdfile, $rrdupdate);
}
function rrdtool_last($rrdfile, $rrdupdate)
{
return rrdtool("last", $rrdfile, $rrdupdate);
}
function rrdtool_lastupdate($rrdfile, $rrdupdate)
{
return rrdtool("lastupdate", $rrdfile, $rrdupdate);
}
function rrdtool($command, $file, $options)
{
global $config; global $debug;
2010-07-04 21:09:22 +00:00
$command = $config['rrdtool'] . " $command $file $options";
2011-03-15 15:41:57 +00:00
if ($config['rrdcached'])
2010-07-04 21:09:22 +00:00
{
$command .= " --daemon " . $config['rrdcached'];
}
2010-07-22 21:58:49 +00:00
if ($debug) { echo($command."\n"); }
2010-07-04 21:09:22 +00:00
return shell_exec($command);
}
?>