riemann-curl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3b2d047431c88142893cb5224209260a6e45db57
4
+ data.tar.gz: 12194e9676599b617d45ed39131cdd3ef5a2bf9d
5
+ SHA512:
6
+ metadata.gz: 21b31ff21d243d3fbfc1774746c4bd671d48db63d33516dd5817e2344009ae8c47450ff7869869943c5612db4ccbfbe49714be37722d1c54df2315380a7fac5a
7
+ data.tar.gz: f5f64aafaeee1e3a49b336a4f9def4c689443bbc864a85cc01a40206cc2cdfe2e41dc2cd59b1f8e34cb9170d2e24e4f3c5686d017805e9ca16746a05b2e25fff
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in riemann-curl.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2014 Osman Ungur
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.
22
+
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Riemann::Curl
2
+
3
+ riemann-curl submits informational curl metrics to Riemann after a successful transfer.
4
+
5
+ ## Prerequisities
6
+
7
+ * Ruby 1.8+
8
+ * libcurl
9
+ * build-essential (gcc, make..)
10
+
11
+ ## Installation
12
+
13
+ riemann-curl uses [curb](https://github.com/taf2/curb) -Ruby bindings for curl- for sending requests, and it requires libraries related to `curl`.
14
+
15
+ On Ubuntu, the dependencies can be satisfied by installing the following packages:
16
+
17
+ $ sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
18
+
19
+ $ gem install riemann-curl
20
+
21
+ ## Usage
22
+
23
+ $ riemann-curl --uri http://api.foobar.com/test
24
+
25
+ Transfer and connection timeout parameters can be overridden with `max-time` and `connect-timeout` flags.
26
+
27
+ $ riemann-curl --uri http://www.foobar.com --max-time 10
28
+
29
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/riemann-curl ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'riemann/tools'
4
+
5
+ class Riemann::Tools::Curl
6
+ include Riemann::Tools
7
+ require 'curb'
8
+ require 'uri'
9
+
10
+ opt :uri, "URL for sending request", :default => 'http://riemann.io'
11
+ opt :max_time, "Timeout for whole operation", :default => 5
12
+ opt :connect_timeout, "Timeout for connection phase", :default => 2
13
+
14
+ CURL_METRICS = ['total_time', 'name_lookup_time', 'connect_time', 'pre_transfer_time', 'start_transfer_time']
15
+
16
+ def tick
17
+ response = ::Curl::Easy.perform(opts[:uri]) do |curl|
18
+ curl.headers["User-Agent"] = "riemann-curl"
19
+ curl.timeout = opts[:max_time]
20
+ curl.connect_timeout = opts[:connect_timeout]
21
+ curl.follow_location = true
22
+ end
23
+
24
+ CURL_METRICS.each do |metric|
25
+ value = response.send(metric)
26
+ data = {
27
+ :host => URI.parse(opts[:uri]).host,
28
+ :service => "curl #{metric}",
29
+ :metric => value.to_s,
30
+ :tags => ['curl'],
31
+ :state => 'ok'
32
+ }
33
+ report(data)
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ Riemann::Tools::Curl.run
40
+
@@ -0,0 +1,20 @@
1
+
2
+ Gem::Specification.new do |spec|
3
+ spec.name = "riemann-curl"
4
+ spec.version = "0.0.1"
5
+ spec.authors = ["Osman Ungur"]
6
+ spec.email = ["osmanungur@gmail.com"]
7
+ spec.summary = %q{Utility for submitting information curl metrics to Riemann}
8
+ spec.homepage = "http://github.com/o/riemann-curl"
9
+ spec.license = "MIT"
10
+
11
+ spec.files = `git ls-files -z`.split("\x0")
12
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+
14
+ spec.add_development_dependency "bundler", "~> 1.7"
15
+ spec.add_development_dependency "rake", "~> 10.0"
16
+ spec.add_dependency 'riemann-tools', '>= 0.2.1'
17
+ spec.add_dependency 'curb', '>= 0.8.6'
18
+
19
+ end
20
+
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: riemann-curl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Osman Ungur
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-25 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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: riemann-tools
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: curb
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.6
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.6
69
+ description:
70
+ email:
71
+ - osmanungur@gmail.com
72
+ executables:
73
+ - riemann-curl
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - bin/riemann-curl
83
+ - riemann-curl.gemspec
84
+ homepage: http://github.com/o/riemann-curl
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.2.2
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Utility for submitting information curl metrics to Riemann
108
+ test_files: []