bipbip 0.5.16 → 0.5.17

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: bc6ea5f688000efd5466cddbad8c6260fb262bcd
4
- data.tar.gz: 66aa262a7f144ab2b2a421faed788521e4c49800
3
+ metadata.gz: 7795f64525735eeb9f518150c09193ef6c91509d
4
+ data.tar.gz: dfbe46387b11a91abdef6b93c9dd096b48304d84
5
5
  SHA512:
6
- metadata.gz: a7c34098fd1debe8fa495f9685c8bacdacdfa48c550d59883ea6837d693acd3d5edddc3c6ca7696a68ea0c6eef2c53514ef6a308c6633f97d0461179333ad669
7
- data.tar.gz: 42472ccbd15e43558669deba5f9a96ed2a56fb94da2cad07af0f973e5134711820e701b215a93ade68dc06f2ec20feb7df6c29169ae56de9f54dbb4083d3bded
6
+ metadata.gz: 54e3d5901fbf47de34be5b00e6d4f88b3bb50c78f1816ba4b91d2d9f7d2444fd59907dbc4290a3f129dc54ca9387dab143d654d3443e3326cbb4a55ba2bef8c6
7
+ data.tar.gz: 2e4972fdf1001ed8c0ff46391aa280f1bbe1abac6af87edb836f45c84d17ae0fda83ce9f868e1641b485ffe34fe289ca100755b6876834f7c2ff56d2dea21a2e
data/README.md CHANGED
@@ -100,6 +100,7 @@ These service plugins ship with bipbip:
100
100
  - elasticsearch
101
101
  - puppet
102
102
  - command
103
+ - socket-redis
103
104
 
104
105
  Please refer to [/docu/services.md](/docu/services.md) for information about the individual plugins and their configuration options.
105
106
 
@@ -0,0 +1,35 @@
1
+ require 'net/http'
2
+
3
+ module Bipbip
4
+
5
+ class Plugin::SocketRedis < Plugin
6
+
7
+ def metrics_schema
8
+ [
9
+ {:name => 'channels_count', :type => 'gauge', :unit => 'Channels'},
10
+ {:name => 'subscribers_count', :type => 'gauge', :unit => 'Subscribers'},
11
+ ]
12
+ end
13
+
14
+ def monitor
15
+ stats = fetch_socket_redis_status
16
+ {
17
+ 'channels_count' => stats.length,
18
+ 'subscribers_count' => stats.values.reduce(0) { |memo, channel| memo += channel['subscribers'].length },
19
+ }
20
+ end
21
+
22
+ private
23
+
24
+ def fetch_socket_redis_status
25
+ url = config['url'] || 'http://localhost:8085/status'
26
+ uri = URI.parse(url)
27
+
28
+ response = Net::HTTP.get_response(uri)
29
+ raise "Invalid response from server at `#{url}`. Response code `#{response.code}`, message `#{response.message}`, body `#{response.body}`" unless response.code == '200'
30
+
31
+ JSON.parse(response.body)
32
+ end
33
+
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.5.16'
2
+ VERSION = '0.5.17'
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.5.16
4
+ version: 0.5.17
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: 2015-01-23 00:00:00.000000000 Z
13
+ date: 2015-01-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg
@@ -243,6 +243,7 @@ files:
243
243
  - lib/bipbip/plugin/puppet.rb
244
244
  - lib/bipbip/plugin/redis.rb
245
245
  - lib/bipbip/plugin/resque.rb
246
+ - lib/bipbip/plugin/socket_redis.rb
246
247
  - lib/bipbip/storage.rb
247
248
  - lib/bipbip/storage/copperegg.rb
248
249
  - lib/bipbip/version.rb