bipbip 0.3.2 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45274bbe7182dd672c7dc5f66ed08516335fdf30
4
- data.tar.gz: 81a7a317a3957a9de8a15816b27cb44317b2aa2f
3
+ metadata.gz: a28d94daa5948e8d2d19b0470144fa3211df50ad
4
+ data.tar.gz: b2f7c1572c720a2aafb2f22576aa0756a34e9c80
5
5
  SHA512:
6
- metadata.gz: 9d1da584fef95f69371667bd892e1cb70541f31d192a2cd449e67a824361a4edcb2ee37414817a1eff985884e40622858958df5130dfee672e417a3760bc47a4
7
- data.tar.gz: 7d0aa96409b2ccad6ede7ebb39274c01ba8453c87eae5f526d003b71f5b0141bb882231d5fff0e21867b993885ccf11f9e05ceb2f6af7af7dc1028ecb9459089
6
+ metadata.gz: 9958916659974ec89bfd7cb4bb171b547f6aca391387a7b076f1172e43d9b8a8194e913216dcd68428286e0d22a4b25fd854f50f5f11635e5a80032156cf0dcf
7
+ data.tar.gz: 958262bfea6d4af131f14de67a2edc77eacf5dff2d7b4ee77157b404422703e127ce20c380147bd7b3a22d0005bbbb402f1bf2fe8eaaced4b6d03f56d819884e
data/README.md CHANGED
@@ -40,6 +40,12 @@ services:
40
40
  port: 3306
41
41
  username: root
42
42
  password: root
43
+ -
44
+ plugin: mongodb
45
+ hostname: localhost
46
+ port: 27017
47
+ username:
48
+ password:
43
49
  -
44
50
  plugin: redis
45
51
  hostname: localhost
@@ -142,3 +148,16 @@ They should include a class `Plugin::MyPlugin` in the `BipBip` module extending
142
148
  On that class the functions `metrics_schema` and `monitor` should be implemented.
143
149
 
144
150
  For a complete example see [cargomedia/bipbip-random-example](https://github.com/cargomedia/bipbip-random-example).
151
+
152
+ Development
153
+ -----------
154
+ Start and provision the development-VM with vagrant, then log in:
155
+ ```
156
+ vagrant up
157
+ vagrant ssh
158
+ ```
159
+
160
+ You can then run `bipbip` from within the mounted projected root directory:
161
+ ```
162
+ /vagrant/bin/bipbip
163
+ ```
@@ -0,0 +1,90 @@
1
+ require 'mongo'
2
+
3
+ module Bipbip
4
+
5
+ class Plugin::Mongodb < Plugin
6
+
7
+ def metrics_schema
8
+ [
9
+ {:name => 'flushing_flushes', :type => 'counter', :unit => 'flushes'},
10
+ {:name => 'flushing_total_ms', :type => 'gauge', :unit => 'ms'},
11
+ {:name => 'flushing_average_ms', :type => 'gauge', :unit => 'ms'},
12
+ {:name => 'flushing_last_ms', :type => 'gauge', :unit => 'ms'},
13
+ {:name => 'btree_accesses', :type => 'gauge', :unit => 'accesses'},
14
+ {:name => 'btree_misses', :type => 'gauge', :unit => 'misses'},
15
+ {:name => 'btree_hits', :type => 'gauge', :unit => 'hits'},
16
+ {:name => 'btree_resets', :type => 'gauge', :unit => 'resets'},
17
+ {:name => 'cursors_totalOpen', :type => 'gauge', :unit => 'crs'},
18
+ {:name => 'cursors_timedOut', :type => 'gauge', :unit => 'crs/sec'},
19
+ {:name => 'op_inserts', :type => 'counter'},
20
+ {:name => 'op_queries', :type => 'counter'},
21
+ {:name => 'op_updates', :type => 'counter'},
22
+ {:name => 'op_deletes', :type => 'counter'},
23
+ {:name => 'op_getmores', :type => 'counter'},
24
+ {:name => 'op_commands', :type => 'counter'},
25
+ {:name => 'asserts_regular', :type => 'counter'},
26
+ {:name => 'asserts_warning', :type => 'counter'},
27
+ {:name => 'asserts_msg', :type => 'counter'},
28
+ {:name => 'asserts_user', :type => 'counter'},
29
+ {:name => 'asserts_rollover', :type => 'counter'},
30
+ {:name => 'connections_available', :type => 'gauge'},
31
+ {:name => 'connections_current', :type => 'gauge'},
32
+ {:name => 'mem_resident', :type => 'gauge', :unit => 'MB'},
33
+ {:name => 'mem_virtual', :type => 'gauge', :unit => 'MB'},
34
+ {:name => 'mem_mapped', :type => 'gauge', :unit => 'MB'},
35
+ {:name => 'mem_pagefaults', :type => 'gauge', :unit => 'faults'},
36
+ {:name => 'globalLock_ratio', :type => 'gauge', :unit => '%'},
37
+ {:name => 'globalLock_currentQueue', :type => 'gauge'},
38
+ {:name => 'globalLock_activeClients', :type => 'gauge'},
39
+ {:name => 'uptime', :type => 'counter', :unit => 's'},
40
+ ]
41
+ end
42
+
43
+ def monitor
44
+ options = {
45
+ 'hostname' => 'localhost',
46
+ 'port' => 27017,
47
+ 'username' => nil,
48
+ 'password' => nil
49
+ }.merge(config)
50
+ connection = Mongo::MongoClient.new(options['hostname'], options['port'], {:op_timeout => 2, :slave_ok => true})
51
+ mongo = connection.db('admin')
52
+ mongo.authenticate(options['username'], options['password']) unless options['password'].nil?
53
+ mongoStats = mongo.command('serverStatus' => 1)
54
+
55
+ {
56
+ 'btree_accesses' => mongoStats['indexCounters']['accesses'].to_i,
57
+ 'btree_misses' => mongoStats['indexCounters']['misses'].to_i,
58
+ 'btree_hits' => mongoStats['indexCounters']['hits'].to_i,
59
+ 'btree_resets' => mongoStats['indexCounters']['resets'].to_i,
60
+ 'flushing_flushes' => mongoStats['backgroundFlushing']['flushes'].to_i,
61
+ 'flushing_total_ms' => mongoStats['backgroundFlushing']['total_ms'].to_i,
62
+ 'flushing_average_ms' => mongoStats['backgroundFlushing']['average_ms'].to_i,
63
+ 'flushing_last_ms' => mongoStats['backgroundFlushing']['last_ms'].to_i,
64
+ 'cursors_totalOpen' => mongoStats['cursors']['totalOpen'].to_i,
65
+ 'cursors_timedOut' => mongoStats['cursors']['timedOut'].to_i,
66
+ 'op_inserts' => mongoStats['opcounters']['insert'].to_i,
67
+ 'op_queries' => mongoStats['opcounters']['query'].to_i,
68
+ 'op_updates' => mongoStats['opcounters']['update'].to_i,
69
+ 'op_deletes' => mongoStats['opcounters']['delete'].to_i,
70
+ 'op_getmores' => mongoStats['opcounters']['getmore'].to_i,
71
+ 'op_commands' => mongoStats['opcounters']['command'].to_i,
72
+ 'asserts_regular' => mongoStats['asserts']['regular'].to_i,
73
+ 'asserts_warning' => mongoStats['asserts']['warning'].to_i,
74
+ 'asserts_msg' => mongoStats['asserts']['msg'].to_i,
75
+ 'asserts_user' => mongoStats['asserts']['user'].to_i,
76
+ 'asserts_rollover' => mongoStats['asserts']['rollovers'].to_i,
77
+ 'connections_available' => mongoStats['connections']['available'].to_i,
78
+ 'connections_current' => mongoStats['connections']['current'].to_i,
79
+ 'mem_resident' => mongoStats['mem']['resident'].to_i,
80
+ 'mem_virtual' => mongoStats['mem']['virtual'].to_i,
81
+ 'mem_mapped' => mongoStats['mem']['mapped'].to_i,
82
+ 'mem_pagefaults' => mongoStats['extra_info']['page_faults'],
83
+ 'globalLock_ratio' => (mongoStats['globalLock']['lockTime'] / mongoStats['globalLock']['totalTime'] * 100).to_f,
84
+ 'globalLock_currentQueue' => mongoStats['globalLock']['currentQueue']['total'].to_i,
85
+ 'globalLock_activeClients' => mongoStats['globalLock']['activeClients']['total'].to_i,
86
+ 'uptime' => mongoStats['uptime'].to_i,
87
+ }
88
+ end
89
+ end
90
+ end
@@ -1,3 +1,3 @@
1
1
  module Bipbip
2
- VERSION = '0.3.2'
2
+ VERSION = '0.4.0'
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.3.2
4
+ version: 0.4.0
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-07-17 00:00:00.000000000 Z
13
+ date: 2014-08-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: copperegg
@@ -110,6 +110,34 @@ dependencies:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0.3'
113
+ - !ruby/object:Gem::Dependency
114
+ name: mongo
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '1.10'
120
+ type: :runtime
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '1.10'
127
+ - !ruby/object:Gem::Dependency
128
+ name: bson_ext
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '1.10'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '1.10'
113
141
  - !ruby/object:Gem::Dependency
114
142
  name: rake
115
143
  requirement: !ruby/object:Gem::Requirement
@@ -160,6 +188,7 @@ files:
160
188
  - lib/bipbip/plugin/fastcgi_php_opcache.rb
161
189
  - lib/bipbip/plugin/gearman.rb
162
190
  - lib/bipbip/plugin/memcached.rb
191
+ - lib/bipbip/plugin/mongodb.rb
163
192
  - lib/bipbip/plugin/monit.rb
164
193
  - lib/bipbip/plugin/mysql.rb
165
194
  - lib/bipbip/plugin/network.rb