diff options
-rw-r--r-- | conf/config.php | 4 | ||||
-rw-r--r-- | graph.php | 3 | ||||
-rw-r--r-- | plugin/lvm.json | 15 | ||||
-rw-r--r-- | type/Base.class.php | 1 | ||||
-rw-r--r-- | type/GenericIO.class.php | 11 |
5 files changed, 34 insertions, 0 deletions
diff --git a/conf/config.php b/conf/config.php index 223028d..e40cc9f 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 | ||
@@ -92,6 +92,9 @@ if (isset($plugin_json[$type]['rrdtool_opts'])) { | |||
92 | if (isset($plugin_json[$type]['datasize']) and $plugin_json[$type]['datasize']) | 92 | if (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 | ||
95 | if ($type == 'if_octets') | ||
96 | $obj->percentile = $CONFIG['percentile']; | ||
97 | |||
95 | if (isset($plugin_json[$type]['scale'])) | 98 | if (isset($plugin_json[$type]['scale'])) |
96 | $obj->scale = $plugin_json[$type]['scale']; | 99 | $obj->scale = $plugin_json[$type]['scale']; |
97 | 100 | ||
diff --git a/plugin/lvm.json b/plugin/lvm.json new file mode 100644 index 0000000..e19ff1c --- /dev/null +++ b/plugin/lvm.json | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | "df_complex": { | ||
3 | "title": "Logical volumes for {{PI}})", | ||
4 | "vertical": "Bytes", | ||
5 | "type": "stacked", | ||
6 | "legend": { | ||
7 | "free": { | ||
8 | "name": "Free", | ||
9 | "color": "00ff00" | ||
10 | } | ||
11 | }, | ||
12 | "legend_format": "%5.1lf%sB", | ||
13 | "base": "1024" | ||
14 | } | ||
15 | } | ||
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 | } |