bipbip 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -6
- data/lib/bipbip/plugin/fastcgi_php_apc.rb +30 -0
- data/lib/bipbip/plugin/{php_fpm.rb → fastcgi_php_fpm.rb} +1 -1
- data/lib/bipbip/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cee90e52bfde1b07ded79385252ea3fb7140f1ec
|
4
|
+
data.tar.gz: b233c2c91114e51704a4f5b15bdf2f8516973c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83c2fd818b0ac61e02d1ded9f77fc23d1fc5a5b6d19cbb2e68d628d61cb9f830c1cc55bb262b8a3f1130304d8e940f704ecbd649e05f7915676694e00b62b68b
|
7
|
+
data.tar.gz: da78b4ca96df1a3a78b645b576ec355faeaa99d9db51c249625fb298613c202f8e7f4ebbe66823765c9664dad5a94d630ef4d78c2cbbaeaa3e0971efc9c062f0
|
data/README.md
CHANGED
@@ -54,16 +54,21 @@ services:
|
|
54
54
|
-
|
55
55
|
plugin: nginx
|
56
56
|
url: http://localhost:80/server-status
|
57
|
-
-
|
58
|
-
plugin: php-fpm
|
59
|
-
host: localhost
|
60
|
-
port: 9000
|
61
|
-
path: /fpm-status
|
62
57
|
-
|
63
58
|
plugin: network
|
64
59
|
-
|
65
60
|
plugin: php-apc
|
66
61
|
url: http://localhost:80/apc-status
|
62
|
+
-
|
63
|
+
plugin: fastcgi-php-fpm
|
64
|
+
host: localhost
|
65
|
+
port: 9000
|
66
|
+
path: /fpm-status
|
67
|
+
-
|
68
|
+
plugin: fastcgi-php-apc
|
69
|
+
host: localhost
|
70
|
+
port: 9000
|
71
|
+
path: /usr/local/bin/apc-status.php
|
67
72
|
```
|
68
73
|
|
69
74
|
Include configuration
|
@@ -83,9 +88,25 @@ port: 11211
|
|
83
88
|
|
84
89
|
Plugins
|
85
90
|
----------------------------
|
86
|
-
#### php-fpm
|
91
|
+
#### fastcgi-php-fpm
|
92
|
+
Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
|
93
|
+
|
94
|
+
#### fastcgi-php-apc
|
87
95
|
Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
|
88
96
|
|
97
|
+
Create file `/usr/local/bin/apc-status.php` with content:
|
98
|
+
```php
|
99
|
+
<?php
|
100
|
+
|
101
|
+
$infoOpcode = @apc_cache_info('opcode', true);
|
102
|
+
$infoUser = @apc_cache_info('user', true);
|
103
|
+
|
104
|
+
echo json_encode(array(
|
105
|
+
'opcode_mem_size' => (int) $infoOpcode['mem_size'],
|
106
|
+
'user_mem_size' => (int) $infoUser['mem_size'],
|
107
|
+
));
|
108
|
+
```
|
109
|
+
|
89
110
|
#### php-apc
|
90
111
|
To collect `APC` stats of your apache process, please install the following script.
|
91
112
|
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Bipbip
|
2
|
+
|
3
|
+
class Plugin::FastcgiPhpApc < Plugin
|
4
|
+
|
5
|
+
def metrics_schema
|
6
|
+
[
|
7
|
+
{:name => 'opcode_mem_size', :type => 'gauge', :unit => 'b'},
|
8
|
+
{:name => 'user_mem_size', :type => 'gauge', :unit => 'b'},
|
9
|
+
]
|
10
|
+
end
|
11
|
+
|
12
|
+
def monitor
|
13
|
+
authority = config['host'].to_s + ':' + config['port'].to_s
|
14
|
+
path = config['path'].to_s
|
15
|
+
|
16
|
+
env_backup = ENV.to_hash
|
17
|
+
ENV['REQUEST_METHOD'] = 'GET'
|
18
|
+
ENV['SCRIPT_NAME'] = File.basename(path)
|
19
|
+
ENV['SCRIPT_FILENAME'] = path
|
20
|
+
response = `cgi-fcgi -bind -connect #{authority.shellescape} 2>&1`
|
21
|
+
ENV.replace(env_backup)
|
22
|
+
|
23
|
+
body = response.split(/\r?\n\r?\n/)[1]
|
24
|
+
raise "FastCGI response has no body: #{response}" unless body
|
25
|
+
stats = JSON.parse(body)
|
26
|
+
|
27
|
+
{:opcode_mem_size => stats['opcode_mem_size'].to_i, :user_mem_size => stats['user_mem_size'].to_i}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/bipbip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bipbip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cargo Media
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: copperegg
|
@@ -121,13 +121,14 @@ files:
|
|
121
121
|
- lib/bipbip/agent.rb
|
122
122
|
- lib/bipbip/helper.rb
|
123
123
|
- lib/bipbip/plugin/apache2.rb
|
124
|
+
- lib/bipbip/plugin/fastcgi_php_apc.rb
|
125
|
+
- lib/bipbip/plugin/fastcgi_php_fpm.rb
|
124
126
|
- lib/bipbip/plugin/gearman.rb
|
125
127
|
- lib/bipbip/plugin/memcached.rb
|
126
128
|
- lib/bipbip/plugin/mysql.rb
|
127
129
|
- lib/bipbip/plugin/network.rb
|
128
130
|
- lib/bipbip/plugin/nginx.rb
|
129
131
|
- lib/bipbip/plugin/php_apc.rb
|
130
|
-
- lib/bipbip/plugin/php_fpm.rb
|
131
132
|
- lib/bipbip/plugin/redis.rb
|
132
133
|
- lib/bipbip/plugin.rb
|
133
134
|
- lib/bipbip/storage/copperegg.rb
|