bipbip 0.6.11 → 0.6.12
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 +4 -4
- data/lib/bipbip/plugin/command.rb +2 -2
- data/lib/bipbip/plugin/janus_audioroom.rb +87 -0
- data/lib/bipbip/plugin/janus_rtpbroadcast.rb +96 -0
- data/lib/bipbip/plugin/mysql.rb +5 -5
- data/lib/bipbip/plugin/redis.rb +2 -5
- data/lib/bipbip/storage.rb +1 -1
- data/lib/bipbip/version.rb +1 -1
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66c6f0dfc0b0a12acb0c6d112f633d1f9db8985e
|
4
|
+
data.tar.gz: 6a214d21ed9b4dbcb6c9b6fe0be55ab0cf96752c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8b723a7fd0386bcdacbe0c2760295ec875dbdc97c44329ff3d464979082df4257c4f3748194499ebeb0d08e300140d6c55b14d712dbcf0f9645f1099e062fc
|
7
|
+
data.tar.gz: 60b12b6455d6349c76c37afe6a19d0184b3515b9a76326dbafa8244e68e775dd5e7b655c185f163f938745f95ce4241076d40ae5b72065a46da382c85dbe101f
|
@@ -26,9 +26,9 @@ module Bipbip
|
|
26
26
|
command_output.map do |metric, value|
|
27
27
|
case detect_operation_mode(value)
|
28
28
|
when :simple
|
29
|
-
{ name:
|
29
|
+
{ name: metric.to_s, type: 'gauge' }
|
30
30
|
when :advanced
|
31
|
-
{ name:
|
31
|
+
{ name: metric.to_s, type: value['type'], unit: value['unit'] }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require 'janus_gateway'
|
2
|
+
require 'eventmachine'
|
3
|
+
|
4
|
+
module Bipbip
|
5
|
+
class Plugin::JanusAudioroom < Plugin
|
6
|
+
def metrics_schema
|
7
|
+
[
|
8
|
+
{ name: 'room_count', type: 'gauge', unit: 'Rooms' },
|
9
|
+
{ name: 'participant_count', type: 'gauge', unit: 'Participants' },
|
10
|
+
{ name: 'room_zero_participant_count', type: 'gauge', unit: 'Rooms' }
|
11
|
+
]
|
12
|
+
end
|
13
|
+
|
14
|
+
def monitor
|
15
|
+
data = _fetch_data
|
16
|
+
audiorooms = data['data']['list']
|
17
|
+
{
|
18
|
+
'room_count' => audiorooms.count,
|
19
|
+
'participant_count' => audiorooms.map { |room| room['num_participants'] }.reduce(:+),
|
20
|
+
'room_zero_participant_count' => audiorooms.count { |room| room['num_participants'] == 0 }
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def _fetch_data
|
27
|
+
promise = Concurrent::Promise.new
|
28
|
+
|
29
|
+
EM.run do
|
30
|
+
EM.error_handler do |error|
|
31
|
+
promise.fail(error).execute
|
32
|
+
end
|
33
|
+
|
34
|
+
client = _create_client(config['url'] || 'http://127.0.0.1:8088/janus')
|
35
|
+
|
36
|
+
_create_session(client).then do |session|
|
37
|
+
_create_plugin(client, session).then do |plugin|
|
38
|
+
plugin.list.then do |list|
|
39
|
+
data = list['plugindata']
|
40
|
+
|
41
|
+
session.destroy.value
|
42
|
+
promise.set(data).execute
|
43
|
+
end.rescue do |error|
|
44
|
+
promise.fail("Failed to get list of audioroom: #{error}").execute
|
45
|
+
end
|
46
|
+
end.rescue do |error|
|
47
|
+
promise.fail("Failed to create audioroom plugin: #{error}").execute
|
48
|
+
end
|
49
|
+
end.rescue do |error|
|
50
|
+
promise.fail("Failed to create session: #{error}").execute
|
51
|
+
end
|
52
|
+
|
53
|
+
promise.then { EM.stop }
|
54
|
+
promise.rescue { EM.stop }
|
55
|
+
end
|
56
|
+
|
57
|
+
promise.rescue do |error|
|
58
|
+
fail(error)
|
59
|
+
end
|
60
|
+
|
61
|
+
promise.value
|
62
|
+
end
|
63
|
+
|
64
|
+
# @param [String] http_url
|
65
|
+
# @return [JanusGateway::Client]
|
66
|
+
def _create_client(http_url)
|
67
|
+
transport = JanusGateway::Transport::Http.new(http_url)
|
68
|
+
client = JanusGateway::Client.new(transport)
|
69
|
+
client
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param [JanusGateway::Client] client
|
73
|
+
# @return [Concurrent::Promise]
|
74
|
+
def _create_session(client)
|
75
|
+
session = JanusGateway::Resource::Session.new(client)
|
76
|
+
session.create
|
77
|
+
end
|
78
|
+
|
79
|
+
# @param [JanusGateway::Client] client
|
80
|
+
# @param [JanusGateway::Resource::Session] session
|
81
|
+
# @return [Concurrent::Promise]
|
82
|
+
def _create_plugin(client, session)
|
83
|
+
plugin = JanusGateway::Plugin::Audioroom.new(client, session)
|
84
|
+
plugin.create
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'janus_gateway'
|
2
|
+
|
3
|
+
module Bipbip
|
4
|
+
class Plugin::JanusRtpbroadcast < Plugin
|
5
|
+
def metrics_schema
|
6
|
+
[
|
7
|
+
{ name: 'mountpoint_count', type: 'gauge', unit: 'Mountpoints' },
|
8
|
+
{ name: 'stream_count', type: 'gauge', unit: 'Streams' },
|
9
|
+
{ name: 'streams_listener_count', type: 'gauge', unit: 'Listeners' },
|
10
|
+
{ name: 'streams_waiter_count', type: 'gauge', unit: 'Waiters' },
|
11
|
+
{ name: 'streams_bandwidth', type: 'gauge', unit: 'b/s' },
|
12
|
+
{ name: 'streams_zero_fps_count', type: 'gauge', unit: 'Streams' },
|
13
|
+
{ name: 'streams_zero_bitrate_count', type: 'gauge', unit: 'Streams' }
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
def monitor
|
18
|
+
data = _fetch_data
|
19
|
+
mountpoints = data['data']['list']
|
20
|
+
streams = mountpoints.map { |mp| mp['streams'] }.flatten
|
21
|
+
{
|
22
|
+
'mountpoint_count' => mountpoints.count,
|
23
|
+
'stream_count' => streams.count,
|
24
|
+
'streams_listener_count' => streams.map { |s| s['listeners'] || 0 }.reduce(:+),
|
25
|
+
'streams_waiter_count' => streams.map { |s| s['waiters'] || 0 }.reduce(:+),
|
26
|
+
'streams_bandwidth' => streams.map { |s| s['stats']['cur'] }.reduce(:+),
|
27
|
+
'streams_zero_fps_count' => streams.count { |s| s['frame']['fps'] == 0 },
|
28
|
+
'streams_zero_bitrate_count' => streams.count { |s| s['stats']['cur'] == 0 }
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def _fetch_data
|
35
|
+
promise = Concurrent::Promise.new
|
36
|
+
|
37
|
+
EM.run do
|
38
|
+
EM.error_handler do |error|
|
39
|
+
promise.fail(error).execute
|
40
|
+
end
|
41
|
+
|
42
|
+
client = _create_client(config['url'] || 'http://127.0.0.1:8088/janus')
|
43
|
+
|
44
|
+
_create_session(client).then do |session|
|
45
|
+
_create_plugin(client, session).then do |plugin|
|
46
|
+
plugin.list.then do |list|
|
47
|
+
data = list['plugindata']
|
48
|
+
|
49
|
+
session.destroy.value
|
50
|
+
promise.set(data).execute
|
51
|
+
end.rescue do |error|
|
52
|
+
promise.fail("Failed to get list of mountpoints: #{error}").execute
|
53
|
+
end
|
54
|
+
end.rescue do |error|
|
55
|
+
promise.fail("Failed to create rtpbroadcast plugin: #{error}").execute
|
56
|
+
end
|
57
|
+
end.rescue do |error|
|
58
|
+
promise.fail("Failed to create session: #{error}").execute
|
59
|
+
end
|
60
|
+
|
61
|
+
promise.then { EM.stop }
|
62
|
+
promise.rescue { EM.stop }
|
63
|
+
end
|
64
|
+
|
65
|
+
promise.rescue do |error|
|
66
|
+
fail(error)
|
67
|
+
end
|
68
|
+
|
69
|
+
promise.value
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param [String] http_url
|
73
|
+
# @param [String] session_data
|
74
|
+
# @return [JanusGateway::Client]
|
75
|
+
def _create_client(http_url)
|
76
|
+
transport = JanusGateway::Transport::Http.new(http_url)
|
77
|
+
client = JanusGateway::Client.new(transport)
|
78
|
+
client
|
79
|
+
end
|
80
|
+
|
81
|
+
# @param [JanusGateway::Client] client
|
82
|
+
# @return [Concurrent::Promise]
|
83
|
+
def _create_session(client)
|
84
|
+
session = JanusGateway::Resource::Session.new(client)
|
85
|
+
session.create
|
86
|
+
end
|
87
|
+
|
88
|
+
# @param [JanusGateway::Client] client
|
89
|
+
# @param [JanusGateway::Resource::Session] session
|
90
|
+
# @return [Concurrent::Promise]
|
91
|
+
def _create_plugin(client, session)
|
92
|
+
plugin = JanusGateway::Plugin::Rtpbroadcast.new(client, session)
|
93
|
+
plugin.create
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/lib/bipbip/plugin/mysql.rb
CHANGED
@@ -66,11 +66,11 @@ module Bipbip
|
|
66
66
|
metrics_schema.each do |metric|
|
67
67
|
name = metric[:name]
|
68
68
|
unit = metric[:unit]
|
69
|
-
if 'Boolean' == unit
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
data[name] = if 'Boolean' == unit
|
70
|
+
(('ON' === stats[name] || 'Yes' === stats[name]) ? 1 : 0)
|
71
|
+
else
|
72
|
+
stats[name].to_i
|
73
|
+
end
|
74
74
|
end
|
75
75
|
data
|
76
76
|
end
|
data/lib/bipbip/plugin/redis.rb
CHANGED
@@ -33,12 +33,9 @@ module Bipbip
|
|
33
33
|
data = {}
|
34
34
|
|
35
35
|
metrics_names.each do |key|
|
36
|
-
|
37
|
-
data[key] = stats[key].to_f.round(roundings[key])
|
38
|
-
else
|
39
|
-
data[key] = stats[key].to_i
|
40
|
-
end
|
36
|
+
data[key] = roundings[key].nil? ? stats[key].to_i : stats[key].to_f.round(roundings[key])
|
41
37
|
end
|
38
|
+
|
42
39
|
data
|
43
40
|
end
|
44
41
|
end
|
data/lib/bipbip/storage.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.12
|
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: 2016-01-
|
13
|
+
date: 2016-01-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: copperegg-revealmetrics
|
@@ -166,6 +166,34 @@ dependencies:
|
|
166
166
|
- - "~>"
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: 1.0.6
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: janus_gateway
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - "~>"
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 0.0.10
|
176
|
+
type: :runtime
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - "~>"
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: 0.0.10
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
name: eventmachine
|
185
|
+
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
187
|
+
- - "~>"
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
version: 1.0.8
|
190
|
+
type: :runtime
|
191
|
+
prerelease: false
|
192
|
+
version_requirements: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - "~>"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: 1.0.8
|
169
197
|
- !ruby/object:Gem::Dependency
|
170
198
|
name: rake
|
171
199
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,6 +275,8 @@ files:
|
|
247
275
|
- lib/bipbip/plugin/fastcgi_php_fpm.rb
|
248
276
|
- lib/bipbip/plugin/fastcgi_php_opcache.rb
|
249
277
|
- lib/bipbip/plugin/gearman.rb
|
278
|
+
- lib/bipbip/plugin/janus_audioroom.rb
|
279
|
+
- lib/bipbip/plugin/janus_rtpbroadcast.rb
|
250
280
|
- lib/bipbip/plugin/log_parser.rb
|
251
281
|
- lib/bipbip/plugin/memcached.rb
|
252
282
|
- lib/bipbip/plugin/mongodb.rb
|