aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2018-03-17 17:48:53 +0100
committerGitHub2018-03-17 17:48:53 +0100
commitf0d84d046dd74f4b55b6156747d2f4daba35efe4 (patch)
treea17060e6086bcefeb267c12f9f10a8479d6ec36b
parentMerge pull request #159 from gaaf/fixes (diff)
parentGenericIO: Fix negative_io for multiple instances (diff)
downloadapt-panopticon_cgp-f0d84d046dd74f4b55b6156747d2f4daba35efe4.zip
apt-panopticon_cgp-f0d84d046dd74f4b55b6156747d2f4daba35efe4.tar.gz
apt-panopticon_cgp-f0d84d046dd74f4b55b6156747d2f4daba35efe4.tar.bz2
apt-panopticon_cgp-f0d84d046dd74f4b55b6156747d2f4daba35efe4.tar.xz
Merge pull request #160 from gaaf/multi_neg_io
GenericIO: Fix negative_io for multiple instances
-rw-r--r--type/GenericIO.class.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/type/GenericIO.class.php b/type/GenericIO.class.php
index b22b6d0..5882e95 100644
--- a/type/GenericIO.class.php
+++ b/type/GenericIO.class.php
@@ -30,12 +30,12 @@ class Type_GenericIO extends Type_Base {
30 $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); 30 $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale);
31 $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); 31 $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale);
32 $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); 32 $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale);
33 if ($i == 1) 33 if ($i % 2 == 1)
34 $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); 34 $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale);
35 $rrdgraph[] = sprintf('VDEF:tot_%1$s=avg_%1$s,TOTAL', crc32hex($sources[$i])); 35 $rrdgraph[] = sprintf('VDEF:tot_%1$s=avg_%1$s,TOTAL', crc32hex($sources[$i]));
36 if ($this->percentile) 36 if ($this->percentile)
37 $rrdgraph[] = sprintf('VDEF:pct_%1$s=avg_%1$s,%2$s,PERCENT', crc32hex($sources[$i]), $this->percentile); 37 $rrdgraph[] = sprintf('VDEF:pct_%1$s=avg_%1$s,%2$s,PERCENT', crc32hex($sources[$i]), $this->percentile);
38 if ($this->percentile && $this->negative_io && $i == 1) 38 if ($this->percentile && $this->negative_io && $i % 2 == 1)
39 $rrdgraph[] = sprintf('VDEF:pct_%1$s_neg=avg_%1$s_neg,%2$s,PERCENT', crc32hex($sources[$i]), 100 - $this->percentile); 39 $rrdgraph[] = sprintf('VDEF:pct_%1$s_neg=avg_%1$s_neg,%2$s,PERCENT', crc32hex($sources[$i]), 100 - $this->percentile);
40 $i++; 40 $i++;
41 } 41 }
@@ -47,7 +47,7 @@ class Type_GenericIO extends Type_Base {
47 47
48 $i = 0; 48 $i = 0;
49 foreach($sources as $source) { 49 foreach($sources as $source) {
50 $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); 50 $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i % 2 == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source]));
51 $i++; 51 $i++;
52 } 52 }
53 53
@@ -63,7 +63,7 @@ class Type_GenericIO extends Type_Base {
63 $i = 0; 63 $i = 0;
64 foreach($sources as $source) { 64 foreach($sources as $source) {
65 $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; 65 $legend = empty($this->legend[$source]) ? $source : $this->legend[$source];
66 $rrdgraph[] = sprintf('LINE1:avg_%s%s#%s:%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($legend)); 66 $rrdgraph[] = sprintf('LINE1:avg_%s%s#%s:%s', crc32hex($source), $i % 2 == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($legend));
67 $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format); 67 $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format);
68 $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format); 68 $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format);
69 $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format); 69 $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format);
@@ -77,7 +77,7 @@ class Type_GenericIO extends Type_Base {
77 $i=0; 77 $i=0;
78 foreach($sources as $source) { 78 foreach($sources as $source) {
79 $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; 79 $legend = empty($this->legend[$source]) ? $source : $this->legend[$source];
80 $rrdgraph[] = sprintf('LINE:pct_%s%s#%s:%sth Percentile %s', crc32hex($source), ($i == 1 && $this->negative_io) ? '_neg' : '', $this->get_faded_color($this->colors[$source], '000000', 0.6), $this->percentile, $this->rrd_escape($legend)); 80 $rrdgraph[] = sprintf('LINE:pct_%s%s#%s:%sth Percentile %s', crc32hex($source), ($i % 2 == 1 && $this->negative_io) ? '_neg' : '', $this->get_faded_color($this->colors[$source], '000000', 0.6), $this->percentile, $this->rrd_escape($legend));
81 $rrdgraph[] = sprintf('GPRINT:pct_%s:%s\l', crc32hex($source), $this->rrd_format); 81 $rrdgraph[] = sprintf('GPRINT:pct_%s:%s\l', crc32hex($source), $this->rrd_format);
82 $i++; 82 $i++;
83 } 83 }