bipbip 0.2.2 → 0.2.3

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: 433fdde4a9b2144a2a91baae4db5cbaa8be7c1aa
4
- data.tar.gz: 5c4dd948262df1f2316671762f79ec736b3af8f4
3
+ metadata.gz: e4f44ff5a912f62505175131fc84b775583b58f1
4
+ data.tar.gz: 944a75282d428af5e347fc08a3cc8812a8db2ef9
5
5
  SHA512:
6
- metadata.gz: 5a5e22ca08f87579060db60e031c86316ded9b2f8eeba1cec4735e0d4778084ad9ce381e15d47dc13dff3f3e2bcd864f8e0e12970977613f5dbf7b9d37afe7c5
7
- data.tar.gz: b1754c55a86c4eb27baa658a73654e91f43c83495019fcf50c96baac5dd674f52460198192c2ad5ac34a8de9b91510f585a5bc6ce157ed98b3e3dbc528a838d0
6
+ metadata.gz: 21e998fc4160e95dbc1222b50bfdcd337f7041dfcf37ad651f25ce6de3633902c894d88c3d55be23dfb47c69729d3c5b22f1eeb94a44baaf350d7ec292988896
7
+ data.tar.gz: 2dd70820ae7dcb8b2760ee33c2a6762031ed1a7a912f8ca5c8a49c33dd70aa215d8c9bb50c6a9a948903aa82e7dc8a65f47f0ca1aba1809e62349aec3c46b7e9
data/README.md CHANGED
@@ -56,7 +56,9 @@ services:
56
56
  url: http://localhost:80/server-status
57
57
  -
58
58
  plugin: php-fpm
59
- url: http://localhost:80/status?json
59
+ host: localhost
60
+ port: 9000
61
+ path: /fpm-status
60
62
  -
61
63
  plugin: network
62
64
  -
@@ -81,6 +83,9 @@ port: 11211
81
83
 
82
84
  Plugins
83
85
  ----------------------------
86
+ #### php-fpm
87
+ Requires the `cgi-fcgi` program (debian package: `libfcgi0ldbl`).
88
+
84
89
  #### php-apc
85
90
  To collect `APC` stats of your apache process, please install the following script.
86
91
 
data/lib/bipbip.rb CHANGED
@@ -6,6 +6,7 @@ module Bipbip
6
6
  require 'json/pure'
7
7
  require 'logger'
8
8
  require 'socket'
9
+ require 'shellwords'
9
10
 
10
11
  require 'interruptible_sleep'
11
12
 
@@ -11,11 +11,20 @@ module Bipbip
11
11
  end
12
12
 
13
13
  def monitor
14
- uri = URI.parse(config['url'])
15
- response = Net::HTTP.get_response(uri)
16
- raise "Invalid response from server at #{config['url']}" unless response.code == '200'
14
+ authority = config['host'].to_s + ':' + config['port'].to_s
15
+ path = config['path'].to_s
17
16
 
18
- status = JSON.parse(response.body)
17
+ env_backup = ENV.to_hash
18
+ ENV['REQUEST_METHOD'] = 'GET'
19
+ ENV['SCRIPT_NAME'] = path
20
+ ENV['SCRIPT_FILENAME'] = path
21
+ ENV['QUERY_STRING'] = 'json'
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
+ status = JSON.parse(body)
19
28
 
20
29
  status.reject{|k, v| !metrics_names.include?(k)}
21
30
  end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
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.2
4
+ version: 0.2.3
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-17 00:00:00.000000000 Z
11
+ date: 2013-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: copperegg