aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorPim van den Berg2011-04-10 19:56:08 +0200
committerPim van den Berg2011-04-10 19:56:08 +0200
commit6bc103c0c6880673f207c87466f4fcac2645bd8c (patch)
tree829fa608416de0dea83b3c9c1689cb7077dfa943 /plugin
parentplugin: add tail plugin (diff)
downloadapt-panopticon_cgp-6bc103c0c6880673f207c87466f4fcac2645bd8c.zip
apt-panopticon_cgp-6bc103c0c6880673f207c87466f4fcac2645bd8c.tar.gz
apt-panopticon_cgp-6bc103c0c6880673f207c87466f4fcac2645bd8c.tar.bz2
apt-panopticon_cgp-6bc103c0c6880673f207c87466f4fcac2645bd8c.tar.xz
plugin: deduplicate rrd_format code
Diffstat (limited to 'plugin')
-rw-r--r--plugin/dns.php5
-rw-r--r--plugin/mysql.php7
-rw-r--r--plugin/ntpd.php6
-rw-r--r--plugin/ping.php5
-rw-r--r--plugin/processes.php13
-rw-r--r--plugin/vmem.php5
6 files changed, 10 insertions, 31 deletions
diff --git a/plugin/dns.php b/plugin/dns.php
index 15143b5..d0784df 100644
--- a/plugin/dns.php
+++ b/plugin/dns.php
@@ -15,6 +15,8 @@ require_once 'inc/collectd.inc.php';
15$obj = new Type_GenericStacked($CONFIG); 15$obj = new Type_GenericStacked($CONFIG);
16$obj->width = $width; 16$obj->width = $width;
17$obj->heigth = $heigth; 17$obj->heigth = $heigth;
18$obj->rrd_format = '%5.1lf%s';
19
18switch($obj->args['type']) { 20switch($obj->args['type']) {
19 case 'dns_octets': 21 case 'dns_octets':
20 $obj->data_sources = array( 22 $obj->data_sources = array(
@@ -31,19 +33,16 @@ switch($obj->args['type']) {
31 ); 33 );
32 $obj->rrd_title = 'DNS traffic'; 34 $obj->rrd_title = 'DNS traffic';
33 $obj->rrd_vertical = 'Bit/s'; 35 $obj->rrd_vertical = 'Bit/s';
34 $obj->rrd_format = '%5.1lf%s';
35 break; 36 break;
36 case 'dns_opcode': 37 case 'dns_opcode':
37 $obj->data_sources = array('value'); 38 $obj->data_sources = array('value');
38 $obj->rrd_title = 'DNS Opcode Query'; 39 $obj->rrd_title = 'DNS Opcode Query';
39 $obj->rrd_vertical = 'Queries/s'; 40 $obj->rrd_vertical = 'Queries/s';
40 $obj->rrd_format = '%5.1lf%s';
41 break; 41 break;
42 case 'dns_qtype': 42 case 'dns_qtype':
43 $obj->data_sources = array('value'); 43 $obj->data_sources = array('value');
44 $obj->rrd_title = 'DNS QType'; 44 $obj->rrd_title = 'DNS QType';
45 $obj->rrd_vertical = 'Queries/s'; 45 $obj->rrd_vertical = 'Queries/s';
46 $obj->rrd_format = '%5.1lf%s';
47 break; 46 break;
48} 47}
49 48
diff --git a/plugin/mysql.php b/plugin/mysql.php
index c73c37a..aac9e88 100644
--- a/plugin/mysql.php
+++ b/plugin/mysql.php
@@ -9,13 +9,13 @@ require_once 'inc/collectd.inc.php';
9$obj = new Type_GenericStacked($CONFIG); 9$obj = new Type_GenericStacked($CONFIG);
10$obj->width = $width; 10$obj->width = $width;
11$obj->heigth = $heigth; 11$obj->heigth = $heigth;
12$obj->rrd_format = '%5.1lf%s';
12 13
13switch($obj->args['type']) 14switch($obj->args['type'])
14{ 15{
15 case 'mysql_commands': 16 case 'mysql_commands':
16 $obj->rrd_title = sprintf('MySQL commands (%s)', $obj->args['pinstance']); 17 $obj->rrd_title = sprintf('MySQL commands (%s)', $obj->args['pinstance']);
17 $obj->rrd_vertical = 'Issues/s'; 18 $obj->rrd_vertical = 'Issues/s';
18 $obj->rrd_format = '%5.1lf%s';
19 break; 19 break;
20 case 'mysql_handler': 20 case 'mysql_handler':
21 $obj->colors = array( 21 $obj->colors = array(
@@ -33,7 +33,6 @@ switch($obj->args['type'])
33 ); 33 );
34 $obj->rrd_title = sprintf('MySQL handler (%s)', $obj->args['pinstance']); 34 $obj->rrd_title = sprintf('MySQL handler (%s)', $obj->args['pinstance']);
35 $obj->rrd_vertical = 'Invocations'; 35 $obj->rrd_vertical = 'Invocations';
36 $obj->rrd_format = '%5.1lf%s';
37 break; 36 break;
38 case 'mysql_locks': 37 case 'mysql_locks':
39 $obj->colors = array( 38 $obj->colors = array(
@@ -42,7 +41,6 @@ switch($obj->args['type'])
42 ); 41 );
43 $obj->rrd_title = sprintf('MySQL locks (%s)', $obj->args['pinstance']); 42 $obj->rrd_title = sprintf('MySQL locks (%s)', $obj->args['pinstance']);
44 $obj->rrd_vertical = 'locks'; 43 $obj->rrd_vertical = 'locks';
45 $obj->rrd_format = '%5.1lf%s';
46 break; 44 break;
47 case 'mysql_octets': 45 case 'mysql_octets':
48 $obj->data_sources = array('rx', 'tx'); 46 $obj->data_sources = array('rx', 'tx');
@@ -56,7 +54,6 @@ switch($obj->args['type'])
56 ); 54 );
57 $obj->rrd_title = sprintf('MySQL traffic (%s)', $obj->args['pinstance']); 55 $obj->rrd_title = sprintf('MySQL traffic (%s)', $obj->args['pinstance']);
58 $obj->rrd_vertical = 'Bits per second'; 56 $obj->rrd_vertical = 'Bits per second';
59 $obj->rrd_format = '%5.1lf%s';
60 break; 57 break;
61 case 'mysql_qcache': 58 case 'mysql_qcache':
62 $obj->data_sources = array('not_cached', 'inserts', 'hits', 'lowmem_prunes', 'queries_in_cache'); 59 $obj->data_sources = array('not_cached', 'inserts', 'hits', 'lowmem_prunes', 'queries_in_cache');
@@ -76,7 +73,6 @@ switch($obj->args['type'])
76 ); 73 );
77 $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']); 74 $obj->rrd_title = sprintf('MySQL query cache (%s)', $obj->args['pinstance']);
78 $obj->rrd_vertical = 'Queries/s'; 75 $obj->rrd_vertical = 'Queries/s';
79 $obj->rrd_format = '%5.1lf%s';
80 break; 76 break;
81 case 'mysql_threads': 77 case 'mysql_threads':
82 $obj->data_sources = array('cached', 'connected', 'running', 'created'); 78 $obj->data_sources = array('cached', 'connected', 'running', 'created');
@@ -94,7 +90,6 @@ switch($obj->args['type'])
94 ); 90 );
95 $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']); 91 $obj->rrd_title = sprintf('MySQL threads (%s)', $obj->args['pinstance']);
96 $obj->rrd_vertical = 'Threads'; 92 $obj->rrd_vertical = 'Threads';
97 $obj->rrd_format = '%5.1lf%s';
98 break; 93 break;
99} 94}
100 95
diff --git a/plugin/ntpd.php b/plugin/ntpd.php
index c85ce8c..18187a9 100644
--- a/plugin/ntpd.php
+++ b/plugin/ntpd.php
@@ -19,30 +19,28 @@ $obj->ds_names = array('ping' => 'Ping time',
19 'ping_droprate' => 'Ping droprate'); 19 'ping_droprate' => 'Ping droprate');
20$obj->width = $width; 20$obj->width = $width;
21$obj->heigth = $heigth; 21$obj->heigth = $heigth;
22$obj->rrd_format = '%5.1lf%s';
23
22switch($obj->args['type']) { 24switch($obj->args['type']) {
23 case 'delay': 25 case 'delay':
24 $obj->data_sources = array('seconds'); 26 $obj->data_sources = array('seconds');
25 $obj->rrd_title = sprintf('Delay'); 27 $obj->rrd_title = sprintf('Delay');
26 $obj->rrd_vertical = 'Seconds'; 28 $obj->rrd_vertical = 'Seconds';
27 $obj->rrd_format = '%5.1lf%s';
28 break; 29 break;
29 case 'frequency_offset': 30 case 'frequency_offset':
30 $obj->data_sources = array('ppm'); 31 $obj->data_sources = array('ppm');
31 $obj->rrd_title = 'Frequency offset'; 32 $obj->rrd_title = 'Frequency offset';
32 $obj->rrd_vertical = 'ppm'; 33 $obj->rrd_vertical = 'ppm';
33 $obj->rrd_format = '%5.1lf%s';
34 break; 34 break;
35 case 'time_dispersion': 35 case 'time_dispersion':
36 $obj->data_sources = array('seconds'); 36 $obj->data_sources = array('seconds');
37 $obj->rrd_title = 'Time dispersion'; 37 $obj->rrd_title = 'Time dispersion';
38 $obj->rrd_vertical = 'Seconds'; 38 $obj->rrd_vertical = 'Seconds';
39 $obj->rrd_format = '%5.1lf%s';
40 break; 39 break;
41 case 'time_offset': 40 case 'time_offset':
42 $obj->data_sources = array('seconds'); 41 $obj->data_sources = array('seconds');
43 $obj->rrd_title = 'Time offset'; 42 $obj->rrd_title = 'Time offset';
44 $obj->rrd_vertical = 'Seconds'; 43 $obj->rrd_vertical = 'Seconds';
45 $obj->rrd_format = '%5.1lf%s';
46 break; 44 break;
47} 45}
48 46
diff --git a/plugin/ping.php b/plugin/ping.php
index 1ea53de..9780969 100644
--- a/plugin/ping.php
+++ b/plugin/ping.php
@@ -19,22 +19,21 @@ $obj->ds_names = array('ping' => 'Ping time',
19 'ping_droprate' => 'Ping droprate'); 19 'ping_droprate' => 'Ping droprate');
20$obj->width = $width; 20$obj->width = $width;
21$obj->heigth = $heigth; 21$obj->heigth = $heigth;
22$obj->rrd_format = '%5.1lf';
23
22switch($obj->args['type']) { 24switch($obj->args['type']) {
23 case 'ping': 25 case 'ping':
24 $obj->data_sources = array('ping'); 26 $obj->data_sources = array('ping');
25 $obj->rrd_title = 'Ping latency'; 27 $obj->rrd_title = 'Ping latency';
26 $obj->rrd_vertical = 'Milliseconds'; 28 $obj->rrd_vertical = 'Milliseconds';
27 $obj->rrd_format = '%5.1lf';
28 break; 29 break;
29 case 'ping_stddev': 30 case 'ping_stddev':
30 $obj->rrd_title = 'Ping stddev'; 31 $obj->rrd_title = 'Ping stddev';
31 $obj->rrd_vertical = ''; 32 $obj->rrd_vertical = '';
32 $obj->rrd_format = '%5.1lf';
33 break; 33 break;
34 case 'ping_droprate': 34 case 'ping_droprate':
35 $obj->rrd_title = 'Ping droprate'; 35 $obj->rrd_title = 'Ping droprate';
36 $obj->rrd_vertical = ''; 36 $obj->rrd_vertical = '';
37 $obj->rrd_format = '%5.1lf';
38 break; 37 break;
39} 38}
40 39
diff --git a/plugin/processes.php b/plugin/processes.php
index 466e1e3..dca00b7 100644
--- a/plugin/processes.php
+++ b/plugin/processes.php
@@ -18,6 +18,7 @@ require_once 'inc/collectd.inc.php';
18$obj = new Type_GenericStacked($CONFIG); 18$obj = new Type_GenericStacked($CONFIG);
19$obj->width = $width; 19$obj->width = $width;
20$obj->heigth = $heigth; 20$obj->heigth = $heigth;
21$obj->rrd_format = '%5.1lf%s';
21 22
22switch($obj->args['type']) 23switch($obj->args['type'])
23{ 24{
@@ -41,7 +42,6 @@ switch($obj->args['type'])
41 ); 42 );
42 $obj->rrd_title = 'Processes'; 43 $obj->rrd_title = 'Processes';
43 $obj->rrd_vertical = 'Processes'; 44 $obj->rrd_vertical = 'Processes';
44 $obj->rrd_format = '%5.1lf%s';
45 break; 45 break;
46 46
47 case 'fork_rate': 47 case 'fork_rate':
@@ -53,7 +53,6 @@ switch($obj->args['type'])
53 ); 53 );
54 $obj->rrd_title = 'Fork rate'; 54 $obj->rrd_title = 'Fork rate';
55 $obj->rrd_vertical = 'forks/s'; 55 $obj->rrd_vertical = 'forks/s';
56 $obj->rrd_format = '%5.1lf%s';
57 break; 56 break;
58 57
59 case 'ps_code': 58 case 'ps_code':
@@ -65,7 +64,6 @@ switch($obj->args['type'])
65 ); 64 );
66 $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']); 65 $obj->rrd_title = sprintf('Text Resident Set (%s)', $obj->args['pinstance']);
67 $obj->rrd_vertical = 'Bytes'; 66 $obj->rrd_vertical = 'Bytes';
68 $obj->rrd_format = '%5.1lf%s';
69 break; 67 break;
70 68
71 case 'ps_count': 69 case 'ps_count':
@@ -80,7 +78,6 @@ switch($obj->args['type'])
80 ); 78 );
81 $obj->rrd_title = sprintf('Number of Processes/Threads (%s)', $obj->args['pinstance']); 79 $obj->rrd_title = sprintf('Number of Processes/Threads (%s)', $obj->args['pinstance']);
82 $obj->rrd_vertical = 'Amount'; 80 $obj->rrd_vertical = 'Amount';
83 $obj->rrd_format = '%5.1lf%s';
84 break; 81 break;
85 82
86 case 'ps_cputime': 83 case 'ps_cputime':
@@ -95,7 +92,6 @@ switch($obj->args['type'])
95 ); 92 );
96 $obj->rrd_title = sprintf('CPU time (%s)', $obj->args['pinstance']); 93 $obj->rrd_title = sprintf('CPU time (%s)', $obj->args['pinstance']);
97 $obj->rrd_vertical = 'CPU time [s]'; 94 $obj->rrd_vertical = 'CPU time [s]';
98 $obj->rrd_format = '%5.1lf%s';
99 break; 95 break;
100 96
101 case 'ps_disk_octets': 97 case 'ps_disk_octets':
@@ -110,7 +106,6 @@ switch($obj->args['type'])
110 ); 106 );
111 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); 107 $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']);
112 $obj->rrd_vertical = 'Bytes per second'; 108 $obj->rrd_vertical = 'Bytes per second';
113 $obj->rrd_format = '%5.1lf%s';
114 break; 109 break;
115 110
116 case 'ps_disk_ops': 111 case 'ps_disk_ops':
@@ -125,7 +120,6 @@ switch($obj->args['type'])
125 ); 120 );
126 $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']); 121 $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']);
127 $obj->rrd_vertical = 'Ops per second'; 122 $obj->rrd_vertical = 'Ops per second';
128 $obj->rrd_format = '%5.1lf%s';
129 break; 123 break;
130 124
131 case 'ps_data': 125 case 'ps_data':
@@ -137,7 +131,6 @@ switch($obj->args['type'])
137 ); 131 );
138 $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']); 132 $obj->rrd_title = sprintf('Data Resident Set (%s)', $obj->args['pinstance']);
139 $obj->rrd_vertical = 'Bytes'; 133 $obj->rrd_vertical = 'Bytes';
140 $obj->rrd_format = '%5.1lf%s';
141 break; 134 break;
142 135
143 case 'ps_pagefaults': 136 case 'ps_pagefaults':
@@ -152,7 +145,6 @@ switch($obj->args['type'])
152 ); 145 );
153 $obj->rrd_title = sprintf('PageFaults (%s)', $obj->args['pinstance']); 146 $obj->rrd_title = sprintf('PageFaults (%s)', $obj->args['pinstance']);
154 $obj->rrd_vertical = 'Pagefaults'; 147 $obj->rrd_vertical = 'Pagefaults';
155 $obj->rrd_format = '%5.1lf%s';
156 break; 148 break;
157 149
158 case 'ps_rss': 150 case 'ps_rss':
@@ -164,7 +156,6 @@ switch($obj->args['type'])
164 ); 156 );
165 $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']); 157 $obj->rrd_title = sprintf('Resident Segment Size (%s)', $obj->args['pinstance']);
166 $obj->rrd_vertical = 'Bytes'; 158 $obj->rrd_vertical = 'Bytes';
167 $obj->rrd_format = '%5.1lf%s';
168 break; 159 break;
169 160
170 case 'ps_stacksize': 161 case 'ps_stacksize':
@@ -176,7 +167,6 @@ switch($obj->args['type'])
176 ); 167 );
177 $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']); 168 $obj->rrd_title = sprintf('Stacksize (%s)', $obj->args['pinstance']);
178 $obj->rrd_vertical = 'Bytes'; 169 $obj->rrd_vertical = 'Bytes';
179 $obj->rrd_format = '%5.1lf%s';
180 break; 170 break;
181 171
182 case 'ps_vm': 172 case 'ps_vm':
@@ -188,7 +178,6 @@ switch($obj->args['type'])
188 ); 178 );
189 $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']); 179 $obj->rrd_title = sprintf('Virtual Memory (%s)', $obj->args['pinstance']);
190 $obj->rrd_vertical = 'Bytes'; 180 $obj->rrd_vertical = 'Bytes';
191 $obj->rrd_format = '%5.1lf%s';
192 break; 181 break;
193 182
194} 183}
diff --git a/plugin/vmem.php b/plugin/vmem.php
index ea541fc..2fae536 100644
--- a/plugin/vmem.php
+++ b/plugin/vmem.php
@@ -16,6 +16,8 @@ require_once 'inc/collectd.inc.php';
16$obj = new Type_GenericStacked($CONFIG); 16$obj = new Type_GenericStacked($CONFIG);
17$obj->width = $width; 17$obj->width = $width;
18$obj->heigth = $heigth; 18$obj->heigth = $heigth;
19$obj->rrd_format = '%5.1lf%s';
20
19switch($obj->args['type']) { 21switch($obj->args['type']) {
20 case 'vmpage_faults': 22 case 'vmpage_faults':
21 $obj->data_sources = array('minflt', 'majflt'); 23 $obj->data_sources = array('minflt', 'majflt');
@@ -25,7 +27,6 @@ switch($obj->args['type']) {
25 'majflt' => 'Major'); 27 'majflt' => 'Major');
26 $obj->rrd_title = 'Page faults'; 28 $obj->rrd_title = 'Page faults';
27 $obj->rrd_vertical = ''; 29 $obj->rrd_vertical = '';
28 $obj->rrd_format = '%5.1lf%s';
29 break; 30 break;
30 case 'vmpage_io': 31 case 'vmpage_io':
31 $obj->data_sources = array('in', 'out'); 32 $obj->data_sources = array('in', 'out');
@@ -39,7 +40,6 @@ switch($obj->args['type']) {
39 'swap-out' => 'ffff00'); 40 'swap-out' => 'ffff00');
40 $obj->rrd_title = 'Page IO'; 41 $obj->rrd_title = 'Page IO';
41 $obj->rrd_vertical = ''; 42 $obj->rrd_vertical = '';
42 $obj->rrd_format = '%5.1lf%s';
43 break; 43 break;
44 case 'vmpage_number': 44 case 'vmpage_number':
45 $obj->data_sources = array('value'); 45 $obj->data_sources = array('value');
@@ -55,7 +55,6 @@ switch($obj->args['type']) {
55 'writeback', 'writeback_temp'); 55 'writeback', 'writeback_temp');
56 $obj->rrd_title = 'Pages'; 56 $obj->rrd_title = 'Pages';
57 $obj->rrd_vertical = ''; 57 $obj->rrd_vertical = '';
58 $obj->rrd_format = '%5.1lf%s';
59 break; 58 break;
60} 59}
61 60