diff options
author | Pim van den Berg | 2012-08-10 18:04:26 +0200 |
---|---|---|
committer | Pim van den Berg | 2012-08-10 18:04:26 +0200 |
commit | 318c07e097b7d72cac9b0a1ec5aa159bf7c206c3 (patch) | |
tree | 1505b0b708dd538b32e1995871c73f9f9abfa585 /type/Default.class.php | |
parent | type/GenericIO: only use raw totals when no scale is set (update) (diff) | |
download | apt-panopticon_cgp-318c07e097b7d72cac9b0a1ec5aa159bf7c206c3.zip apt-panopticon_cgp-318c07e097b7d72cac9b0a1ec5aa159bf7c206c3.tar.gz apt-panopticon_cgp-318c07e097b7d72cac9b0a1ec5aa159bf7c206c3.tar.bz2 apt-panopticon_cgp-318c07e097b7d72cac9b0a1ec5aa159bf7c206c3.tar.xz |
type: add scale support to default/generic stacked types
Diffstat (limited to 'type/Default.class.php')
-rw-r--r-- | type/Default.class.php | 19 |
1 files changed, 16 insertions, 3 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; |