bipbip 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ed1e1f9bcefb398a5f0b9a4f7ea89f7913ad25c
4
- data.tar.gz: ffab0aa9fc587dd792a3e5d205294bc4168d86ea
3
+ metadata.gz: 1054a8f8fa64e0cb8b7bfddb26712c4e65e83231
4
+ data.tar.gz: e3cfd1999f70edd0fec2cf3dcf4beb2699d56dd3
5
5
  SHA512:
6
- metadata.gz: 364e5c50fe638dd700baf3a7220ee60a8a78b9acfd728d22b773e96ef776ca54474fb8fcd414a6591e39d10b6bcbd418675cd8749680c2c9707e8d98b72e5e13
7
- data.tar.gz: 2df0898d1a4e93e99f678802a1a74564bbfde45255e6545a41809484e01dd44be3e51ad11c8e75372a12fa84d0f44d3d134aed4c9a7d545274385c66df22b107
6
+ metadata.gz: f44ef61f199785f7db60f11b7520b75e905c58561255915f8711223fb9a1ca5200d75d4683e5fdf790d60034832942ddd78221fd9c8730bfba4a12638849f817
7
+ data.tar.gz: 1a6a20bad5c22b06c1d9525cb8d4b8abb077fbfa28adb4e5d667c17c1cf1cd9642e1a00e51bbe384af52e56a259b12362bb5092df553392d7d7731f0b7d7212a
data/README.md CHANGED
@@ -68,6 +68,10 @@ services:
68
68
  plugin: fastcgi-php-apc
69
69
  host: localhost
70
70
  port: 9000
71
+ -
72
+ plugin: fastcgi-php-opcache
73
+ host: localhost
74
+ port: 9000
71
75
  ```
72
76
 
73
77
  Include configuration
@@ -86,13 +90,16 @@ port: 11211
86
90
  ```
87
91
 
88
92
  Plugins
89
- ----------------------------
93
+ -------
90
94
  #### fastcgi-php-fpm
91
95
  Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
92
96
 
93
97
  #### fastcgi-php-apc
94
98
  Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
95
99
 
100
+ #### fastcgi-php-opcache
101
+ Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
102
+
96
103
  #### php-apc
97
104
  To collect `APC` stats of your apache process, please install the following script.
98
105
 
@@ -110,3 +117,11 @@ Alias /apc-status /usr/local/bin/apc-status.php
110
117
  ```
111
118
 
112
119
  Then set the `url`-configuration for the plugin to where the script is being served, e.g. `http//localhost:80/apc-status`.
120
+
121
+ Custom external plugins
122
+ -----------------------
123
+ Additional plugins can be created as independent gems.
124
+ They should include a class `Plugin::MyPlugin` in the `BipBip` module extending `Plugin`.
125
+ On that class the functions `metrics_schema` and `monitor` should be implemented.
126
+
127
+ For a complete example see [cargomedia/bipbip-random-example](https://github.com/cargomedia/bipbip-random-example).
@@ -0,0 +1,4 @@
1
+ <?php
2
+
3
+ $status = opcache_get_status(false);
4
+ echo json_encode($status);
@@ -0,0 +1,39 @@
1
+ module Bipbip
2
+
3
+ class Plugin::FastcgiPhpOpcache < Plugin
4
+
5
+ def metrics_schema
6
+ [
7
+ {:name => 'free_memory', :type => 'gauge', :unit => 'b'},
8
+ {:name => 'current_wasted_percentage', :type => 'gauge', :unit => '%'},
9
+ {:name => 'num_cached_keys', :type => 'gauge', :unit => 'Keys'},
10
+ {:name => 'opcache_hit_rate', :type => 'gauge', :unit => 'Hits'},
11
+ ]
12
+ end
13
+
14
+ def monitor
15
+ authority = config['host'].to_s + ':' + config['port'].to_s
16
+ path = File.join(Bipbip::Helper.data_path, 'php-opcache-status.php')
17
+
18
+ env_backup = ENV.to_hash
19
+ ENV['REQUEST_METHOD'] = 'GET'
20
+ ENV['SCRIPT_NAME'] = File.basename(path)
21
+ ENV['SCRIPT_FILENAME'] = path
22
+ response = `cgi-fcgi -bind -connect #{authority.shellescape} 2>&1`
23
+ ENV.replace(env_backup)
24
+
25
+ body = response.split(/\r?\n\r?\n/)[1]
26
+ raise "FastCGI response has no body: #{response}" unless body
27
+ stats = JSON.parse(body)
28
+
29
+ stats_memory = stats['memory_usage']
30
+ stats_statistics = stats['opcache_statistics']
31
+ {
32
+ :free_memory => stats_memory['free_memory'].to_i,
33
+ :current_wasted_percentage => stats_memory['current_wasted_percentage'].to_i,
34
+ :num_cached_keys => stats_statistics['num_cached_keys'].to_i,
35
+ :opcache_hit_rate => stats_statistics['opcache_hit_rate'].to_i,
36
+ }
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bipbip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
8
+ - kris-lab
9
+ - njam
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2013-12-19 00:00:00.000000000 Z
13
+ date: 2014-03-07 00:00:00.000000000 Z
12
14
  dependencies:
13
15
  - !ruby/object:Gem::Dependency
14
16
  name: copperegg
@@ -118,11 +120,16 @@ files:
118
120
  - LICENSE
119
121
  - README.md
120
122
  - bin/bipbip
123
+ - data/apc-status.php
124
+ - data/php-opcache-status.php
125
+ - lib/bipbip.rb
121
126
  - lib/bipbip/agent.rb
122
127
  - lib/bipbip/helper.rb
128
+ - lib/bipbip/plugin.rb
123
129
  - lib/bipbip/plugin/apache2.rb
124
130
  - lib/bipbip/plugin/fastcgi_php_apc.rb
125
131
  - lib/bipbip/plugin/fastcgi_php_fpm.rb
132
+ - lib/bipbip/plugin/fastcgi_php_opcache.rb
126
133
  - lib/bipbip/plugin/gearman.rb
127
134
  - lib/bipbip/plugin/memcached.rb
128
135
  - lib/bipbip/plugin/mysql.rb
@@ -130,13 +137,10 @@ files:
130
137
  - lib/bipbip/plugin/nginx.rb
131
138
  - lib/bipbip/plugin/php_apc.rb
132
139
  - lib/bipbip/plugin/redis.rb
133
- - lib/bipbip/plugin.rb
134
- - lib/bipbip/storage/copperegg.rb
135
140
  - lib/bipbip/storage.rb
141
+ - lib/bipbip/storage/copperegg.rb
136
142
  - lib/bipbip/version.rb
137
- - lib/bipbip.rb
138
143
  - lib/interruptible_sleep.rb
139
- - data/apc-status.php
140
144
  homepage: https://github.com/cargomedia/bipbip
141
145
  licenses:
142
146
  - MIT
@@ -157,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
161
  version: '0'
158
162
  requirements: []
159
163
  rubyforge_project:
160
- rubygems_version: 2.1.11
164
+ rubygems_version: 2.2.2
161
165
  signing_key:
162
166
  specification_version: 4
163
167
  summary: Gather services data and store in CopperEgg