diff options
| -rw-r--r-- | type/Default.class.php | 19 | ||||
| -rw-r--r-- | type/GenericStacked.class.php | 19 |
2 files changed, 32 insertions, 6 deletions
diff --git a/type/Default.class.php b/type/Default.class.php index eaf2e8e..b8650dc 100644 --- a/type/Default.class.php +++ b/type/Default.class.php | |||
| @@ -235,15 +235,28 @@ class Type_Default { | |||
| 235 | 235 | ||
| 236 | $sources = $this->rrd_get_sources(); | 236 | $sources = $this->rrd_get_sources(); |
| 237 | 237 | ||
| 238 | if ($this->scale) | ||
| 239 | $raw = '_raw'; | ||
| 238 | $i=0; | 240 | $i=0; |
| 239 | foreach ($this->tinstances as $tinstance) { | 241 | foreach ($this->tinstances as $tinstance) { |
| 240 | foreach ($this->data_sources as $ds) { | 242 | foreach ($this->data_sources as $ds) { |
| 241 | $rrdgraph[] = sprintf('DEF:min_%s="%s":%s:MIN', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 243 | $rrdgraph[] = sprintf('DEF:min_%s%s="%s":%s:MIN', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 242 | $rrdgraph[] = sprintf('DEF:avg_%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 244 | $rrdgraph[] = sprintf('DEF:avg_%s%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 243 | $rrdgraph[] = sprintf('DEF:max_%s="%s":%s:MAX', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 245 | $rrdgraph[] = sprintf('DEF:max_%s%s="%s":%s:MAX', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 244 | $i++; | 246 | $i++; |
| 245 | } | 247 | } |
| 246 | } | 248 | } |
| 249 | if ($this->scale) { | ||
| 250 | $i=0; | ||
| 251 | foreach ($this->tinstances as $tinstance) { | ||
| 252 | foreach ($this->data_sources as $ds) { | ||
| 253 | $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 254 | $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 255 | $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 256 | $i++; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | } | ||
| 247 | 260 | ||
| 248 | if(count($this->files)<=1) { | 261 | if(count($this->files)<=1) { |
| 249 | $c = 0; | 262 | $c = 0; |
diff --git a/type/GenericStacked.class.php b/type/GenericStacked.class.php index f47af2a..d1da9ec 100644 --- a/type/GenericStacked.class.php +++ b/type/GenericStacked.class.php | |||
| @@ -9,15 +9,28 @@ class Type_GenericStacked extends Type_Default { | |||
| 9 | 9 | ||
| 10 | $sources = $this->rrd_get_sources(); | 10 | $sources = $this->rrd_get_sources(); |
| 11 | 11 | ||
| 12 | if ($this->scale) | ||
| 13 | $raw = '_raw'; | ||
| 12 | $i=0; | 14 | $i=0; |
| 13 | foreach ($this->tinstances as $tinstance) { | 15 | foreach ($this->tinstances as $tinstance) { |
| 14 | foreach ($this->data_sources as $ds) { | 16 | foreach ($this->data_sources as $ds) { |
| 15 | $rrdgraph[] = sprintf('DEF:min_%s="%s":%s:MIN', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 17 | $rrdgraph[] = sprintf('DEF:min_%s%s="%s":%s:MIN', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 16 | $rrdgraph[] = sprintf('DEF:avg_%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 18 | $rrdgraph[] = sprintf('DEF:avg_%s%s="%s":%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 17 | $rrdgraph[] = sprintf('DEF:max_%s="%s":%s:MAX', crc32hex($sources[$i]), $this->rrd_escape($this->files[$tinstance]), $ds); | 19 | $rrdgraph[] = sprintf('DEF:max_%s%s="%s":%s:MAX', crc32hex($sources[$i]), $raw, $this->rrd_escape($this->files[$tinstance]), $ds); |
| 18 | $i++; | 20 | $i++; |
| 19 | } | 21 | } |
| 20 | } | 22 | } |
| 23 | if ($this->scale) { | ||
| 24 | $i=0; | ||
| 25 | foreach ($this->tinstances as $tinstance) { | ||
| 26 | foreach ($this->data_sources as $ds) { | ||
| 27 | $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 28 | $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 29 | $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); | ||
| 30 | $i++; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
| 21 | 34 | ||
| 22 | for ($i=count($sources)-1 ; $i>=0 ; $i--) { | 35 | for ($i=count($sources)-1 ; $i>=0 ; $i--) { |
| 23 | if ($i == (count($sources)-1)) | 36 | if ($i == (count($sources)-1)) |
