infludp 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +12 -0
- data/infludp.gemspec +26 -0
- data/lib/infludp/client.rb +31 -0
- data/lib/infludp/version.rb +3 -0
- data/lib/infludp.rb +4 -0
- metadata +95 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 654f1e8703af199c7808afaa7ce5b657dffb82fe
|
4
|
+
data.tar.gz: 634d6640b52609fdff48631fb6270c2eaccbf88d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f315dd4aa6c8e408f1dbf0bc983805cd121956a90af04a11b35fbbcc2dc8bbc446f7e2f8453e11e45d77e97bcbeff65d9d3e279c301be89105d49099f74f2019
|
7
|
+
data.tar.gz: 455b6d67c6a4cb78866d770ff7d4c55ca5a70b7c7e60123abeb4f2daf65c38f6035595f34f260210cbfebb52577ab9ed1a67abf9a0cfc301194851ed55fc0355
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Marco Lisci
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Infludp.
|
2
|
+
|
3
|
+
A minimal, zero dependencies, thread-safe Ruby gem to send metrics via UDP to [InfluxDB](http://influxdb.com/), and nothing else.
|
4
|
+
|
5
|
+
## Installation.
|
6
|
+
|
7
|
+
- Add infludp to your Gemfile:
|
8
|
+
```ruby
|
9
|
+
gem 'infludp'
|
10
|
+
```
|
11
|
+
|
12
|
+
## Usage.
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
$metrics = Infludp::Client.new(
|
16
|
+
host: '127.0.0.1',
|
17
|
+
port: 4444
|
18
|
+
)
|
19
|
+
|
20
|
+
$metrics.send('cpu.load', {
|
21
|
+
node: 'east.server1',
|
22
|
+
value: 22
|
23
|
+
})
|
24
|
+
```
|
25
|
+
|
26
|
+
## Test.
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
bundle exec rake test:all
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing.
|
33
|
+
|
34
|
+
1. Fork it ( https://github.com/badshark/infludp/fork )
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create a new Pull Request
|
39
|
+
|
40
|
+
## License.
|
41
|
+
|
42
|
+
[MIT](LICENSE.txt)
|
data/Rakefile
ADDED
data/infludp.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'infludp/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "infludp"
|
8
|
+
spec.version = Infludp::VERSION
|
9
|
+
spec.authors = ["Marco Lisci"]
|
10
|
+
spec.email = ["info@badshark.io"]
|
11
|
+
|
12
|
+
spec.summary = %q{Minimal, InfluxDB UDP client.}
|
13
|
+
spec.description = %q{Minimal InfluxDB UDP client.}
|
14
|
+
spec.homepage = "https://github.com/badshark/infludp"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|benchmarks)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
|
25
|
+
spec.add_dependency "connection_pool", "~> 2.1.3"
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Infludp
|
2
|
+
class Client
|
3
|
+
attr_accessor :host, :port
|
4
|
+
|
5
|
+
def initialize(args)
|
6
|
+
@host = args[:host]
|
7
|
+
@port = args[:port]
|
8
|
+
end
|
9
|
+
|
10
|
+
def socket
|
11
|
+
Thread.current[:infludp_socket] ||= UDPSocket.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def send(name, data)
|
15
|
+
socket.send(
|
16
|
+
build_metric(name, data),
|
17
|
+
0,
|
18
|
+
host,
|
19
|
+
port
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
def build_metric(name, data)
|
24
|
+
[{
|
25
|
+
name: name,
|
26
|
+
columns: data.keys.map{|key| key.to_s},
|
27
|
+
points: data.values
|
28
|
+
}].to_json
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/infludp.rb
ADDED
metadata
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: infludp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marco Lisci
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: connection_pool
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.1.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.1.3
|
55
|
+
description: Minimal InfluxDB UDP client.
|
56
|
+
email:
|
57
|
+
- info@badshark.io
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- infludp.gemspec
|
68
|
+
- lib/infludp.rb
|
69
|
+
- lib/infludp/client.rb
|
70
|
+
- lib/infludp/version.rb
|
71
|
+
homepage: https://github.com/badshark/infludp
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options: []
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
requirements: []
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 2.2.2
|
92
|
+
signing_key:
|
93
|
+
specification_version: 4
|
94
|
+
summary: Minimal, InfluxDB UDP client.
|
95
|
+
test_files: []
|