bipbip 0.6.13 → 0.6.14
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/agent.rb +1 -1
- data/lib/bipbip/plugin.rb +3 -3
- data/lib/bipbip/plugin/apache2.rb +1 -1
- data/lib/bipbip/plugin/command.rb +1 -1
- data/lib/bipbip/plugin/fastcgi_php_apc.rb +1 -1
- data/lib/bipbip/plugin/fastcgi_php_fpm.rb +1 -1
- data/lib/bipbip/plugin/fastcgi_php_opcache.rb +1 -1
- data/lib/bipbip/plugin/janus_audioroom.rb +1 -1
- data/lib/bipbip/plugin/janus_rtpbroadcast.rb +1 -1
- data/lib/bipbip/plugin/log_parser.rb +1 -1
- data/lib/bipbip/plugin/mongodb.rb +5 -6
- data/lib/bipbip/plugin/network.rb +1 -1
- data/lib/bipbip/plugin/nginx.rb +2 -2
- data/lib/bipbip/plugin/php_apc.rb +1 -1
- data/lib/bipbip/plugin/socket_redis.rb +1 -1
- data/lib/bipbip/storage.rb +2 -2
- data/lib/bipbip/storage/copperegg.rb +1 -1
- data/lib/bipbip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b64ddee8beb29b9234b8521ccec9db1195b806c
|
4
|
+
data.tar.gz: bc468a45a4bc15d8c13ed8857b7c4b6c8fe35aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a14eb70ca91df151b0e4508b939693e49130e84f041bec82176cc70d413ab77ba787b8442ebdeb6c7748bad35b6099fe1ade0ce836b18d674c001f2b88c010
|
7
|
+
data.tar.gz: fbbe050904eaab0d09b3dceaf633bc563d8842010670e98a423f5af08e47fcee5bf428caa2e68eefafddb52660ff10e339eb9736ce7593beb5646a00ae8c571b
|
data/lib/bipbip/agent.rb
CHANGED
@@ -21,7 +21,7 @@ module Bipbip
|
|
21
21
|
Bipbip.logger.info 'Startup...'
|
22
22
|
Bipbip.logger.warn 'No storages configured' if @storages.empty?
|
23
23
|
|
24
|
-
|
24
|
+
raise 'No services configured' if @plugins.empty?
|
25
25
|
|
26
26
|
@storages.each do |storage|
|
27
27
|
@plugins.each do |plugin|
|
data/lib/bipbip/plugin.rb
CHANGED
@@ -67,18 +67,18 @@ module Bipbip
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def metrics_schema
|
70
|
-
|
70
|
+
raise 'Missing method metrics_schema'
|
71
71
|
end
|
72
72
|
|
73
73
|
def monitor
|
74
|
-
|
74
|
+
raise 'Missing method monitor'
|
75
75
|
end
|
76
76
|
|
77
77
|
private
|
78
78
|
|
79
79
|
def run_measurement(time, storages)
|
80
80
|
data = monitor
|
81
|
-
|
81
|
+
raise "#{name} #{source_identifier}: Empty data" if data.empty?
|
82
82
|
log(Logger::DEBUG, "Data: #{data}")
|
83
83
|
storages.each do |storage|
|
84
84
|
storage.store_sample(self, time, data)
|
@@ -11,7 +11,7 @@ module Bipbip
|
|
11
11
|
uri = URI.parse(config['url'])
|
12
12
|
response = Net::HTTP.get_response(uri)
|
13
13
|
|
14
|
-
|
14
|
+
raise "Invalid response from server at #{config['url']}" unless response.code == '200'
|
15
15
|
|
16
16
|
astats = response.body.split(/\r*\n/)
|
17
17
|
|
@@ -55,7 +55,7 @@ module Bipbip
|
|
55
55
|
message = ['Command execution failed:', command]
|
56
56
|
message.push 'STDOUT:', output_stdout unless output_stdout.empty?
|
57
57
|
message.push 'STDERR:', output_stderr unless output_stderr.empty?
|
58
|
-
|
58
|
+
raise message.join("\n")
|
59
59
|
end
|
60
60
|
|
61
61
|
output_stdout
|
@@ -19,7 +19,7 @@ module Bipbip
|
|
19
19
|
ENV.replace(env_backup)
|
20
20
|
|
21
21
|
body = response.split(/\r?\n\r?\n/)[1]
|
22
|
-
|
22
|
+
raise "FastCGI response has no body: #{response}" unless body
|
23
23
|
stats = JSON.parse(body)
|
24
24
|
|
25
25
|
{ opcode_mem_size: stats['opcode_mem_size'].to_i, user_mem_size: stats['user_mem_size'].to_i }
|
@@ -21,7 +21,7 @@ module Bipbip
|
|
21
21
|
ENV.replace(env_backup)
|
22
22
|
|
23
23
|
body = response.split(/\r?\n\r?\n/)[1]
|
24
|
-
|
24
|
+
raise "FastCGI response has no body: #{response}" unless body
|
25
25
|
status = JSON.parse(body)
|
26
26
|
|
27
27
|
status.reject { |k, _v| !metrics_names.include?(k) }
|
@@ -24,7 +24,7 @@ module Bipbip
|
|
24
24
|
ENV.replace(env_backup)
|
25
25
|
|
26
26
|
body = response.split(/\r?\n\r?\n/)[1]
|
27
|
-
|
27
|
+
raise "FastCGI response has no body: #{response}" unless body
|
28
28
|
stats = JSON.parse(body)
|
29
29
|
@data_previous ||= stats
|
30
30
|
|
@@ -44,7 +44,7 @@ module Bipbip
|
|
44
44
|
def notifier
|
45
45
|
if @notifier.nil?
|
46
46
|
file_stat = File.stat(config['path'])
|
47
|
-
|
47
|
+
raise "Cannot read file `#{config['path']}`" unless file_stat.readable?
|
48
48
|
@lines = []
|
49
49
|
@size = file_stat.size
|
50
50
|
@notifier = create_notifier
|
@@ -77,15 +77,14 @@ module Bipbip
|
|
77
77
|
# @return [Mongo::Client]
|
78
78
|
def mongodb_client
|
79
79
|
options = {
|
80
|
-
|
81
|
-
'port' => 27_017
|
80
|
+
socket_timeout: 2
|
82
81
|
}.merge(config)
|
83
|
-
|
82
|
+
options = Hash[options.map { |(k, v)| [k.to_sym, v] }]
|
83
|
+
@mongodb_client ||= Mongo::Client.new([options[:hostname] + ':' + options[:port].to_s], options)
|
84
84
|
end
|
85
85
|
|
86
86
|
# @return [Mongo::DB]
|
87
87
|
def mongodb_database(db_name)
|
88
|
-
mongodb_client.with(config['username'], config['password']) unless config['password'].nil?
|
89
88
|
mongodb_client.use(db_name)
|
90
89
|
end
|
91
90
|
|
@@ -145,8 +144,8 @@ module Bipbip
|
|
145
144
|
primary = member_list.find { |member| member['stateStr'] == 'PRIMARY' }
|
146
145
|
secondary = member_list.find { |member| member['stateStr'] == 'SECONDARY' && member['self'] == true }
|
147
146
|
|
148
|
-
|
149
|
-
|
147
|
+
raise "No primary member in replica `#{status['set']}`" if primary.nil?
|
148
|
+
raise "Cannot find itself as secondary member in replica `#{status['set']}`" if secondary.nil?
|
150
149
|
|
151
150
|
(secondary['optime'].seconds - primary['optime'].seconds)
|
152
151
|
end
|
@@ -9,7 +9,7 @@ module Bipbip
|
|
9
9
|
def monitor
|
10
10
|
tcp_summary = `ss -s | grep '^TCP:'`
|
11
11
|
tcp_counters = /^TCP:\s+(\d+) \(estab (\d+), closed (\d+), orphaned (\d+), synrecv (\d+), timewait (\d+)\/(\d+)\), ports (\d+)$/.match(tcp_summary)
|
12
|
-
|
12
|
+
raise "Cannot match ss-output `#{tcp_summary}`" unless tcp_counters
|
13
13
|
|
14
14
|
{ connections_total: tcp_counters[1].to_i }
|
15
15
|
end
|
data/lib/bipbip/plugin/nginx.rb
CHANGED
@@ -17,7 +17,7 @@ module Bipbip
|
|
17
17
|
uri = URI.parse(config['url'])
|
18
18
|
response = Net::HTTP.get_response(uri)
|
19
19
|
|
20
|
-
|
20
|
+
raise "Invalid response from server at #{config['url']}" unless response.code == '200'
|
21
21
|
|
22
22
|
lines = response.body.split(/\r*\n/)
|
23
23
|
lines.map(&:strip!)
|
@@ -46,7 +46,7 @@ module Bipbip
|
|
46
46
|
def match_or_fail(string, regexp)
|
47
47
|
match_data = regexp.match(string)
|
48
48
|
if match_data.nil?
|
49
|
-
|
49
|
+
raise "Data `#{string}` doesn't match pattern `#{regexp}`."
|
50
50
|
end
|
51
51
|
match_data
|
52
52
|
end
|
@@ -11,7 +11,7 @@ module Bipbip
|
|
11
11
|
uri = URI.parse(config['url'])
|
12
12
|
response = Net::HTTP.get_response(uri)
|
13
13
|
|
14
|
-
|
14
|
+
raise "Invalid response from server at #{config['url']}" unless response.code == '200'
|
15
15
|
|
16
16
|
stats = JSON.parse(response.body)
|
17
17
|
|
@@ -25,7 +25,7 @@ module Bipbip
|
|
25
25
|
|
26
26
|
response = Net::HTTP.get_response(uri)
|
27
27
|
unless response.code == '200'
|
28
|
-
|
28
|
+
raise "Invalid response from server at `#{url}`. Response code `#{response.code}`, message `#{response.message}`, body `#{response.body}`"
|
29
29
|
end
|
30
30
|
|
31
31
|
JSON.parse(response.body)
|
data/lib/bipbip/storage.rb
CHANGED
@@ -14,11 +14,11 @@ module Bipbip
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def setup_plugin(_plugin)
|
17
|
-
|
17
|
+
raise 'Missing method setup_plugin'
|
18
18
|
end
|
19
19
|
|
20
20
|
def store_sample(_plugin, _time, _data)
|
21
|
-
|
21
|
+
raise 'Missing method store_sample'
|
22
22
|
end
|
23
23
|
|
24
24
|
private
|
@@ -58,7 +58,7 @@ module Bipbip
|
|
58
58
|
def store_sample(plugin, time, data)
|
59
59
|
response = ::Copperegg::Revealmetrics::MetricSample.save(plugin.metric_group, plugin.source_identifier, time.to_i, data)
|
60
60
|
if response.code != '200'
|
61
|
-
|
61
|
+
raise("Cannot store copperegg data `#{data}`. Response code `#{response.code}`, message `#{response.message}`, body `#{response.body}`")
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
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.14
|
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-
|
13
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: copperegg-revealmetrics
|