prometheus-config-builder 0.0.35 → 0.0.37

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
  SHA256:
3
- metadata.gz: fad93a97d519791b5c5ab9ee0f568351121f8c54eed6225d52fa5cff79ef8f90
4
- data.tar.gz: 3aa99cff62edb2f8f63f56e9cb4152ef8c1fc404e1ad60d1961f687d0696e821
3
+ metadata.gz: '085719ad0e380d22f81fec086b9c676fe6b461ff1c9c68b267c4f5cc9df5ce87'
4
+ data.tar.gz: 704746b2229f14dc4227b05097e67c38ce3add5d5aa438763579c2b74590c7cd
5
5
  SHA512:
6
- metadata.gz: d6d2899efb323a685313ae4b8e7b922bc53e299fddf395e270313bb0965f9b43f30142dc402fb125fdba3e0006002abeec6f4dc1af9585e03eebbf57789b178a
7
- data.tar.gz: c1a93741234ee7234bb9c2c1bc77bd40ad8feea25533c5c040015ed492cdadd0708f00562927bc80e4f2b5757baabf8174b58bb4778ec4aab620183c8fa6291b
6
+ metadata.gz: '038ed8f40b32fe0e8e382936777389946bf8b40606f9302956bea3d5b1ae136692b256c378bbda3ef79f948de490d5baa53fb5452b307d3b13efb9128568e999'
7
+ data.tar.gz: 9b0a6bcd89f4a39c83446216ffc029f6b7e67447824ed7b2db05739d081273223ae906d0f4a9ff31e97e229684a06b73ee45791c2adbca34c2426c414a05dab1
@@ -48,6 +48,10 @@ op = OptionParser.new do |o|
48
48
  o.on('--pgrep=[string]', 'pgrep -f [string] for finding Prometheus process for SIGHUP') do |str|
49
49
  config[:pgrep] = str
50
50
  end
51
+ o.on('--addlog=[FILE]', 'addlog -f [FILE] Log additionally to this file') do |str|
52
+ config[:addlog] = str
53
+ end
54
+
51
55
  end
52
56
  op.parse!
53
57
 
@@ -58,9 +62,18 @@ end
58
62
  abort "You need to set --prometheus-src" if !config[:prometheus_src]
59
63
  abort "You need to set --dst-dir" if !config[:dst_dir]
60
64
 
65
+ if config[:addlog]
66
+ filelog = File.open(config[:addlog], File::WRONLY | File::APPEND)
67
+ else
68
+ filelog = nil
69
+ end
70
+
61
71
  log = Logger.new(STDOUT)
62
72
  log.level = config[:verbose] ? Logger::DEBUG : Logger::INFO
63
73
  log.formatter = lambda do |s, d, p, m|
74
+ if filelog != nil
75
+ filelog.write("#{s} #{m}\n")
76
+ end
64
77
  "#{d.strftime('%Y-%m-%d %H:%M:%S.%3N')} | #{s.ljust(5)} | #{m}\n"
65
78
  end
66
79
  config[:logger] = log
@@ -51,7 +51,7 @@ module PrometheusConfigBuilder
51
51
  rescue Exception => e
52
52
  logger.error("Error while decoding YAML from file #{file[:source]}")
53
53
  if match = e.message.match(/mapping values are not allowed in this context at line ([0-9]+)/i)
54
- full, linenumber = match.captures
54
+ linenumber = match.captures[0]
55
55
  logger.error("This error is most often because your intentation is at the wrong level. Check the file #{file[:filename]} around line #{linenumber}")
56
56
  end
57
57
  raise e
@@ -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.35'
6
+ s.version = '0.0.37'
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.35
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juho Mäkinen juho.makinen@gmail.com