diff options
-rw-r--r-- | plugin/apache.php | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/plugin/apache.php b/plugin/apache.php index 73fe70e..99fc689 100644 --- a/plugin/apache.php +++ b/plugin/apache.php | |||
@@ -17,48 +17,48 @@ $obj = new Type_Default($CONFIG); | |||
17 | 17 | ||
18 | switch ($obj->args['type']) { | 18 | switch ($obj->args['type']) { |
19 | case 'apache_bytes': | 19 | case 'apache_bytes': |
20 | $obj->data_sources = array('count'); | 20 | $obj->data_sources = array('value'); |
21 | $obj->ds_names = array( | 21 | $obj->ds_names = array( |
22 | 'count' => 'Bytes/s', | 22 | $obj->args['type'] => 'Bytes/s', |
23 | ); | 23 | ); |
24 | $obj->colors = array( | 24 | $obj->colors = array( |
25 | 'count' => '0000ff', | 25 | $obj->args['type'] => '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 = 'Bytes/s'; |
30 | break; | 30 | break; |
31 | case 'apache_connections': | 31 | case 'apache_connections': |
32 | $obj->data_sources = array('count'); | 32 | $obj->data_sources = array('value'); |
33 | $obj->ds_names = array( | 33 | $obj->ds_names = array( |
34 | 'count' => 'Conns/s', | 34 | $obj->args['type'] => 'Conns/s', |
35 | ); | 35 | ); |
36 | $obj->colors = array( | 36 | $obj->colors = array( |
37 | 'count' => '00b000', | 37 | $obj->args['type'] => '00b000', |
38 | ); | 38 | ); |
39 | $obj->rrd_title = sprintf('Webserver Connections%s', | 39 | $obj->rrd_title = sprintf('Webserver Connections%s', |
40 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); | 40 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); |
41 | $obj->rrd_vertical = 'Conns/s'; | 41 | $obj->rrd_vertical = 'Conns/s'; |
42 | break; | 42 | break; |
43 | case 'apache_idle_workers': | 43 | case 'apache_idle_workers': |
44 | $obj->data_sources = array('count'); | 44 | $obj->data_sources = array('value'); |
45 | $obj->ds_names = array( | 45 | $obj->ds_names = array( |
46 | 'count' => 'Workers', | 46 | $obj->args['type'] => 'Workers', |
47 | ); | 47 | ); |
48 | $obj->colors = array( | 48 | $obj->colors = array( |
49 | 'count' => '0000ff', | 49 | $obj->args['type'] => '0000ff', |
50 | ); | 50 | ); |
51 | $obj->rrd_title = sprintf('Webserver Idle Workers%s', | 51 | $obj->rrd_title = sprintf('Webserver Idle Workers%s', |
52 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); | 52 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); |
53 | $obj->rrd_vertical = 'Workers'; | 53 | $obj->rrd_vertical = 'Workers'; |
54 | break; | 54 | break; |
55 | case 'apache_requests': | 55 | case 'apache_requests': |
56 | $obj->data_sources = array('count'); | 56 | $obj->data_sources = array('value'); |
57 | $obj->ds_names = array( | 57 | $obj->ds_names = array( |
58 | 'count' => 'Requests/s', | 58 | $obj->args['type'] => 'Requests/s', |
59 | ); | 59 | ); |
60 | $obj->colors = array( | 60 | $obj->colors = array( |
61 | 'count' => '00b000', | 61 | $obj->args['type'] => '00b000', |
62 | ); | 62 | ); |
63 | $obj->rrd_title = sprintf('Webserver Requests%s', | 63 | $obj->rrd_title = sprintf('Webserver Requests%s', |
64 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); | 64 | !empty($obj->args['pinstance']) ? ' ('.$obj->args['pinstance'].')' : ''); |
@@ -67,7 +67,7 @@ switch ($obj->args['type']) { | |||
67 | case 'apache_scoreboard': | 67 | case 'apache_scoreboard': |
68 | require_once 'type/GenericStacked.class.php'; | 68 | require_once 'type/GenericStacked.class.php'; |
69 | $obj = new Type_GenericStacked($CONFIG); | 69 | $obj = new Type_GenericStacked($CONFIG); |
70 | $obj->data_sources = array('count'); | 70 | $obj->data_sources = array('value'); |
71 | $obj->order = array( | 71 | $obj->order = array( |
72 | 'open', | 72 | 'open', |
73 | 'idle_cleanup', | 73 | 'idle_cleanup', |
@@ -153,5 +153,18 @@ $obj->width = $width; | |||
153 | $obj->heigth = $heigth; | 153 | $obj->heigth = $heigth; |
154 | $obj->rrd_format = '%5.1lf'; | 154 | $obj->rrd_format = '%5.1lf'; |
155 | 155 | ||
156 | # backwards compatibility | ||
157 | if ($CONFIG['version'] < 5) { | ||
158 | $obj->data_sources = array('count'); | ||
159 | if (count($obj->ds_names) == 1) { | ||
160 | $obj->ds_names['count'] = $obj->ds_names[$obj->args['type']]; | ||
161 | unset($obj->ds_names[$obj->args['type']]); | ||
162 | } | ||
163 | if (count($obj->colors) == 1) { | ||
164 | $obj->colors['count'] = $obj->colors[$obj->args['type']]; | ||
165 | unset($obj->colors[$obj->args['type']]); | ||
166 | } | ||
167 | } | ||
168 | |||
156 | collectd_flush($obj->identifiers); | 169 | collectd_flush($obj->identifiers); |
157 | $obj->rrd_graph(); | 170 | $obj->rrd_graph(); |