bipbip 0.5.16 → 0.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/bipbip/plugin/socket_redis.rb +35 -0
- data/lib/bipbip/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7795f64525735eeb9f518150c09193ef6c91509d
|
4
|
+
data.tar.gz: dfbe46387b11a91abdef6b93c9dd096b48304d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54e3d5901fbf47de34be5b00e6d4f88b3bb50c78f1816ba4b91d2d9f7d2444fd59907dbc4290a3f129dc54ca9387dab143d654d3443e3326cbb4a55ba2bef8c6
|
7
|
+
data.tar.gz: 2e4972fdf1001ed8c0ff46391aa280f1bbe1abac6af87edb836f45c84d17ae0fda83ce9f868e1641b485ffe34fe289ca100755b6876834f7c2ff56d2dea21a2e
|
data/README.md
CHANGED
@@ -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
|
data/lib/bipbip/version.rb
CHANGED
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.
|
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-
|
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
|