riemann-marathon 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/riemann-marathon +51 -2
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd6b63f80a80454f635f0f2365b77f06667ac7ae
|
4
|
+
data.tar.gz: 8d165f8ab4f066f0c33c63c89235b69c05be9182
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02bbbeb5253be11f51a217681b6d10fed4a6b75d82c358d9bee4193343ac805eccb9524921fdae0a05dccceb2af3c341375fc71bf709bb209b191fb87b861363
|
7
|
+
data.tar.gz: f0765a7f957cc736626b54038ce385b152f2a242a270b891500ae679116d2afbdadcb633864ed1d670fbabf93c2fee6a72bdb6c0eb2869f21f44d110cb3d6654
|
data/bin/riemann-marathon
CHANGED
@@ -47,7 +47,19 @@ class Riemann::Tools::Marathon
|
|
47
47
|
"http://#{options[:marathon_host]}:#{options[:marathon_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/metrics"
|
48
48
|
end
|
49
49
|
|
50
|
+
def apps_url
|
51
|
+
path_prefix = options[:path_prefix]
|
52
|
+
path_prefix[0] = '' if path_prefix[0]=='/'
|
53
|
+
path_prefix[path_prefix.length-1] = '' if path_prefix[path_prefix.length-1]=='/'
|
54
|
+
"http://#{options[:marathon_host]}:#{options[:marathon_port]}#{path_prefix.length>0?'/':''}#{path_prefix}/v2/apps"
|
55
|
+
end
|
56
|
+
|
50
57
|
def tick
|
58
|
+
tick_health
|
59
|
+
tick_apps
|
60
|
+
end
|
61
|
+
|
62
|
+
def tick_health
|
51
63
|
uri = URI(health_url)
|
52
64
|
response = safe_get(uri)
|
53
65
|
|
@@ -74,7 +86,8 @@ class Riemann::Tools::Marathon
|
|
74
86
|
report(:host => uri.host,
|
75
87
|
:service => "marathon_metric #{t} #{service}",
|
76
88
|
:metric => 1,
|
77
|
-
:tags => ["metric_name"]
|
89
|
+
:tags => ["metric_name"],
|
90
|
+
:ttl => 600
|
78
91
|
)
|
79
92
|
if counters.respond_to? :each_pair
|
80
93
|
counters.each_pair do |k, v|
|
@@ -82,7 +95,8 @@ class Riemann::Tools::Marathon
|
|
82
95
|
report(:host => uri.host,
|
83
96
|
:service => "marathon #{service} #{k}",
|
84
97
|
:metric => v,
|
85
|
-
:tags => ["metric", "#{t}"]
|
98
|
+
:tags => ["metric", "#{t}"],
|
99
|
+
:ttl => 600
|
86
100
|
)
|
87
101
|
end
|
88
102
|
end
|
@@ -92,6 +106,41 @@ class Riemann::Tools::Marathon
|
|
92
106
|
end
|
93
107
|
end
|
94
108
|
end
|
109
|
+
|
110
|
+
def tick_apps
|
111
|
+
uri = URI(apps_url)
|
112
|
+
response = safe_get(uri)
|
113
|
+
|
114
|
+
return if response.nil?
|
115
|
+
|
116
|
+
if response.status != 200
|
117
|
+
report(:host => uri.host,
|
118
|
+
:service => "marathon health",
|
119
|
+
:state => "critical",
|
120
|
+
:description => "HTTP connection error: #{response.status} - #{response.body}"
|
121
|
+
)
|
122
|
+
else
|
123
|
+
# Assuming that a 200 will give json
|
124
|
+
json = JSON.parse(response.body)
|
125
|
+
state = "ok"
|
126
|
+
|
127
|
+
report(:host => uri.host,
|
128
|
+
:service => "marathon health",
|
129
|
+
:state => state)
|
130
|
+
|
131
|
+
json["apps"].each do |app|
|
132
|
+
app.each_pair do |k, v|
|
133
|
+
if v.is_a? Numeric
|
134
|
+
report(:host => uri.host,
|
135
|
+
:service => "marathon apps#{app["id"]}/#{k}",
|
136
|
+
:metric => v,
|
137
|
+
:ttl => 120
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
95
144
|
end
|
96
145
|
Riemann::Tools::Marathon.run
|
97
146
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-marathon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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-
|
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.
|
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.
|
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-marathon
|
65
|
-
homepage: https://github.com/riemann/riemann-
|
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: []
|
@@ -84,5 +85,5 @@ rubyforge_project: riemann-marathon
|
|
84
85
|
rubygems_version: 2.4.5
|
85
86
|
signing_key:
|
86
87
|
specification_version: 4
|
87
|
-
summary: Submits
|
88
|
+
summary: Submits Marathon stats to riemann.
|
88
89
|
test_files: []
|