fluent-plugin-warp10 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/fluent/plugin/out_warp10.rb +80 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23a4d4ee358a504dd404108947346501bf2ce855
|
4
|
+
data.tar.gz: d32c9e91f66816b14e3248917152e428b75a85be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b871c092f83305f80a96683cce56a82d13fbc75b279fc40fec10a283011adcff2a576e9ecb7dbdfc1ec2ba82bcaea238db5f0d7f3000e60ad29b6b5230a4abc
|
7
|
+
data.tar.gz: 58b27cb230b9cfce989e0ed6809b1452bdefd065713c5d3f0049afac3c07862ec6b17c24dfb6bd08410b3ae3c289dc1606dabed99df3e173b49dc398bebe4d44
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Cityzen Data
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http:#www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Fluent
|
18
|
+
class Warp10Output < BufferedOutput
|
19
|
+
Plugin.register_output('warp10', self)
|
20
|
+
|
21
|
+
config_param :flush_interval, :time, :default => 60
|
22
|
+
config_param :warpUri, :string, :default => "localhost:4242"
|
23
|
+
config_param :token, :string, :default => 'token'
|
24
|
+
config_param :className, :string, :default => 'fluentd'
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
require 'net/http'
|
28
|
+
require 'net/https'
|
29
|
+
require 'uri'
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
unless method_defined?(:log)
|
34
|
+
define_method("log") { $log }
|
35
|
+
end
|
36
|
+
|
37
|
+
def configure(conf)
|
38
|
+
super
|
39
|
+
@warpUri = conf['warpUri']
|
40
|
+
@token = conf['token']
|
41
|
+
@className = conf['className']
|
42
|
+
@flush_interval = conf['flush_interval']
|
43
|
+
end
|
44
|
+
|
45
|
+
def start
|
46
|
+
super
|
47
|
+
end
|
48
|
+
|
49
|
+
def shutdown
|
50
|
+
super
|
51
|
+
end
|
52
|
+
|
53
|
+
def format(tag, time, record)
|
54
|
+
time = time * 1000000
|
55
|
+
fluentString = String.new
|
56
|
+
record.each {|key,value|
|
57
|
+
fix = String.new
|
58
|
+
if value.is_a?(String)
|
59
|
+
fix = "'"
|
60
|
+
end
|
61
|
+
fluentString += time.to_s + "// " + className.to_s + "." + tag.to_s + "{key=" + key.to_s + ",source=fluentd} " + fix + value.to_s + fix + "\n"
|
62
|
+
}
|
63
|
+
fluentString.to_msgpack
|
64
|
+
end
|
65
|
+
|
66
|
+
def write(chunk)
|
67
|
+
collectString = String.new
|
68
|
+
chunk.msgpack_each {|cur|
|
69
|
+
collectString += cur
|
70
|
+
}
|
71
|
+
uri = URI.parse(warpUri)
|
72
|
+
https = Net::HTTP.new(uri.host,uri.port)
|
73
|
+
https.use_ssl = true
|
74
|
+
req = Net::HTTP::Post.new(uri.path, initheader = {'X-Warp10-Token'=> token, 'Content-Type'=> 'text/plain'})
|
75
|
+
req.body = collectString.encode("iso-8859-1").force_encoding("utf-8")
|
76
|
+
res = https.request(req)
|
77
|
+
log.info "Response #{res.code} #{res.message}: #{res.body}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fluent-plugin-warp10
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Aurelien Hebert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fluentd
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.10.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.10.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.9.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.9.2
|
41
|
+
description: fluent plugin to send metrics to Warp10
|
42
|
+
email: contact@cityzendata.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/fluent/plugin/out_warp10.rb
|
48
|
+
homepage: https://github.com/cityzendata/fluentd-plugin-warp10.git
|
49
|
+
licenses: []
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.2.1
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: fluent plugin to send metrics to Warp10
|
71
|
+
test_files: []
|