diff options
| author | Pim van den Berg | 2013-05-18 17:38:07 +0200 |
|---|---|---|
| committer | Pim van den Berg | 2013-05-18 17:38:07 +0200 |
| commit | 28ec285069b9b3d4782be6a9e064556ba15b0391 (patch) | |
| tree | d0991fec5096f813a2a4e57c95ef4b503ab99e8a /type/GenericIO.class.php | |
| parent | .htaccess: enable gzip on rrd files (diff) | |
| download | apt-panopticon_cgp-28ec285069b9b3d4782be6a9e064556ba15b0391.zip apt-panopticon_cgp-28ec285069b9b3d4782be6a9e064556ba15b0391.tar.gz apt-panopticon_cgp-28ec285069b9b3d4782be6a9e064556ba15b0391.tar.bz2 apt-panopticon_cgp-28ec285069b9b3d4782be6a9e064556ba15b0391.tar.xz | |
add support for graphing I/O using the negative X-axis
Diffstat (limited to 'type/GenericIO.class.php')
| -rw-r--r-- | type/GenericIO.class.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/type/GenericIO.class.php b/type/GenericIO.class.php index 0cf3e22..3425f3e 100644 --- a/type/GenericIO.class.php +++ b/type/GenericIO.class.php | |||
| @@ -16,7 +16,7 @@ class Type_GenericIO extends Type_Default { | |||
| 16 | foreach ($this->tinstances as $tinstance) { | 16 | foreach ($this->tinstances as $tinstance) { |
| 17 | foreach ($this->data_sources as $ds) { | 17 | foreach ($this->data_sources as $ds) { |
| 18 | $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); | 18 | $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
| 19 | $rrdgraph[] = sprintf('DEF:avg_%s%s=%s:%s:AVERAGE', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); | 19 | $rrdgraph[] = sprintf('DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); |
| 20 | $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); | 20 | $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); |
| 21 | if (!$this->scale) | 21 | if (!$this->scale) |
| 22 | $rrdgraph[] = sprintf('VDEF:tot_%s=avg_%1$s,TOTAL', crc32hex($sources[$i])); | 22 | $rrdgraph[] = sprintf('VDEF:tot_%s=avg_%1$s,TOTAL', crc32hex($sources[$i])); |
| @@ -30,17 +30,21 @@ class Type_GenericIO extends Type_Default { | |||
| 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) | ||
| 34 | $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); | ||
| 33 | $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])); |
| 34 | $i++; | 36 | $i++; |
| 35 | } | 37 | } |
| 36 | } | 38 | } |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s,LT,avg_%1$s,avg_%2$s,IF', | 41 | $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s_neg,LT,avg_%1$s,avg_%2$s_neg,IF', |
| 40 | crc32hex($sources[0]), crc32hex($sources[1])); | 42 | crc32hex($sources[0]), crc32hex($sources[1])); |
| 41 | 43 | ||
| 44 | $i = 0; | ||
| 42 | foreach($sources as $source) { | 45 | foreach($sources as $source) { |
| 43 | $rrdgraph[] = sprintf('AREA:avg_%s#%s', crc32hex($source), $this->get_faded_color($this->colors[$source])); | 46 | $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); |
| 47 | $i++; | ||
| 44 | } | 48 | } |
| 45 | 49 | ||
| 46 | $rrdgraph[] = sprintf('AREA:overlap#%s', | 50 | $rrdgraph[] = sprintf('AREA:overlap#%s', |
| @@ -50,14 +54,16 @@ class Type_GenericIO extends Type_Default { | |||
| 50 | ) | 54 | ) |
| 51 | ); | 55 | ); |
| 52 | 56 | ||
| 57 | $i = 0; | ||
| 53 | foreach($sources as $source) { | 58 | foreach($sources as $source) { |
| 54 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; | 59 | $dsname = $this->ds_names[$source] != '' ? $this->ds_names[$source] : $source; |
| 55 | $rrdgraph[] = sprintf('"LINE1:avg_%s#%s:%s"', crc32hex($source), $this->colors[$source], $this->rrd_escape($dsname)); | 60 | $rrdgraph[] = sprintf('"LINE1:avg_%s%s#%s:%s"', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($dsname)); |
| 56 | $rrdgraph[] = sprintf('"GPRINT:min_%s:MIN:%s Min,"', crc32hex($source), $this->rrd_format); | 61 | $rrdgraph[] = sprintf('"GPRINT:min_%s:MIN:%s Min,"', crc32hex($source), $this->rrd_format); |
| 57 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:AVERAGE:%s Avg,"', crc32hex($source), $this->rrd_format); | 62 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:AVERAGE:%s Avg,"', crc32hex($source), $this->rrd_format); |
| 58 | $rrdgraph[] = sprintf('"GPRINT:max_%s:MAX:%s Max,"', crc32hex($source), $this->rrd_format); | 63 | $rrdgraph[] = sprintf('"GPRINT:max_%s:MAX:%s Max,"', crc32hex($source), $this->rrd_format); |
| 59 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:LAST:%s Last"', crc32hex($source), $this->rrd_format); | 64 | $rrdgraph[] = sprintf('"GPRINT:avg_%s:LAST:%s Last"', crc32hex($source), $this->rrd_format); |
| 60 | $rrdgraph[] = sprintf('"GPRINT:tot_%s:%s Total\l"',crc32hex($source), $this->rrd_format); | 65 | $rrdgraph[] = sprintf('"GPRINT:tot_%s:%s Total\l"',crc32hex($source), $this->rrd_format); |
| 66 | $i++; | ||
| 61 | } | 67 | } |
| 62 | 68 | ||
| 63 | return $rrdgraph; | 69 | return $rrdgraph; |
