X-Git-Url: https://git-public.kairo.at/?p=php-utility-classes.git;a=blobdiff_plain;f=include%2Fclasses%2Frrdstat.php-class;h=68887290c9fbfc3e5c29c174f81b4f6fb9d5cebf;hp=dc9da65c2e08d6abfd6c1561ef43d05e5087454f;hb=b25db622aa67664942c2d4ebff284255570264d4;hpb=a039a75c12bdaa9c987c47f87ba0e54b4f431675;ds=sidebyside diff --git a/include/classes/rrdstat.php-class b/include/classes/rrdstat.php-class index dc9da65..6888729 100644 --- a/include/classes/rrdstat.php-class +++ b/include/classes/rrdstat.php-class @@ -2,7 +2,7 @@ // ************ RRD status class ************** class rrdstat { - var $rrd_file = 'sample.rrd'; + var $rrd_file = null; var $config_raw = null; var $config_graph = null; @@ -19,19 +19,21 @@ class rrdstat { // ***** init RRD stat module ***** $this->set_def($init_info); - if (!is_writeable($this->rrd_file)) { - if (!file_exists($this->rrd_file)) { - if (touch($this->rrd_file)) { $this->create(); } - else { trigger_error('RRD file can not be created', E_USER_WARNING); } + if (!is_null($this->rrd_file)) { + if (!is_writeable($this->rrd_file)) { + if (!file_exists($this->rrd_file)) { + if (touch($this->rrd_file)) { $this->create(); } + else { trigger_error('RRD file can not be created', E_USER_WARNING); } + } + else { + if (is_readable($this->rrd_file)) { $this->status = 'readonly'; } + else { trigger_error('RRD file is not readable', E_USER_WARNING); } + } } else { - if (is_readable($this->rrd_file)) { $this->status = 'readonly'; } - else { trigger_error('RRD file is not readable', E_USER_WARNING); } + $this->status = 'ok'; } } - else { - $this->status = 'ok'; - } } function set_def($init_info = null) { @@ -357,7 +359,7 @@ class rrdstat { if (strpos($return, 'ERROR') !== false) { trigger_error('rrd graph error: '.$return, E_USER_WARNING); - $return = $graph_cmd."\n\n".$return; +// $return = $graph_cmd."\n\n".$return; } return $return; } @@ -380,7 +382,7 @@ class rrdstat { if (in_array($this->status, array('ok','readonly'))) { foreach (array('day','week','month','year') as $tframe) { $ret = $this->graph($tframe, null, $graph_extras); - $out .= '

'.nl2br($ret).'

'; +// $out .= '

'.nl2br($ret).'

'; $out .= '

'; } }