Merge branch 'origin'
[php-utility-classes.git] / testbed / rrd / rrd-stat.php
... / ...
CommitLineData
1<?php
2date_default_timezone_set("Europe/Vienna");
3$myfile = $_SERVER['SCRIPT_FILENAME'];
4while (is_link($myfile)) { $myfile = readlink($myfile); }
5if (getcwd() != dirname($myfile)) {
6 // change to directory of the script if called from different directory
7 $orig_workingdir = getcwd();
8 chdir(dirname($myfile));
9}
10
11include_once('rrdstat.php-class');
12
13$rrd_config_file = 'rrd-config/'.php_uname('n').'.inc.php';
14if (!file_exists($rrd_config_file)) { $rrd_config_file = 'rrd-config.inc.php'; }
15include_once($rrd_config_file);
16
17// view stats
18$sname = isset($_GET['stat'])?$_GET['stat']:null;
19if (is_null($sname) || !strlen($sname)) { $sname = 'index'; }
20
21// call RRD module
22$rrds = new rrdstat($rrd_info, $sname);
23
24$psub = isset($_GET['sub'])?$_GET['sub']:null;
25print($rrds->page($psub));
26?>