123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <html>
- <head>
- <title>Symon2Web configuration test</title>
- </head>
- <body>
- <?php
- // $Id: test_config.php,v 1.1 2002/11/29 10:45:46 dijkstra Exp $
- //
- // Test configuration variables
- require_once('datasources.inc');
- require_once('class_cpu.inc');
- require_once('class_if.inc');
- require_once('class_io.inc');
- require_once('class_mem.inc');
- require_once('class_pf.inc');
- // Test to see if we can find rrdtool
- // Test to see if we can run rrdtool
- print "Trying to find rrdtool:<b>";
- $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 "</b><br>rrdtool -v outputs:<hr><pre>";
- passthru($rrdtool.' -v');
- print "</pre><hr>";
- // Test to see if we can find rrd files
- print "Trying to find symon rrd files:<br>";
- $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 '<b>machine('.$machine.')=</b><br>';
- $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 "<br>";
- }
- }
- print "}<br>";
- if ($readable == FALSE) {
- print "Note that files tagged with an exclamation mark could not be read.<br><br>";
- } else {
- print "And all files accessable.<br><br>";
- }
- }
- // Test to see if we can load rrd files
- // Tie it all together
- ?>
- </body>
- </html>
|