riemann-mesos 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/riemann-mesos +51 -1
  3. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7cd206bdeee53822299ec8bb3a50c221fbed6bfc
4
- data.tar.gz: 3164e1f5a7e155edb37c3268b809ac120f1ccaf3
3
+ metadata.gz: 580375fff9724182015dcf002a8bc80678d77abc
4
+ data.tar.gz: e1681f1bd67112ec6edff005c02addba15c36b5e
5
5
  SHA512:
6
- metadata.gz: 04db09475bd3a51023443c13e18b450273300bb05c4437f297f5bdc3c85e10872304568f16d303932e0ead7f3d5826ac1413c92d52e425f681cddc26cd54dcbe
7
- data.tar.gz: f59832a7a81c0eb41a58701f384be6f51de8b505d9d3249a005ae568b639d03590df98b47cea6844a4479addc9c99c6397ae125b1e7efcc576a4225502a09cc9
6
+ metadata.gz: 8a8c94d4cbe322b507e4497e035c91d605923f52d6f5146003ea0d5a0f5d9475d3934751638146d3b5defb44fa1a71eab47fdc20f73f3aa1b2076a52a493231e
7
+ data.tar.gz: 7c35d7ebe0ed585c8d2b270c368a9ef54fcaa8c7a0682d05ca08d3e861e46ff6cdab917bae69d3fd49e69a1bb51fc9e244c7454bcd3203068ccaa79aa2d89dbb
data/bin/riemann-mesos CHANGED
@@ -42,7 +42,16 @@ class Riemann::Tools::Mesos
42
42
  "http://#{options[:mesos_host]}:#{options[:mesos_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/metrics/snapshot"
43
43
  end
44
44
 
45
+ def slaves_url
46
+ path_prefix = options[:path_prefix]
47
+ path_prefix[0] = '' if path_prefix[0]=='/'
48
+ path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
49
+ "http://#{options[:mesos_host]}:#{options[:mesos_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/master/slaves"
50
+ end
51
+
52
+
45
53
  def tick
54
+ tick_slaves
46
55
  uri = URI(health_url)
47
56
  response = safe_get(uri)
48
57
 
@@ -68,13 +77,54 @@ class Riemann::Tools::Mesos
68
77
  :service => "mesos #{k}",
69
78
  :metric => v
70
79
  )
71
-
72
80
  end
73
81
  end
74
82
  end
75
83
 
84
+ def tick_slaves
85
+ uri = URI(slaves_url)
86
+ response = safe_get(uri)
76
87
 
88
+ return if response.nil?
77
89
 
90
+ if response.status != 200
91
+ report(:host => uri.host,
92
+ :service => "mesos health",
93
+ :state => "critical",
94
+ :description => "HTTP connection error: #{response.status} - #{response.body}"
95
+ )
96
+ else
97
+ # Assuming that a 200 will give json
98
+ json = JSON.parse(response.body)
99
+ state = "ok"
100
+
101
+ report(:host => uri.host,
102
+ :service => "mesos health",
103
+ :state => state)
104
+
105
+ json["slaves"].each do |slave|
106
+ if slave.respond_to? "each_pair"
107
+ slave.each_pair do |k,v|
108
+ if v.respond_to? "each_pair"
109
+ v.each_pair do |k1,v1|
110
+ if v1.is_a? Numeric
111
+ report(:host => slave["hostname"],
112
+ :service => "mesos slave/#{k}/#{k1}",
113
+ :metric => v1
114
+ )
115
+ end
116
+ end
117
+ elsif v.is_a? Numeric
118
+ report(:host => slave["hostname"],
119
+ :service => "mesos slave/#{k}",
120
+ :metric => v
121
+ )
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
127
+ end
78
128
  end
79
129
  Riemann::Tools::Mesos.run
80
130
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-mesos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giulio Eulisse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: riemann-tools
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.7
19
+ version: 0.2.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.7
26
+ version: 0.2.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,8 +62,9 @@ files:
62
62
  - LICENSE
63
63
  - README.md
64
64
  - bin/riemann-mesos
65
- homepage: https://github.com/riemann/riemann-mesos
66
- licenses: []
65
+ homepage: https://github.com/riemann/riemann-tools
66
+ licenses:
67
+ - MIT
67
68
  metadata: {}
68
69
  post_install_message:
69
70
  rdoc_options: []