bipbip 0.6.22 → 0.6.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bipbip/plugin/mongodb.rb +23 -1
- data/lib/bipbip/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5add0615083de3e6e65144b8d3e8595aeae99f92
|
4
|
+
data.tar.gz: cc10bece60af5768c38c579244caca1f22de048f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d37e21902e8c5e8aa61178fb341dd7c27a7e88e6204a9cb3192bdd0b138e7cfe3e968b9cc80f2d9a303331d836fbe4858df8e11fd62727f5b967dcd01ca669af
|
7
|
+
data.tar.gz: 00678bbd5ce3c3ae3433052e3052be654182d97d6793855f59ce851873df70eef459fde451f294ade4771da87ec6bc69a51741d5b39c0113bd88ac16373242de
|
@@ -20,13 +20,16 @@ module Bipbip
|
|
20
20
|
{ name: 'replication_lag', type: 'gauge', unit: 'Seconds' },
|
21
21
|
{ name: 'slow_queries_count', type: 'gauge_f', unit: 'Queries' },
|
22
22
|
{ name: 'slow_queries_time_avg', type: 'gauge_f', unit: 'Seconds' },
|
23
|
-
{ name: 'slow_queries_time_max', type: 'gauge_f', unit: 'Seconds' }
|
23
|
+
{ name: 'slow_queries_time_max', type: 'gauge_f', unit: 'Seconds' },
|
24
|
+
{ name: 'total_index_size', type: 'gauge', unit: 'MB' },
|
25
|
+
{ name: 'total_index_size_percentage_of_memory', type: 'gauge', unit: '%' }
|
24
26
|
]
|
25
27
|
end
|
26
28
|
|
27
29
|
def monitor
|
28
30
|
status = fetch_server_status
|
29
31
|
slow_queries_status = fetch_slow_queries_status
|
32
|
+
all_index_size = total_index_size
|
30
33
|
|
31
34
|
data = {}
|
32
35
|
|
@@ -65,6 +68,9 @@ module Bipbip
|
|
65
68
|
data['slow_queries_time_avg'] = slow_queries_status['total']['time'].to_f / (slow_queries_status['total']['count'].to_f.nonzero? || 1)
|
66
69
|
data['slow_queries_time_max'] = slow_queries_status['max']['time']
|
67
70
|
|
71
|
+
data['total_index_size'] = all_index_size / (1024 * 1024)
|
72
|
+
data['total_index_size_percentage_of_memory'] = (all_index_size.to_f / total_system_memory.to_f) * 100
|
73
|
+
|
68
74
|
data
|
69
75
|
end
|
70
76
|
|
@@ -103,6 +109,22 @@ module Bipbip
|
|
103
109
|
old
|
104
110
|
end
|
105
111
|
|
112
|
+
# @return [Integer]
|
113
|
+
def total_index_size
|
114
|
+
database_names_ignore = %w(admin system local)
|
115
|
+
database_list = (mongodb_client.database_names - database_names_ignore).map { |name| mongodb_database(name) }
|
116
|
+
|
117
|
+
database_list.map do |database|
|
118
|
+
results = database.command('dbstats' => 1)
|
119
|
+
results.count == 0 ? 0 : results.documents.first['indexSize']
|
120
|
+
end.reduce(:+)
|
121
|
+
end
|
122
|
+
|
123
|
+
# @return [Integer]
|
124
|
+
def total_system_memory
|
125
|
+
`free -b`.lines.to_a[1].split[1].to_i
|
126
|
+
end
|
127
|
+
|
106
128
|
def fetch_slow_queries_status
|
107
129
|
timestamp_last_check = slow_query_last_check
|
108
130
|
time_period = Time.now - timestamp_last_check
|
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.23
|
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-07-
|
13
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: copperegg-revealmetrics
|
@@ -314,7 +314,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
314
314
|
version: '0'
|
315
315
|
requirements: []
|
316
316
|
rubyforge_project:
|
317
|
-
rubygems_version: 2.
|
317
|
+
rubygems_version: 2.5.0
|
318
318
|
signing_key:
|
319
319
|
specification_version: 4
|
320
320
|
summary: Gather services data and store in CopperEgg
|