X-Git-Url: https://git-public.kairo.at/?a=blobdiff_plain;f=include%2Fclasses%2Frrdstat.php-class;h=680516c136f8eb3594d9939534d79d5eeefb5db9;hb=abe8eac1a94e0a149ce6ff782deb11a840e5b125;hp=2fc1de17c7b02186a494e3fcab683a971bf4a949;hpb=f5e899dff253a61864949d7596252b2163920c2c;p=php-utility-classes.git diff --git a/include/classes/rrdstat.php-class b/include/classes/rrdstat.php-class index 2fc1de1..680516c 100644 --- a/include/classes/rrdstat.php-class +++ b/include/classes/rrdstat.php-class @@ -68,11 +68,15 @@ class rrdstat { $this->rrd_file = $iinfo['file']; $this->basename = (substr($this->rrd_file, -4) == '.rrd')?substr($this->rrd_file, 0, -4):$this->rrd_file; } + elseif (!is_null($conf_id) && file_exists($conf_id.'.rrd')) { + $this->rrd_file = $conf_id.'.rrd'; + $this->basename = $conf_id; + } else { $this->basename = !is_null($conf_id)?$conf_id:'xxx.unknown'; } - if (isset($iinfo['file'])) { + if (!is_null($this->rrd_file)) { // fields (data sources, DS) // name - DS name // type - one of COUNTER, GAUGE, DERIVE, ABSOLUTE @@ -312,7 +316,7 @@ class rrdstat { if (isset($gconf['path'])) { $fname = $gconf['path'].'/'.$fname; } $fname = str_replace('//', '/', $fname); - $graphrows = array(); $gC = 0; + $graphrows = array(); $specialrows = array(); $gC = 0; $gDefs = ''; $gGraphs = ''; $addSpecial = ''; if ($timeframe == 'day') { @@ -400,6 +404,10 @@ class rrdstat { } $grow['gType'] = ((count($this->rrd_fields)==2) && ($key==0))?'AREA':'LINE1'; $grow['color'] = $gColors[$gC++]; if ($gC >= count($gColors)) { $gC = 0; } + if (isset($ds['legend'])) { + $grow['legend'] = $ds['legend']; + if (!isset($gconf['show_legend'])) { $gconf['show_legend'] = true; } + } $graphrows[] = $grow; } }