diff options
author | Alex Hermann | 2018-02-16 16:05:08 +0100 |
---|---|---|
committer | Alex Hermann | 2018-02-16 16:05:08 +0100 |
commit | 4e5de2596870f49c2053fc1a86dc98aec68a1125 (patch) | |
tree | 2170f8d8f0554f3de7bfbffc1bb1f1abf5d643ab | |
parent | Merge pull request #156 from Arvur/master (diff) | |
download | apt-panopticon_cgp-4e5de2596870f49c2053fc1a86dc98aec68a1125.zip apt-panopticon_cgp-4e5de2596870f49c2053fc1a86dc98aec68a1125.tar.gz apt-panopticon_cgp-4e5de2596870f49c2053fc1a86dc98aec68a1125.tar.bz2 apt-panopticon_cgp-4e5de2596870f49c2053fc1a86dc98aec68a1125.tar.xz |
GenericIO: Fix negative_io for multiple instances
When multiple instances are in one graph, every odd source must be negated,
not just the first.
Diffstat (limited to '')
-rw-r--r-- | type/GenericIO.class.php | 10 |
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 | } |