aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--conf/config.php4
-rw-r--r--graph.php3
-rw-r--r--type/Base.class.php1
-rw-r--r--type/GenericIO.class.php11
4 files changed, 19 insertions, 0 deletions
diff --git a/conf/config.php b/conf/config.php
index b086455..3d54e26 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -55,6 +55,10 @@ $CONFIG['rrd_fetch_method'] = 'sync';
55# use the negative X-axis in I/O graphs 55# use the negative X-axis in I/O graphs
56$CONFIG['negative_io'] = false; 56$CONFIG['negative_io'] = false;
57 57
58# add XXth percentile line + legend to network graphs
59# false = disabled; 95 = 95th percentile
60$CONFIG['percentile'] = false;
61
58# create smooth graphs (rrdtool -E) 62# create smooth graphs (rrdtool -E)
59$CONFIG['graph_smooth'] = false; 63$CONFIG['graph_smooth'] = false;
60 64
diff --git a/graph.php b/graph.php
index 55be9e9..dadb2c5 100644
--- a/graph.php
+++ b/graph.php
@@ -92,6 +92,9 @@ if (isset($plugin_json[$type]['rrdtool_opts'])) {
92if (isset($plugin_json[$type]['datasize']) and $plugin_json[$type]['datasize']) 92if (isset($plugin_json[$type]['datasize']) and $plugin_json[$type]['datasize'])
93 $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1; 93 $obj->scale = $CONFIG['network_datasize'] == 'bits' ? 8 : 1;
94 94
95if ($type == 'if_octets')
96 $obj->percentile = $CONFIG['percentile'];
97
95if (isset($plugin_json[$type]['scale'])) 98if (isset($plugin_json[$type]['scale']))
96 $obj->scale = $plugin_json[$type]['scale']; 99 $obj->scale = $plugin_json[$type]['scale'];
97 100
diff --git a/type/Base.class.php b/type/Base.class.php
index 40f3df0..883c98f 100644
--- a/type/Base.class.php
+++ b/type/Base.class.php
@@ -22,6 +22,7 @@ class Type_Base {
22 var $height; 22 var $height;
23 var $graph_type; 23 var $graph_type;
24 var $negative_io; 24 var $negative_io;
25 var $percentile = false;
25 var $graph_smooth; 26 var $graph_smooth;
26 27
27 var $files; 28 var $files;
diff --git a/type/GenericIO.class.php b/type/GenericIO.class.php
index fac7034..a9d58cd 100644
--- a/type/GenericIO.class.php
+++ b/type/GenericIO.class.php
@@ -33,6 +33,8 @@ class Type_GenericIO extends Type_Base {
33 if ($i == 1) 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); 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)
37 $rrdgraph[] = sprintf('VDEF:pct_%1$s=avg_%1$s_raw,%2$s,PERCENT', crc32hex($sources[$i]), $this->percentile);
36 $i++; 38 $i++;
37 } 39 }
38 } 40 }
@@ -66,6 +68,15 @@ class Type_GenericIO extends Type_Base {
66 $i++; 68 $i++;
67 } 69 }
68 70
71 if ($this->percentile) {
72 $rrdgraph[] = sprintf('"COMMENT: \l"');
73 foreach($sources as $source) {
74 $legend = empty($this->legend[$source]) ? $source : $this->legend[$source];
75 $rrdgraph[] = sprintf('"HRULE:pct_%s#%s:%sth Percentile %s"', crc32hex($source), $this->get_faded_color($this->colors[$source], '000000', 0.6), $this->percentile, $this->rrd_escape($legend));
76 $rrdgraph[] = sprintf('"GPRINT:pct_%s:%s\l"', crc32hex($source), $this->rrd_format);
77 }
78 }
79
69 return $rrdgraph; 80 return $rrdgraph;
70 } 81 }
71} 82}