checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
---
2
2
SHA1:
3
- metadata.gz: 885a306c8bf9512200d821f865bdd4a31c2b7b50
4
- data.tar.gz: 02f78df9046ba0bd7383425c827cab3a21cf975b
3
+ metadata.gz: 0f76f4f53dc631c3b20206843e4ea30e5944ed1e
4
+ data.tar.gz: d9e2025697bee083a72e4b843670233b2d00f020
5
5
SHA512:
6
- metadata.gz: 549c90315740515c94b5246aa6d2e8bb72ba1d3ecf30129e6107d9747552db98ed301e5d262f63c3ce07eff191148b5802f94d1d54c6c12c91123919808990b9
7
- data.tar.gz: c73c809f48562396ffa59a42670738a9e82b6a36f7a0e0949518266525c4ee75d3c8e84d2d5b82147cb1420e351f57c012967db5f93a37c886970cee40503295
6
+ metadata.gz: cc318d9977507fc157a7a8844718f33e99b6c7c5345af70ebea0066b211092626f46539ed10e98dcc6fa439353a93eb79e03b7f20ff23b31f2dde7e99bc93ddc
7
+ data.tar.gz: 2beb568a8df2d5b7653e709fd43b68d2cf168434c3662b10840ae41aacc7319a24a60871b18fb7e7d4bac1451ff45342f910b39316da9e70cd3664c9cfd8b41b
data/lib/prometheus-config-builder/prometheus-config-builder.rb CHANGED
@@ -164,6 +164,8 @@ module PrometheusConfigBuilder
164
164
data["scrape_configs"] = []
165
165
end
166
166
167
+ FileUtils.mkdir_p(scrape_files_dir) if !File.exist?(scrape_files_dir)
168
+
167
169
@files.each do |file|
168
170
configs = file.get_scrape_configs(scrape_files_dir + "/" + File.basename(file.basename, ".*"))
169
171
data["scrape_configs"].push(*configs)
data/lib/prometheus-config-builder/scrape_ecs.rb CHANGED
@@ -12,7 +12,15 @@ module PrometheusConfigBuilder
12
12
$VERBOSE = nil
13
13
require 'aws-sdk'
14
14
15
- @@ecs = Aws::ECS::Client.new
15
+ if !config["region"]
16
+ logger.warn("File #{basename}: the scrape_configs of type:ecs-tasks doesn't have \"region\" field set. Ignoring!")
17
+ return nil
18
+
19
+ end
20
+
21
+ @@ecs = Aws::ECS::Client.new({
22
+ region:config["region"]
23
+ })
16
24
$VERBOSE = x
17
25
tasks = get_tasks(config["cluster"], config["service"])
18
26
ips = get_task_ips(config["cluster"], tasks)
@@ -25,19 +33,22 @@ module PrometheusConfigBuilder
25
33
]
26
34
27
35
if !config["name"]
28
- logger.warn("File #{basename}: the scrape_configs of type:ecs-tasks doesn't have name field set. Ignoring!")
36
+ logger.warn("File #{basename}: the scrape_configs of type:ecs-tasks doesn't have \"name\" field set. Ignoring!")
29
37
return nil
30
38
end
31
39
32
- File.open(dst_prefix + "_" + config["name"] + ".json", "w") do |file|
40
+ file = File.expand_path(dst_prefix + "_" + config["name"] + ".json")
41
+ File.open(file, "w") do |file|
33
42
file.write(data.to_json)
34
43
end
35
44
36
45
return {
37
- "job_name" => config["job_name"],
46
+ "job_name" => config["name"],
38
47
"metrics_path" => config["metrics_path"],
39
- "files" => [
40
- config["file"]
48
+ "file_sd_configs" => [
49
+ "files" => [
50
+ file
51
+ ]
41
52
]
42
53
}
43
54
end
data/prometheus-config-builder.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
4
4
Gem::Specification.new do |s|
5
5
s.name = 'prometheus-config-builder'
6
- s.version = '0.0.3'
6
+ s.version = '0.0.8'
7
7
s.date = Time.now
8
8
9
9
s.summary = %q{Template based config generation}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
--- !ruby/object:Gem::Specification
2
2
name: prometheus-config-builder
3
3
version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.8
5
5
platform: ruby
6
6
authors:
7
7
- Juho Mäkinen juho.makinen@gmail.com