aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type
diff options
context:
space:
mode:
authorPim van den Berg2014-06-24 12:38:10 +0200
committerPim van den Berg2014-06-24 12:44:37 +0200
commitd21f4a765b82e4c02ff15bf730b0e1f0d68d5471 (patch)
tree567b1cb3fdbfb8b5ea33704ee8c665f4494647af /type
parentplugin/tcpconns: fix missing port number in rrd title (diff)
downloadapt-panopticon_cgp-d21f4a765b82e4c02ff15bf730b0e1f0d68d5471.zip
apt-panopticon_cgp-d21f4a765b82e4c02ff15bf730b0e1f0d68d5471.tar.gz
apt-panopticon_cgp-d21f4a765b82e4c02ff15bf730b0e1f0d68d5471.tar.bz2
apt-panopticon_cgp-d21f4a765b82e4c02ff15bf730b0e1f0d68d5471.tar.xz
add percentile support to network traffic graphs
Set $CONFIG['percentile'] to a number and a XXth percentile line + legend will be added to all network traffic (if_octets) graphs. Closes #81
Diffstat (limited to 'type')
-rw-r--r--type/Base.class.php1
-rw-r--r--type/GenericIO.class.php11
2 files changed, 12 insertions, 0 deletions
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}