aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPim van den Berg2012-08-10 18:56:30 +0200
committerPim van den Berg2012-08-10 19:00:16 +0200
commitfd04134830d3111c137b47c7ba25a049ab597715 (patch)
treec2390f06640f2127ab3e987cd3bdaf1d639b3dc2
parenttype: add scale support to default/generic stacked types (diff)
downloadapt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.zip
apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.gz
apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.bz2
apt-panopticon_cgp-fd04134830d3111c137b47c7ba25a049ab597715.tar.xz
introduce config option datasize to show graphs in bits or bytes
Config setting $CONFIG['datasize'] can be set to bits or bytes to show graph data in bits or bytes. Inspired-by: Neptune Ning (Plan) <frostyplanet@gmail.com>
-rw-r--r--conf/config.php3
-rw-r--r--plugin/apache.php5
-rw-r--r--plugin/df.php5
-rw-r--r--plugin/disk.php3
-rw-r--r--plugin/filecount.php3
-rw-r--r--plugin/interface.php3
-rw-r--r--plugin/libvirt.php6
-rw-r--r--plugin/memcached.php6
-rw-r--r--plugin/memory.php3
-rw-r--r--plugin/netlink.php3
-rw-r--r--plugin/postgresql.php3
-rw-r--r--plugin/processes.php18
-rw-r--r--plugin/swap.php3
-rw-r--r--plugin/vserver.php6
-rw-r--r--plugin/zfs_arc.php11
15 files changed, 54 insertions, 27 deletions
diff --git a/conf/config.php b/conf/config.php
index 781172d..c6fce92 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -25,6 +25,9 @@ $CONFIG['time_range']['uptime'] = 31536000;
25# show load averages on overview page 25# show load averages on overview page
26$CONFIG['showload'] = true; 26$CONFIG['showload'] = true;
27 27
28# show graphs in bits or bytes
29$CONFIG['datasize'] = 'bytes';
30
28# browser cache time for the graphs (in seconds) 31# browser cache time for the graphs (in seconds)
29$CONFIG['cache'] = 90; 32$CONFIG['cache'] = 90;
30 33
diff --git a/plugin/apache.php b/plugin/apache.php
index 95c12fa..71be4fe 100644
--- a/plugin/apache.php
+++ b/plugin/apache.php
@@ -19,14 +19,15 @@ switch ($obj->args['type']) {
19 case 'apache_bytes': 19 case 'apache_bytes':
20 $obj->data_sources = array('value'); 20 $obj->data_sources = array('value');
21 $obj->ds_names = array( 21 $obj->ds_names = array(
22 'value' => 'Bytes/s', 22 'value' => sprintf('%s/s', ucfirst($CONFIG['datasize'])),
23 ); 23 );
24 $obj->colors = array( 24 $obj->colors = array(
25 'value' => '0000ff', 25 'value' => '0000ff',
26 ); 26 );
27 $obj->rrd_title = sprintf('Webserver Traffic%s', 27 $obj->rrd_title = sprintf('Webserver Traffic%s',
28 !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); 28 !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
29 $obj->rrd_vertical = 'Bytes/s'; 29 $obj->rrd_vertical = sprintf('%s/s', ucfirst($CONFIG['datasize']));
30 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
30 break; 31 break;
31 case 'apache_connections': 32 case 'apache_connections':
32 $obj->data_sources = array('value'); 33 $obj->data_sources = array('value');
diff --git a/plugin/df.php b/plugin/df.php
index b5c7e73..33dded9 100644
--- a/plugin/df.php
+++ b/plugin/df.php
@@ -29,8 +29,9 @@ $obj->width = $width;
29$obj->heigth = $heigth; 29$obj->heigth = $heigth;
30 30
31$obj->rrd_title = sprintf('Free space (%s)', $obj->args['pinstance']); 31$obj->rrd_title = sprintf('Free space (%s)', $obj->args['pinstance']);
32$obj->rrd_vertical = 'Bytes'; 32$obj->rrd_vertical = ucfirst($CONFIG['datasize']);
33$obj->rrd_format = '%5.1lf%sB'; 33$obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
34$obj->rrd_format = '%5.1lf%s';
34 35
35# backwards compatibility 36# backwards compatibility
36if ($CONFIG['version'] < 5) { 37if ($CONFIG['version'] < 5) {
diff --git a/plugin/disk.php b/plugin/disk.php
index e3a5f3d..a776abd 100644
--- a/plugin/disk.php
+++ b/plugin/disk.php
@@ -33,8 +33,9 @@ switch($obj->args['type']) {
33 break; 33 break;
34 case 'disk_octets': 34 case 'disk_octets':
35 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); 35 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']);
36 $obj->rrd_vertical = 'Bytes per second'; 36 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
37 $obj->rrd_format = '%5.1lf%s'; 37 $obj->rrd_format = '%5.1lf%s';
38 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
38 break; 39 break;
39 case 'disk_ops': 40 case 'disk_ops':
40 $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']); 41 $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']);
diff --git a/plugin/filecount.php b/plugin/filecount.php
index 2c318a9..68545e7 100644
--- a/plugin/filecount.php
+++ b/plugin/filecount.php
@@ -23,7 +23,8 @@ switch($obj->args['type']) {
23 $obj->ds_names = array('value' => 'Size'); 23 $obj->ds_names = array('value' => 'Size');
24 $obj->colors = array('value' => '0000ff'); 24 $obj->colors = array('value' => '0000ff');
25 $obj->rrd_title = sprintf('Filecount: size (%s)', $obj->args['pinstance']); 25 $obj->rrd_title = sprintf('Filecount: size (%s)', $obj->args['pinstance']);
26 $obj->rrd_vertical = 'Bytes'; 26 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
27 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
27 break; 28 break;
28 case 'files': 29 case 'files':
29 $obj->ds_names = array('value' => 'Files'); 30 $obj->ds_names = array('value' => 'Files');
diff --git a/plugin/interface.php b/plugin/interface.php
index f200813..107cb27 100644
--- a/plugin/interface.php
+++ b/plugin/interface.php
@@ -39,7 +39,8 @@ switch($obj->args['type']) {
39 break; 39 break;
40 case 'if_octets': 40 case 'if_octets':
41 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args[$instance]); 41 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args[$instance]);
42 $obj->rrd_vertical = 'Bytes per second'; 42 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
43 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
43 break; 44 break;
44 case 'if_packets': 45 case 'if_packets':
45 $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args[$instance]); 46 $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args[$instance]);
diff --git a/plugin/libvirt.php b/plugin/libvirt.php
index 829c592..971b5a7 100644
--- a/plugin/libvirt.php
+++ b/plugin/libvirt.php
@@ -30,7 +30,8 @@ switch($obj->args['type']) {
30 'write' => '00b000', 30 'write' => '00b000',
31 ); 31 );
32 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['tinstance']); 32 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['tinstance']);
33 $obj->rrd_vertical = 'Bytes per second'; 33 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
34 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
34 $obj->rrd_format = '%5.1lf%s'; 35 $obj->rrd_format = '%5.1lf%s';
35 break; 36 break;
36 case 'disk_ops': 37 case 'disk_ops':
@@ -84,7 +85,8 @@ switch($obj->args['type']) {
84 'tx' => '00b000', 85 'tx' => '00b000',
85 ); 86 );
86 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); 87 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']);
87 $obj->rrd_vertical = 'Bytes per second'; 88 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
89 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
88 break; 90 break;
89 case 'if_packets': 91 case 'if_packets':
90 $obj->data_sources = array('rx', 'tx'); 92 $obj->data_sources = array('rx', 'tx');
diff --git a/plugin/memcached.php b/plugin/memcached.php
index e011c9e..accf6b3 100644
--- a/plugin/memcached.php
+++ b/plugin/memcached.php
@@ -37,7 +37,8 @@ switch(GET('t')) {
37 'free' => '0000ff', 37 'free' => '0000ff',
38 ); 38 );
39 $obj->rrd_title = 'Memcached Memory Usage'; 39 $obj->rrd_title = 'Memcached Memory Usage';
40 $obj->rrd_vertical = 'bytes'; 40 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
41 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
41 break; 42 break;
42 43
43# memcached_command-(flush|get|set).rrd 44# memcached_command-(flush|get|set).rrd
@@ -104,7 +105,8 @@ switch(GET('t')) {
104 'tx' => '00b000', 105 'tx' => '00b000',
105 ); 106 );
106 $obj->rrd_title = 'Memcached Network Traffic'; 107 $obj->rrd_title = 'Memcached Network Traffic';
107 $obj->rrd_vertical = 'Bytes'; 108 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
109 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
108 break; 110 break;
109# memcached_ops-(evictions|hits|misses).rrd 111# memcached_ops-(evictions|hits|misses).rrd
110 case 'memcached_ops': 112 case 'memcached_ops':
diff --git a/plugin/memory.php b/plugin/memory.php
index 14779e2..afccc55 100644
--- a/plugin/memory.php
+++ b/plugin/memory.php
@@ -33,7 +33,8 @@ $obj->width = $width;
33$obj->heigth = $heigth; 33$obj->heigth = $heigth;
34 34
35$obj->rrd_title = 'Physical memory utilization'; 35$obj->rrd_title = 'Physical memory utilization';
36$obj->rrd_vertical = 'Bytes'; 36$obj->rrd_vertical = ucfirst($CONFIG['datasize']);
37$obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
37$obj->rrd_format = '%5.1lf%s'; 38$obj->rrd_format = '%5.1lf%s';
38 39
39collectd_flush($obj->identifiers); 40collectd_flush($obj->identifiers);
diff --git a/plugin/netlink.php b/plugin/netlink.php
index 423775d..77c0c48 100644
--- a/plugin/netlink.php
+++ b/plugin/netlink.php
@@ -64,7 +64,8 @@ switch($obj->args['type']) {
64 'tx' => '00b000', 64 'tx' => '00b000',
65 ); 65 );
66 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['pinstance']); 66 $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['pinstance']);
67 $obj->rrd_vertical = 'Bytes/s'; 67 $obj->rrd_vertical = sprintf('%s/s', ucfirst($CONFIG['datasize']));
68 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
68 break; 69 break;
69 case 'if_packets': 70 case 'if_packets':
70 $obj->data_sources = array('rx', 'tx'); 71 $obj->data_sources = array('rx', 'tx');
diff --git a/plugin/postgresql.php b/plugin/postgresql.php
index 1eadc8d..ed984a6 100644
--- a/plugin/postgresql.php
+++ b/plugin/postgresql.php
@@ -51,7 +51,8 @@ switch($obj->args['type']) {
51 ); 51 );
52 $obj->rrd_title = sprintf('PostgreSQL DB size (%s)', 52 $obj->rrd_title = sprintf('PostgreSQL DB size (%s)',
53 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : ''); 53 !empty($obj->args['pinstance']) ? $obj->args['pinstance'] : '');
54 $obj->rrd_vertical = 'Bytes'; 54 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
55 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
55 break; 56 break;
56 case 'pg_n_tup_c': 57 case 'pg_n_tup_c':
57 $obj->order = array( 58 $obj->order = array(
diff --git a/plugin/processes.php b/plugin/processes.php
index dca00b7..c66d3fb 100644
--- a/plugin/processes.php
+++ b/plugin/processes.php
@@ -63,7 +63,8 @@ switch($obj->args['type'])
63 'value' => '0000ff', 63 'value' => '0000ff',
64 ); 64 );
65 $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']); 65 $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']);
66 $obj->rrd_vertical = 'Bytes'; 66 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
67 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
67 break; 68 break;
68 69
69 case 'ps_count': 70 case 'ps_count':
@@ -105,7 +106,8 @@ switch($obj->args['type'])
105 'write' => '00b000', 106 'write' => '00b000',
106 ); 107 );
107 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); 108 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']);
108 $obj->rrd_vertical = 'Bytes per second'; 109 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
110 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
109 break; 111 break;
110 112
111 case 'ps_disk_ops': 113 case 'ps_disk_ops':
@@ -130,7 +132,8 @@ switch($obj->args['type'])
130 'value' => '0000ff', 132 'value' => '0000ff',
131 ); 133 );
132 $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']); 134 $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']);
133 $obj->rrd_vertical = 'Bytes'; 135 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
136 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
134 break; 137 break;
135 138
136 case 'ps_pagefaults': 139 case 'ps_pagefaults':
@@ -155,7 +158,8 @@ switch($obj->args['type'])
155 'value' => '0000ff', 158 'value' => '0000ff',
156 ); 159 );
157 $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']); 160 $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']);
158 $obj->rrd_vertical = 'Bytes'; 161 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
162 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
159 break; 163 break;
160 164
161 case 'ps_stacksize': 165 case 'ps_stacksize':
@@ -166,7 +170,8 @@ switch($obj->args['type'])
166 'value' => '0000ff', 170 'value' => '0000ff',
167 ); 171 );
168 $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']); 172 $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']);
169 $obj->rrd_vertical = 'Bytes'; 173 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
174 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
170 break; 175 break;
171 176
172 case 'ps_vm': 177 case 'ps_vm':
@@ -177,7 +182,8 @@ switch($obj->args['type'])
177 'value' => '0000ff', 182 'value' => '0000ff',
178 ); 183 );
179 $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']); 184 $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']);
180 $obj->rrd_vertical = 'Bytes'; 185 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
186 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
181 break; 187 break;
182 188
183} 189}
diff --git a/plugin/swap.php b/plugin/swap.php
index c24d90b..dee5692 100644
--- a/plugin/swap.php
+++ b/plugin/swap.php
@@ -27,7 +27,8 @@ switch(GET('t')) {
27 'used' => 'ff0000', 27 'used' => 'ff0000',
28 ); 28 );
29 $obj->rrd_title = 'Swap utilization'; 29 $obj->rrd_title = 'Swap utilization';
30 $obj->rrd_vertical = 'Bytes'; 30 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
31 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
31 break; 32 break;
32 case 'swap_io': 33 case 'swap_io':
33 require_once 'type/GenericIO.class.php'; 34 require_once 'type/GenericIO.class.php';
diff --git a/plugin/vserver.php b/plugin/vserver.php
index 57687e3..e51d97d 100644
--- a/plugin/vserver.php
+++ b/plugin/vserver.php
@@ -51,7 +51,8 @@ switch($obj->args['type']) {
51 $obj->heigth = $heigth; 51 $obj->heigth = $heigth;
52 52
53 $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']); 53 $obj->rrd_title = sprintf('Memory utilization on Vserver %s', $obj->args['pinstance']);
54 $obj->rrd_vertical = 'Bytes'; 54 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
55 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
55 $obj->rrd_format = '%5.1lf%s'; 56 $obj->rrd_format = '%5.1lf%s';
56 57
57 collectd_flush($obj->identifiers); 58 collectd_flush($obj->identifiers);
@@ -104,7 +105,8 @@ switch($obj->args['type']) {
104 'unspec-tx' => '000080', 105 'unspec-tx' => '000080',
105 ); 106 );
106 $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']); 107 $obj->rrd_title = sprintf('Traffic on Vserver %s', $obj->args['pinstance']);
107 $obj->rrd_vertical = 'Bytes per second'; 108 $obj->rrd_vertical = sprintf('%s per second', ucfirst($CONFIG['datasize']));
109 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
108 $obj->width = $width; 110 $obj->width = $width;
109 $obj->heigth = $heigth; 111 $obj->heigth = $heigth;
110 $obj->rrd_format = '%5.1lf%s'; 112 $obj->rrd_format = '%5.1lf%s';
diff --git a/plugin/zfs_arc.php b/plugin/zfs_arc.php
index d40912d..1cc7e81 100644
--- a/plugin/zfs_arc.php
+++ b/plugin/zfs_arc.php
@@ -60,7 +60,8 @@ switch($obj->args['type']) {
60 'maxlimit', 60 'maxlimit',
61 ); 61 );
62 $obj->rrd_title = 'Arc size'; 62 $obj->rrd_title = 'Arc size';
63 $obj->rrd_vertical = 'bytes'; 63 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
64 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
64 break; 65 break;
65 case 'arc_l2_bytes': 66 case 'arc_l2_bytes':
66 $obj->data_sources = array( 67 $obj->data_sources = array(
@@ -76,20 +77,22 @@ switch($obj->args['type']) {
76 'read' => '0000ff', 77 'read' => '0000ff',
77 ); 78 );
78 $obj->rrd_title = 'Arc L2 bytes'; 79 $obj->rrd_title = 'Arc L2 bytes';
79 $obj->rrd_vertical = 'bytes'; 80 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
81 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
80 break; 82 break;
81 case 'arc_l2_size': 83 case 'arc_l2_size':
82 $obj->data_sources = array( 84 $obj->data_sources = array(
83 'value', 85 'value',
84 ); 86 );
85 $obj->ds_names = array( 87 $obj->ds_names = array(
86 'value' => 'Bytes', 88 'value' => ucfirst($CONFIG['datasize']),
87 ); 89 );
88 $obj->colors = array( 90 $obj->colors = array(
89 'value' => '0000ff', 91 'value' => '0000ff',
90 ); 92 );
91 $obj->rrd_title = 'Arc L2 size'; 93 $obj->rrd_title = 'Arc L2 size';
92 $obj->rrd_vertical = 'bytes'; 94 $obj->rrd_vertical = ucfirst($CONFIG['datasize']);
95 $obj->scale = $CONFIG['datasize'] == 'bits' ? 8 : 1;
93 break; 96 break;
94 case 'arc_ratio': 97 case 'arc_ratio':
95 $obj->data_sources = array('value'); 98 $obj->data_sources = array('value');