aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/plugin
diff options
context:
space:
mode:
authorPim van den Berg2010-12-17 09:41:21 +0100
committerPim van den Berg2010-12-17 13:19:12 +0100
commitf8789611810c230882ae89ebf2493cc22958dec9 (patch)
treee1a754d09f4f35a09ac39202bd76e0cf6e9bbdf3 /plugin
parentplugin: add vserver plugin (diff)
downloadapt-panopticon_cgp-f8789611810c230882ae89ebf2493cc22958dec9.zip
apt-panopticon_cgp-f8789611810c230882ae89ebf2493cc22958dec9.tar.gz
apt-panopticon_cgp-f8789611810c230882ae89ebf2493cc22958dec9.tar.bz2
apt-panopticon_cgp-f8789611810c230882ae89ebf2493cc22958dec9.tar.xz
plugin/apache: bytes, connections, idle_workers, requests support
Support has been added for the following types: - apache_bytes - apache_connections - apache_idle_workers - apache_requests
Diffstat (limited to 'plugin')
-rw-r--r--plugin/apache.php128
1 files changed, 94 insertions, 34 deletions
diff --git a/plugin/apache.php b/plugin/apache.php
index 8c46ad7..60371ed 100644
--- a/plugin/apache.php
+++ b/plugin/apache.php
@@ -3,46 +3,106 @@
3# Collectd Apache plugin 3# Collectd Apache plugin
4 4
5require_once 'conf/common.inc.php'; 5require_once 'conf/common.inc.php';
6require_once 'type/GenericStacked.class.php'; 6require_once 'type/Default.class.php';
7require_once 'inc/collectd.inc.php'; 7require_once 'inc/collectd.inc.php';
8 8
9## LAYOUT 9## LAYOUT
10# apache-X/apache_scoreboard-X.rrd 10# apache[-X]/apache_bytes-X.rrd
11# apache[-X]/apache_connections-X.rrd
12# apache[-X]/apache_idle_workers-X.rrd
13# apache[-X]/apache_requests-X.rrd
14# apache[-X]/apache_scoreboard-X.rrd
15
16$obj = new Type_Default($CONFIG);
17
18switch ($obj->args['type']) {
19 case 'apache_bytes':
20 $obj->data_sources = array('count');
21 $obj->ds_names = array(
22 'count' => 'Bytes/s',
23 );
24 $obj->colors = array(
25 'count' => '0000ff',
26 );
27 $obj->rrd_title = sprintf('Webserver Traffic%s',
28 !isset($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
29 $obj->rrd_vertical = 'Bytes/s';
30 break;
31 case 'apache_connections':
32 $obj->data_sources = array('count');
33 $obj->ds_names = array(
34 'count' => 'Conns/s',
35 );
36 $obj->colors = array(
37 'count' => '00b000',
38 );
39 $obj->rrd_title = sprintf('Webserver Connections%s',
40 !isset($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
41 $obj->rrd_vertical = 'Conns/s';
42 break;
43 case 'apache_idle_workers':
44 $obj->data_sources = array('count');
45 $obj->ds_names = array(
46 'count' => 'Workers',
47 );
48 $obj->colors = array(
49 'count' => '0000ff',
50 );
51 $obj->rrd_title = sprintf('Webserver Idle Workers%s',
52 !isset($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
53 $obj->rrd_vertical = 'Workers';
54 break;
55 case 'apache_requests':
56 $obj->data_sources = array('count');
57 $obj->ds_names = array(
58 'count' => 'Requests/s',
59 );
60 $obj->colors = array(
61 'count' => '00b000',
62 );
63 $obj->rrd_title = sprintf('Webserver Requests%s',
64 !isset($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
65 $obj->rrd_vertical = 'Requests/s';
66 break;
67 case 'apache_scoreboard':
68 require_once 'type/GenericStacked.class.php';
69 $obj = new Type_GenericStacked($CONFIG);
70 $obj->data_sources = array('count');
71 $obj->order = array('open', 'idle_cleanup', 'finishing', 'logging', 'closing', 'dnslookup', 'keepalive', 'sending', 'reading', 'starting', 'waiting');
72 $obj->ds_names = array(
73 'open' => 'Open (empty)',
74 'waiting' => 'Waiting',
75 'starting' => 'Starting up',
76 'reading' => 'Reading request',
77 'sending' => 'Sending reply',
78 'keepalive' => 'Keepalive',
79 'dnslookup' => 'DNS Lookup',
80 'closing' => 'Closing',
81 'logging' => 'Logging',
82 'finishing' => 'Finishing',
83 'idle_cleanup' => 'Idle cleanup',
84 );
85 $obj->colors = array(
86 'open' => 'e0e0e0',
87 'waiting' => 'ffb000',
88 'starting' => 'ff00ff',
89 'reading' => '0000ff',
90 'sending' => '00e000',
91 'keepalive' => '0080ff',
92 'dnslookup' => 'ff0000',
93 'closing' => '000080',
94 'logging' => 'a000a0',
95 'finishing' => '008080',
96 'idle_cleanup' => 'ffff00',
97 );
98 $obj->rrd_title = sprintf('Webserver Scoreboard%s',
99 !isset($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : '');
100 $obj->rrd_vertical = 'Slots';
101 break;
102}
11 103
12$obj = new Type_GenericStacked($CONFIG);
13$obj->data_sources = array('count');
14$obj->order = array('open', 'idle_cleanup', 'finishing', 'logging', 'closing', 'dnslookup', 'keepalive', 'sending', 'reading', 'starting', 'waiting');
15$obj->ds_names = array(
16 'open' => 'Open (empty)',
17 'waiting' => 'Waiting',
18 'starting' => 'Starting up',
19 'reading' => 'Reading request',
20 'sending' => 'Sending reply',
21 'keepalive' => 'Keepalive',
22 'dnslookup' => 'DNS Lookup',
23 'closing' => 'Closing',
24 'logging' => 'Logging',
25 'finishing' => 'Finishing',
26 'idle_cleanup' => 'Idle cleanup',
27);
28$obj->colors = array(
29 'open' => 'e0e0e0',
30 'waiting' => 'ffb000',
31 'starting' => 'ff00ff',
32 'reading' => '0000ff',
33 'sending' => '00e000',
34 'keepalive' => '0080ff',
35 'dnslookup' => 'ff0000',
36 'closing' => '000080',
37 'logging' => 'a000a0',
38 'finishing' => '008080',
39 'idle_cleanup' => 'ffff00',
40);
41$obj->width = $width; 104$obj->width = $width;
42$obj->heigth = $heigth; 105$obj->heigth = $heigth;
43
44$obj->rrd_title = sprintf('Scoreboard of %s', $obj->args['pinstance']);
45$obj->rrd_vertical = 'Slots';
46$obj->rrd_format = '%5.1lf'; 106$obj->rrd_format = '%5.1lf';
47 107
48collectd_flush($obj->identifiers); 108collectd_flush($obj->identifiers);