diff options
Diffstat (limited to '')
-rw-r--r-- | conf/config.php | 3 | ||||
-rw-r--r-- | type/Default.class.php | 3 | ||||
-rw-r--r-- | type/GenericIO.class.php | 14 |
3 files changed, 15 insertions, 5 deletions
diff --git a/conf/config.php b/conf/config.php index 99190f1..c734b09 100644 --- a/conf/config.php +++ b/conf/config.php | |||
@@ -45,6 +45,9 @@ $CONFIG['network_datasize'] = 'bytes'; | |||
45 | # png or canvas graphs | 45 | # png or canvas graphs |
46 | $CONFIG['graph_type'] = 'png'; | 46 | $CONFIG['graph_type'] = 'png'; |
47 | 47 | ||
48 | # use the negative X-axis in I/O graphs | ||
49 | $CONFIG['negative_io'] = false; | ||
50 | |||
48 | # browser cache time for the graphs (in seconds) | 51 | # browser cache time for the graphs (in seconds) |
49 | $CONFIG['cache'] = 90; | 52 | $CONFIG['cache'] = 90; |
50 | 53 | ||
diff --git a/type/Default.class.php b/type/Default.class.php index c9220fa..0250d52 100644 --- a/type/Default.class.php +++ b/type/Default.class.php | |||
@@ -16,7 +16,7 @@ class Type_Default { | |||
16 | var $rrd_title; | 16 | var $rrd_title; |
17 | var $rrd_vertical; | 17 | var $rrd_vertical; |
18 | var $rrd_format; | 18 | var $rrd_format; |
19 | var $scale; | 19 | var $scale = 1; |
20 | var $width; | 20 | var $width; |
21 | var $heigth; | 21 | var $heigth; |
22 | 22 | ||
@@ -37,6 +37,7 @@ class Type_Default { | |||
37 | $this->heigth = GET('y'); | 37 | $this->heigth = GET('y'); |
38 | if (empty($this->heigth)) $this->heigth = $config['heigth']; | 38 | if (empty($this->heigth)) $this->heigth = $config['heigth']; |
39 | $this->graph_type = $config['graph_type']; | 39 | $this->graph_type = $config['graph_type']; |
40 | $this->negative_io = $config['negative_io']; | ||
40 | } | 41 | } |
41 | 42 | ||
42 | function rainbow_colors() { | 43 | function rainbow_colors() { |
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; |