bipbip 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4f44ff5a912f62505175131fc84b775583b58f1
4
- data.tar.gz: 944a75282d428af5e347fc08a3cc8812a8db2ef9
3
+ metadata.gz: cee90e52bfde1b07ded79385252ea3fb7140f1ec
4
+ data.tar.gz: b233c2c91114e51704a4f5b15bdf2f8516973c64
5
5
  SHA512:
6
- metadata.gz: 21e998fc4160e95dbc1222b50bfdcd337f7041dfcf37ad651f25ce6de3633902c894d88c3d55be23dfb47c69729d3c5b22f1eeb94a44baaf350d7ec292988896
7
- data.tar.gz: 2dd70820ae7dcb8b2760ee33c2a6762031ed1a7a912f8ca5c8a49c33dd70aa215d8c9bb50c6a9a948903aa82e7dc8a65f47f0ca1aba1809e62349aec3c46b7e9
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
@@ -1,6 +1,6 @@
1
1
  module Bipbip
2
2
 
3
- class Plugin::PhpFpm < Plugin
3
+ class Plugin::FastcgiPhpFpm < Plugin
4
4
 
5
5
  def metrics_schema
6
6
  [
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
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.3
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-18 00:00:00.000000000 Z
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