bipbip 0.7.15 → 0.7.16

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: 41b558704dccb9db809d7dafb2c3c60442d8f93e
4
- data.tar.gz: 9a87d0fdbe5aac87286d2aa7bfa3224a0c31c085
3
+ metadata.gz: 11450808d6b1bd8277819a4b49c329d70f6d3516
4
+ data.tar.gz: bdfcec2e7e5f07b98a37993e6d3c89694c3dfd4a
5
5
  SHA512:
6
- metadata.gz: 1ece6820ae355f00eb8b92afb0eb79ed9151233125aa50c1e7364b84a505343850dfa8bfd654cf4b17c070fef8d0fab90d5e8ffd29cd836d3425c75081b1c007
7
- data.tar.gz: 80c461c40878d23aa4621adcf804fc94685e6c66cbe23566842ab40c80277c898515d022a78adbedce35cdcdbe1dbbd075e80942c9a098260a7f69f731397a39
6
+ metadata.gz: 09602e7d5b87f22b4eec2da2e816f3a02b54e4310ed6236550d4521db2436f2843649f489627888cb9d54f6abef381cfc2464dcb704d0db1d5d8de84407e0e36
7
+ data.tar.gz: d68255814a6f4185f35fa560f96038c6983da3fc5bfdd9eb78c2fb27088c9f7a79f77edf8878a8be0702241c7debfe8273e94c700ca412b9924b9fdd2c18ba71
data/data/apc-status.php CHANGED
@@ -2,8 +2,17 @@
2
2
 
3
3
  $infoOpcode = @apc_cache_info('opcode', true);
4
4
  $infoUser = @apc_cache_info('user', true);
5
+ $infoAlloc = @apc_sma_info(true);
6
+
7
+ // see https://github.com/krakjoe/apcu/blob/master/apc.php#L754
8
+ $total_mem_size = (int) $infoAlloc['num_seg'] * (int) $infoAlloc['seg_size'];
9
+ $avail_mem_size = (int) $infoAlloc['avail_mem'];
10
+ $used_mem_size = $total_mem_size - $avail_mem_size;
5
11
 
6
12
  echo json_encode(array(
7
- 'opcode_mem_size' => (int) $infoOpcode['mem_size'],
8
- 'user_mem_size' => (int) $infoUser['mem_size'],
13
+ 'opcode_mem_size' => (int) $infoOpcode['mem_size'],
14
+ 'user_mem_size' => (int) $infoUser['mem_size'],
15
+ 'total_mem_size' => $total_mem_size,
16
+ 'avail_mem_size' => $avail_mem_size,
17
+ 'used_mem_size' => $used_mem_size,
9
18
  ));
@@ -3,11 +3,14 @@ module Bipbip
3
3
  def metrics_schema
4
4
  [
5
5
  { name: 'opcode_mem_size', type: 'gauge', unit: 'b' },
6
- { name: 'user_mem_size', type: 'gauge', unit: 'b' }
6
+ { name: 'user_mem_size', type: 'gauge', unit: 'b' },
7
+ { name: 'used_mem_size', type: 'gauge', unit: 'b' },
8
+ { name: 'used_mem_percentage', type: 'gauge', unit: '%' }
7
9
  ]
8
10
  end
9
11
 
10
- def monitor
12
+ # @return [Hash]
13
+ def _fetch_apc_stats
11
14
  authority = config['host'].to_s + ':' + config['port'].to_s
12
15
  path = File.join(Bipbip::Helper.data_path, 'apc-status.php')
13
16
 
@@ -20,9 +23,17 @@ module Bipbip
20
23
 
21
24
  body = response.split(/\r?\n\r?\n/)[1]
22
25
  raise "FastCGI response has no body: #{response}" unless body
23
- stats = JSON.parse(body)
26
+ JSON.parse(body)
27
+ end
24
28
 
25
- { opcode_mem_size: stats['opcode_mem_size'].to_i, user_mem_size: stats['user_mem_size'].to_i }
29
+ def monitor
30
+ stats = _fetch_apc_stats
31
+ {
32
+ opcode_mem_size: stats['opcode_mem_size'].to_i,
33
+ user_mem_size: stats['user_mem_size'].to_i,
34
+ used_mem_size: stats['used_mem_size'].to_i,
35
+ used_mem_percentage: (stats['used_mem_size'].to_f / stats['total_mem_size'].to_f) * 100
36
+ }
26
37
  end
27
38
  end
28
39
  end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.7.15'.freeze
2
+ VERSION = '0.7.16'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bipbip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.15
4
+ version: 0.7.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cargo Media
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-04-19 00:00:00.000000000 Z
13
+ date: 2017-05-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg-revealmetrics
@@ -60,14 +60,14 @@ dependencies:
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: 3.2.1
63
+ version: 3.3.3
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: 3.2.1
70
+ version: 3.3.3
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: gearman-ruby
73
73
  requirement: !ruby/object:Gem::Requirement
@@ -222,6 +222,20 @@ dependencies:
222
222
  - - "~>"
223
223
  - !ruby/object:Gem::Version
224
224
  version: 0.1.6
225
+ - !ruby/object:Gem::Dependency
226
+ name: net-telnet
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - "~>"
230
+ - !ruby/object:Gem::Version
231
+ version: 0.1.1
232
+ type: :runtime
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - "~>"
237
+ - !ruby/object:Gem::Version
238
+ version: 0.1.1
225
239
  - !ruby/object:Gem::Dependency
226
240
  name: rake
227
241
  requirement: !ruby/object:Gem::Requirement
@@ -256,14 +270,14 @@ dependencies:
256
270
  requirements:
257
271
  - - "~>"
258
272
  - !ruby/object:Gem::Version
259
- version: '1.21'
273
+ version: 3.0.1
260
274
  type: :development
261
275
  prerelease: false
262
276
  version_requirements: !ruby/object:Gem::Requirement
263
277
  requirements:
264
278
  - - "~>"
265
279
  - !ruby/object:Gem::Version
266
- version: '1.21'
280
+ version: 3.0.1
267
281
  - !ruby/object:Gem::Dependency
268
282
  name: rubocop
269
283
  requirement: !ruby/object:Gem::Requirement