";
$g = new CPU_Graph();
$g->init(); $g->parseoptions();
$rrdtool = substr($g->get("rrdtool"), 0, strpos($g->get("rrdtool"), " "));
print $rrdtool;
if (!is_string($rrdtool)) {
exit("Internal error, class_graph does not set a default rrdtool location!");
} else {
if (!is_file($rrdtool)) {
exit("'$rrdtool' does not point to a file");
}
if (!is_executable($rrdtool)) {
exit("'$rrdtool' is not executable");
}
}
print "
rrdtool -v outputs:
";
passthru($rrdtool.' -v');
print "
";
// Test to see if we can find rrd files
print "Trying to find symon rrd files:
";
$root_dir = dir($symon2web["tree"]);
while ($machine = $root_dir->read()) {
if ($machine != '.' &&
$machine != '..' &&
is_dir($symon2web["tree"]."/".$machine)) {
$symon2web["machine"][$machine] = $symon2web["tree"]."/".$machine;
}
}
reset($symon2web["machine"]);
while (list($machine, $dir) = each($symon2web["machine"])) {
$readable = TRUE;
print 'machine('.$machine.')=
';
$machine_dir = dir($dir);
while ($filename = $machine_dir->read()) {
$file = $dir."/".$filename;
if (is_file($file) &&
preg_match("/^(cpu|if|io|mem|pf)(_([a-z]+))?([0-9]?).rrd$/",
$filename, $match)) {
print " $file";
if (!is_readable($file)) {
$readable = FALSE;
print "!";
}
print "
";
}
}
print "}
";
if ($readable == FALSE) {
print "Note that files tagged with an exclamation mark could not be read.
";
} else {
print "And all files accessable.
";
}
}
// Test to see if we can load rrd files
// Tie it all together
?>