bipbip 0.5.5 → 0.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c7106a05032baff36882166718dab6a9f841a9ae
4
- data.tar.gz: 05cc7a22a5f922d3bb17c549c84cf246c02c937f
3
+ metadata.gz: 1bec2860372eaee42bfc64e39e033ee4ce74f402
4
+ data.tar.gz: 9438b591064cb7e798637003d88e78b97687d48c
5
5
  SHA512:
6
- metadata.gz: 53e55ed811dd59bb2b737eaf8c87e3807adb4ad32ccc68eeaf4abe9da4b223e754d2974a7923f6c5dbaaddc323a80aad9a225e27a4cbed7e880751af9bd2a22a
7
- data.tar.gz: 677edcab879707381bc73ef1dd64b2fb308fd336bd0a3d2cd8e1dcc94de1b2b3aae2b7c9a67149d6c2267bd8af2c44e87f19f53e5f61aaf4886dd7b167fa54af
6
+ metadata.gz: 45c67935b276fa7d1dcf0e86f9900dbbb2173b516b05f7d892df024b7f2bf71ecaf5178e978ffd061d668a99c6783ffce006416e77e986fff680e33940406c53
7
+ data.tar.gz: aa836d01d8b62343a2a769fcad6aaca5a4eb5cac81221a745de6a0264d40efc202a5e45dbe55c5ef62e3700b66752f0d7c55c8c74592344c0e494fe23f080022
data/README.md CHANGED
@@ -105,6 +105,10 @@ services:
105
105
  regexp: segfault
106
106
  -
107
107
  plugin: postfix
108
+ -
109
+ plugin: elasticsearch
110
+ hostname: localhost
111
+ port: 9200
108
112
  ```
109
113
 
110
114
  Optional configuration common to all plugins:
@@ -0,0 +1,91 @@
1
+ require 'elasticsearch'
2
+ class ElasticsearchClient < Elasticsearch::Transport::Client
3
+ end
4
+
5
+ module Bipbip
6
+
7
+ class Plugin::Elasticsearch < Plugin
8
+
9
+ def metrics_schema
10
+ [
11
+ {:name => 'store_size', :type => 'gauge', :unit => 'b'},
12
+ {:name => 'docs_count', :type => 'gauge', :unit => 'Docs'},
13
+ {:name => 'docs_deleted', :type => 'counter', :unit => 'Deleted'},
14
+ {:name => 'segments_count', :type => 'gauge', :unit => 'Segments'},
15
+
16
+ {:name => 'search_query_total', :type => 'counter', :unit => 'Queries'},
17
+ {:name => 'search_query_time', :type => 'counter', :unit => 'Seconds'},
18
+ {:name => 'search_fetch_total', :type => 'counter', :unit => 'Fetches'},
19
+ {:name => 'search_fetch_time', :type => 'counter', :unit => 'Seconds'},
20
+
21
+ {:name => 'get_total', :type => 'counter', :unit => 'Gets'},
22
+ {:name => 'get_time', :type => 'counter', :unit => 'Seconds'},
23
+ {:name => 'get_exists_total', :type => 'counter', :unit => 'Exists'},
24
+ {:name => 'get_exists_time', :type => 'counter', :unit => 'Seconds'},
25
+ {:name => 'get_missing_total', :type => 'counter', :unit => 'Missing'},
26
+ {:name => 'get_missing_time', :type => 'counter', :unit => 'Seconds'},
27
+
28
+ {:name => 'indexing_index_total', :type => 'counter', :unit => 'Indexes'},
29
+ {:name => 'indexing_index_time', :type => 'counter', :unit => 'Seconds'},
30
+ {:name => 'indexing_delete_total', :type => 'counter', :unit => 'Deletes'},
31
+ {:name => 'indexing_delete_time', :type => 'counter', :unit => 'Seconds'},
32
+
33
+ {:name => 'cache_filter_size', :type => 'gauge', :unit => 'b'},
34
+ {:name => 'cache_filter_evictions', :type => 'gauge', :unit => 'b'},
35
+ {:name => 'cache_field_size', :type => 'gauge', :unit => 'b'},
36
+ {:name => 'cache_field_evictions', :type => 'gauge', :unit => 'b'},
37
+ ]
38
+ end
39
+
40
+ def monitor
41
+ @stats = nil
42
+ {
43
+ 'store_size' => stats_sum(['indices', 'store', 'size_in_bytes']),
44
+ 'docs_count' => stats_sum(['indices', 'docs', 'count']),
45
+ 'docs_deleted' => stats_sum(['indices', 'docs', 'deleted']),
46
+ 'segments_count' => stats_sum(['indices', 'segments', 'count']),
47
+
48
+ 'search_query_total' => stats_sum(['indices', 'search', 'query_total']),
49
+ 'search_query_time' => stats_sum(['indices', 'search', 'query_time_in_millis'])/1000,
50
+ 'search_fetch_total' => stats_sum(['indices', 'search', 'fetch_total']),
51
+ 'search_fetch_time' => stats_sum(['indices', 'search', 'fetch_time_in_millis'])/1000,
52
+
53
+ 'get_total' => stats_sum(['indices', 'get', 'total']),
54
+ 'get_time' => stats_sum(['indices', 'get', 'time_in_millis'])/1000,
55
+ 'get_exists_total' => stats_sum(['indices', 'get', 'exists_total']),
56
+ 'get_exists_time' => stats_sum(['indices', 'get', 'exists_time_in_millis'])/1000,
57
+ 'get_missing_total' => stats_sum(['indices', 'get', 'missing_total']),
58
+ 'get_missing_time' => stats_sum(['indices', 'get', 'missing_time_in_millis'])/1000,
59
+
60
+ 'indexing_index_total' => stats_sum(['indices', 'indexing', 'index_total']),
61
+ 'indexing_index_time' => stats_sum(['indices', 'indexing', 'index_time_in_millis'])/1000,
62
+ 'indexing_delete_total' => stats_sum(['indices', 'indexing', 'delete_total']),
63
+ 'indexing_delete_time' => stats_sum(['indices', 'indexing', 'delete_time_in_millis'])/1000,
64
+
65
+ 'cache_filter_size' => stats_sum(['indices', 'filter_cache', 'memory_size_in_bytes']),
66
+ 'cache_filter_evictions' => stats_sum(['indices', 'filter_cache', 'evictions']),
67
+ 'cache_field_size' => stats_sum(['indices', 'fielddata', 'memory_size_in_bytes']),
68
+ 'cache_field_evictions' => stats_sum(['indices', 'fielddata', 'evictions']),
69
+ }
70
+ end
71
+
72
+ private
73
+
74
+ def connection
75
+ ElasticsearchClient.new({:host => [config['hostname'], config['port']].join(':')})
76
+ end
77
+
78
+ def nodes_stats
79
+ connection.nodes.stats({:node_id => '_local'})
80
+ end
81
+
82
+ def stats_sum(keys)
83
+ sum = 0
84
+ (@stats ||= nodes_stats)['nodes'].each do |node, stats|
85
+ sum += keys.inject(stats) { |h, k| (h.is_a?(Hash) and !h[k].nil?) ? h[k] : 0 }
86
+ end
87
+ sum
88
+ end
89
+
90
+ end
91
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.5.5'
2
+ VERSION = '0.5.6'
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.5
4
+ version: 0.5.6
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: 2014-12-01 00:00:00.000000000 Z
13
+ date: 2014-12-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg
@@ -166,6 +166,20 @@ dependencies:
166
166
  - - "~>"
167
167
  - !ruby/object:Gem::Version
168
168
  version: 0.9.5
169
+ - !ruby/object:Gem::Dependency
170
+ name: elasticsearch
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: 1.0.6
176
+ type: :runtime
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: 1.0.6
169
183
  - !ruby/object:Gem::Dependency
170
184
  name: rake
171
185
  requirement: !ruby/object:Gem::Requirement
@@ -211,6 +225,7 @@ files:
211
225
  - lib/bipbip/helper.rb
212
226
  - lib/bipbip/plugin.rb
213
227
  - lib/bipbip/plugin/apache2.rb
228
+ - lib/bipbip/plugin/elasticsearch.rb
214
229
  - lib/bipbip/plugin/fastcgi_php_apc.rb
215
230
  - lib/bipbip/plugin/fastcgi_php_fpm.rb
216
231
  - lib/bipbip/plugin/fastcgi_php_opcache.rb