fluent-plugin-prometheus 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 464d04815988e50129af844c36fba2f260d88071
4
- data.tar.gz: b8ea875d061ce8b83c6f6970fa41aefaf3aad7cf
2
+ SHA256:
3
+ metadata.gz: c8de232abd7ede7d5988f3280f6c8735de2c0371c831830ee56574ca5d38a056
4
+ data.tar.gz: 5042393a2e68e75dbcc35bf4ae7a857498f9d2e6ebbbd164f62a270e3274be65
5
5
  SHA512:
6
- metadata.gz: a4d5053269cc5ecce7318408905da8c104d9f544c963595334c156f9bf351da35b8b6dcea4fe4a8c75aae14ab867025fab0aa3fa8cc34173a5916d2f5c8e4db2
7
- data.tar.gz: 0d38d9a9ba4830b03376bcff82dd86f4739145ffae3e07ae2d4b308fcd3f6440a096918976a2583ff72c2bdb032f0e037973e9bd71076d9fcf2f4494b5b572bc
6
+ metadata.gz: 8acba008b1f5beafae1e7cac6214083ad033def64ea5af572724cbec3337b03c122cef09b1935a9617e375abc0f83b7b33269904f567f7e17ec90d7f79e8da40
7
+ data.tar.gz: 7187a5995e479c445bb0457081606b869456ad46bacd539962fb74147f5b9d72d0b78cb45b1d43a64c247328f673c91aa12ce86c53e915e171d6f5fb70e23afa
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "fluent-plugin-prometheus"
3
- spec.version = "0.4.0"
3
+ spec.version = "0.5.0"
4
4
  spec.authors = ["Masahiro Sano"]
5
5
  spec.email = ["sabottenda@gmail.com"]
6
6
  spec.summary = %q{A fluent plugin that collects metrics and exposes for Prometheus.}
@@ -10,6 +10,23 @@ module Fluent
10
10
  config_param :port, :integer, :default => 24231
11
11
  config_param :metrics_path, :string, :default => '/metrics'
12
12
 
13
+ desc 'Enable ssl configuration for the server'
14
+ config_section :ssl, multi: false, required: false do
15
+ config_param :enable, :bool, required: false, default: false
16
+
17
+ desc 'Path to the ssl certificate in PEM format. Read from file and added to conf as "SSLCertificate"'
18
+ config_param :certificate_path, :string, required: false, default: nil
19
+
20
+ desc 'Path to the ssl private key in PEM format. Read from file and added to conf as "SSLPrivateKey"'
21
+ config_param :private_key_path, :string, required: false, default: nil
22
+
23
+ desc 'Path to CA in PEM format. Read from file and added to conf as "SSLCACertificateFile"'
24
+ config_param :ca_path, :string, required: false, default: nil
25
+
26
+ desc 'Additional ssl conf for the server. Ref: https://github.com/ruby/webrick/blob/master/lib/webrick/ssl.rb'
27
+ config_param :extra_conf, :hash, multi: false, required: false, default: {:SSLCertName => [['CN','nobody'],['DC','example']]}, symbolize_keys: true
28
+ end
29
+
13
30
  attr_reader :registry
14
31
 
15
32
  def initialize
@@ -23,13 +40,39 @@ module Fluent
23
40
 
24
41
  def start
25
42
  super
26
- @server = WEBrick::HTTPServer.new(
43
+ config = {
27
44
  BindAddress: @bind,
28
45
  Port: @port,
29
46
  MaxClients: 5,
30
47
  Logger: WEBrick::Log.new(STDERR, WEBrick::Log::FATAL),
31
48
  AccessLog: [],
32
- )
49
+ }
50
+ unless @ssl.nil? || !@ssl['enable']
51
+ require 'webrick/https'
52
+ require 'openssl'
53
+ if (@ssl['certificate_path'] && @ssl['private_key_path'].nil?) || (@ssl['certificate_path'].nil? && @ssl['private_key_path'])
54
+ raise RuntimeError.new("certificate_path and private_key_path most both be defined")
55
+ end
56
+ ssl_config = {
57
+ SSLEnable: true
58
+ }
59
+ if @ssl['certificate_path']
60
+ cert = OpenSSL::X509::Certificate.new(File.read(@ssl['certificate_path']))
61
+ ssl_config[:SSLCertificate] = cert
62
+ end
63
+ if @ssl['private_key_path']
64
+ key = OpenSSL::PKey::RSA.new(File.read(@ssl['private_key_path']))
65
+ ssl_config[:SSLPrivateKey] = key
66
+ end
67
+ ssl_config[:SSLCACertificateFile] = @ssl['ca_path'] if @ssl['ca_path']
68
+ ssl_config = ssl_config.merge(@ssl['extra_conf'])
69
+ config = ssl_config.merge(config)
70
+ end
71
+ @log.on_debug do
72
+ @log.debug("WEBrick conf: #{config}")
73
+ end
74
+
75
+ @server = WEBrick::HTTPServer.new(config)
33
76
  @server.mount(@metrics_path, MonitorServlet, self)
34
77
  @thread = Thread.new { @server.start }
35
78
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-prometheus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-18 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.6.13
154
+ rubygems_version: 2.7.6
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: A fluent plugin that collects metrics and exposes for Prometheus.