diff options
Diffstat (limited to '')
-rw-r--r-- | plugin/nginx.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/plugin/nginx.php b/plugin/nginx.php new file mode 100644 index 0000000..b05cd67 --- /dev/null +++ b/plugin/nginx.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | # Collectd nginx plugin | ||
4 | |||
5 | require_once 'conf/common.inc.php'; | ||
6 | require_once 'type/Default.class.php'; | ||
7 | require_once 'inc/collectd.inc.php'; | ||
8 | |||
9 | ## LAYOUT | ||
10 | # nginx/ | ||
11 | # nginx/nginx_connections-active.rrd | ||
12 | # nginx/nginx_connections-reading.rrd | ||
13 | # nginx/nginx_connections-waiting.rrd | ||
14 | # nginx/nginx_connections-writing.rrd | ||
15 | # nginx/nginx_requests.rrd | ||
16 | |||
17 | $obj = new Type_Default($CONFIG); | ||
18 | |||
19 | switch($obj->args['type']) | ||
20 | { | ||
21 | case 'nginx_connections': | ||
22 | $obj->order = array('active', 'reading', 'waiting', 'writing'); | ||
23 | $obj->ds_names = array( | ||
24 | 'active' => 'Active', | ||
25 | 'reading' => 'Reading', | ||
26 | 'waiting' => 'Waiting', | ||
27 | 'writing' => 'Writing', | ||
28 | ); | ||
29 | $obj->colors = array( | ||
30 | 'active' => '005d57', | ||
31 | 'reading' => '4444ff', | ||
32 | 'waiting' => 'f24ac8', | ||
33 | 'writing' => '00cf00', | ||
34 | ); | ||
35 | $obj->rrd_title = sprintf('nginx connections'); | ||
36 | $obj->rrd_vertical = 'Connections/s'; | ||
37 | break; | ||
38 | case 'nginx_requests': | ||
39 | $obj->ds_names = array( | ||
40 | 'value' => 'Requests', | ||
41 | ); | ||
42 | $obj->colors = array( | ||
43 | 'value' => '00aa00', | ||
44 | ); | ||
45 | $obj->rrd_title = sprintf('nginx requests'); | ||
46 | $obj->rrd_vertical = 'Requests per second'; | ||
47 | break; | ||
48 | } | ||
49 | |||
50 | $obj->width = $width; | ||
51 | $obj->heigth = $heigth; | ||
52 | $obj->rrd_format = '%5.1lf%s'; | ||
53 | |||
54 | collectd_flush($obj->identifiers); | ||
55 | $obj->rrd_graph(); | ||