riemann-mongodb 0.2.0 → 0.3.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 +8 -8
- data/README.md +3 -1
- data/bin/riemann-mongodb-serverstatus +52 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzAzOTE5MzkwNzliN2NhZmM5OGI1NDAzMDZjYjU2MTE5NmUxM2EzMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2QxNWVmNTc1YWE4Mzg1ZjU1ZDM4M2M1ZmRiNzIyMTQwMWM2MjcxYw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OWNlOTg1ZjM2MDIzNGQxZWExNzMwYzAwZGUwZmQ3MWYxZTUwMTIwYjIyNTk4
|
10
|
+
N2NmMjBkOWYxMDNhNzU4NjU0MjJjM2JmOTI4Y2Q4MjMxZDQ0MWQwZGJlZGFj
|
11
|
+
Zjg0NGE2NDRjMDI3OGEzYmZjZTA5MWJiZWNlNGNiNjI2ZWU0ZWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDhkNzdmOTQ0MzMyZjBjMjhjNzEzMjJkYmJkNDgyNmJiNjE0ZDg3NjQyOGYx
|
14
|
+
ZjlhNDg3ZmVkYTQxNTliYjdlNTI5ODcxZmU5ZjJkMmNiMTM5MTFmMTYzOGNl
|
15
|
+
NWM4ZTQzNzI4Yjk4MGMyNjI5OTE5NjIyYWZkNzhlMzViNGM2ODk=
|
data/README.md
CHANGED
@@ -6,6 +6,7 @@ Simple mongodb riemann client.
|
|
6
6
|
|
7
7
|
A client which submits the result of db.stats() query into riemann.
|
8
8
|
A second client to monitor replication set status, using rs.status() query.
|
9
|
+
A third client to submit server status by gathering metrics from db.serverStatus() query,
|
9
10
|
|
10
11
|
|
11
12
|
Get started
|
@@ -15,4 +16,5 @@ Get started
|
|
15
16
|
gem install riemann-mongodb
|
16
17
|
riemann-mongodb --help
|
17
18
|
riemann-mongodb-rs-status --help
|
18
|
-
|
19
|
+
riemann-mongodb-serverstatus --help
|
20
|
+
```
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Runs serverStatus command, or db.serverStatus() from the shell and send metrics to riemann.
|
4
|
+
|
5
|
+
require 'riemann/tools'
|
6
|
+
|
7
|
+
class Riemann::Tools::Mongo
|
8
|
+
include Riemann::Tools
|
9
|
+
require 'mongo'
|
10
|
+
|
11
|
+
opt :mongo_host, "Mongo hostname", :default => 'localhost'
|
12
|
+
opt :mongo_port, "Mongo port", :default => 27017
|
13
|
+
opt :mongo_db, "Mongo database", :default => 'local'
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@db = ::Mongo::MongoClient.new(opts[:mongo_host], opts[:mongo_port]).db(opts[:mongo_db])
|
17
|
+
@cmd = {"serverStatus"=>1}
|
18
|
+
end
|
19
|
+
|
20
|
+
def tick
|
21
|
+
begin
|
22
|
+
response = @db.command(@cmd)
|
23
|
+
rescue => e
|
24
|
+
report(
|
25
|
+
:host => opts[:mongo_host],
|
26
|
+
:service => "mongodb health",
|
27
|
+
:description => "Connection error: #{e.class} - #{e.message}"
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
return if response.nil?
|
32
|
+
|
33
|
+
response.each do |base_metric, rest_metric|
|
34
|
+
if rest_metric.is_a?(Hash)
|
35
|
+
rest_metric.each do |tag, value|
|
36
|
+
if !value.is_a? Fixnum
|
37
|
+
next
|
38
|
+
end
|
39
|
+
report(
|
40
|
+
:host => opts[:mongo_host],
|
41
|
+
:service => "mongo." + base_metric.downcase + "." + tag.downcase,
|
42
|
+
:metric => value.to_f,
|
43
|
+
:state => "ok",
|
44
|
+
:tags => ["mongodb"]
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
Riemann::Tools::Mongo.run
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-mongodb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fede Borgnia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riemann-tools
|
@@ -56,11 +56,13 @@ description:
|
|
56
56
|
email: fborgnia@gmail.com
|
57
57
|
executables:
|
58
58
|
- riemann-mongodb-rs-status
|
59
|
+
- riemann-mongodb-serverstatus
|
59
60
|
- riemann-mongodb
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
63
64
|
- bin/riemann-mongodb-rs-status
|
65
|
+
- bin/riemann-mongodb-serverstatus
|
64
66
|
- bin/riemann-mongodb
|
65
67
|
- LICENSE
|
66
68
|
- README.md
|
@@ -86,5 +88,5 @@ rubyforge_project: riemann-mongodb
|
|
86
88
|
rubygems_version: 2.1.11
|
87
89
|
signing_key:
|
88
90
|
specification_version: 4
|
89
|
-
summary: MongoDB
|
91
|
+
summary: MongoDB clients to submits metrics to Riemann.
|
90
92
|
test_files: []
|