sensu-plugins-fluentd 0.1.0 → 1.0.0

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
  SHA1:
3
- metadata.gz: 3140dff177f87ce022e271823141fe6eba5f9f87
4
- data.tar.gz: edb2ed2b1c4573e30de4148992532bf34e0da1d2
3
+ metadata.gz: 193c69129bcef0591e30c3b9b47788e1657b4fa8
4
+ data.tar.gz: ea67e7db27b112efffc7ede720abc7d799c72803
5
5
  SHA512:
6
- metadata.gz: 8e43fba95c11a2bf20d7747c4cfa5446fd7f54614be65505b986d55a7866eed1b8d53ab81b1e937590790e6b43f0e755fb5c11aaa633954bdb5b1a92debdda61
7
- data.tar.gz: b6fbd1cd4b185c04cd0ee8a570e89a3dc12dbcc422a0a9f3bc7b77cb03a5617f505b331c4efb533e25f485096f866708d09d8d9e1f0d6673c4583d2d7dc84b54
6
+ metadata.gz: de00fbcedc4a58561a89e052f4c82b89df4788c4373238f24ed9218509bc0f86338b9fe4758effebda58c4d185db18ac090b1f175020403354e4bd9f27755376
7
+ data.tar.gz: 3ffd0701c14a07475b95207b509bf86facac857e852c1b31a1c84fc781c1049a0103353b00d0e15d2583cf56d4e46d7782c653d7dd17ebc896bd7291e7f05c6a
@@ -1,11 +1,24 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased
6
+ ## [Unreleased]
7
+
8
+ ## [1.0.0] - 2017-05-15
9
+ ### Fixed
10
+ - handler-fluentd.rb: Fix undefined local variable `incident_key` (@jkernech)
11
+
12
+ ### Changed
13
+ - Update `timeout` method to remove deprecation warnings (@eheydrick)
7
14
 
8
- [0.1.0] - 2015-12-03
15
+ ### Added
16
+ - Ruby 2.3 and 2.4 support (@eheydrick)
17
+
18
+ ### Removed
19
+ - Ruby 1.9.3 support (@eheydrick)
20
+
21
+ ## [0.1.0] - 2015-12-03
9
22
  ### Added
10
23
  - Added timeout option to check-fluentd-monitor-agent.rb
11
24
 
@@ -19,15 +32,19 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
19
32
  ### Changed
20
33
  - updated sensu-plugin gem to 1.2.0
21
34
 
22
- ## 0.0.1 - 2015-04-29
23
-
24
- ### Added
25
- - initial release
26
-
27
35
  ## [0.0.2] - 2015-06-02
28
-
29
36
  ### Fixed
30
37
  - added binstubs
31
38
 
32
39
  ### Changed
33
40
  - removed cruft from /lib
41
+
42
+ ## 0.0.1 - 2015-04-29
43
+ ### Added
44
+ - initial release
45
+
46
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-fluentd/compare/1.0.0...HEAD
47
+ [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-fluentd/compare/0.1.0...1.0.0
48
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-fluentd/compare/0.0.3...0.1.0
49
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-fluentd/compare/0.0.2...0.0.3
50
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-fluentd/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-fluentd/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-fluentd)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-fluentd/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-fluentd)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-fluentd.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-fluentd)
8
- [ ![Codeship Status for sensu-plugins/sensu-plugins-fluentd](https://codeship.com/projects/fe235610-d22f-0132-a14d-4afb0344239b/status?branch=master)](https://codeship.com/projects/77468)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -19,6 +18,7 @@ Fluentd Sensu handler
19
18
 
20
19
  ## Files
21
20
  * bin/check-fluentd-monitor-agent.rb
21
+ * bin/metric-fluentd-monitor-agent.rb
22
22
  * bin/handler-fluentd.rb
23
23
 
24
24
  ## Usage
@@ -81,7 +81,7 @@ class CheckFluentdMonitorAgent < Sensu::Plugin::Check::CLI
81
81
  end
82
82
 
83
83
  begin
84
- timeout(config[:timeout]) do
84
+ Timeout.timeout(config[:timeout]) do
85
85
  acquire_resource
86
86
  end
87
87
  rescue Timeout::Error
@@ -86,14 +86,14 @@ class Fluentd < Sensu::Handler
86
86
 
87
87
  response = http.request(request)
88
88
  if response.code == '200'
89
- puts "fluentd -- #{@event['action']} incident -- #{incident_key}"
89
+ puts "fluentd -- #{@event['action']} incident -- #{event_name}"
90
90
  else
91
- puts "fluentd -- failed to send #{@event['action']} incident -- #{incident_key}"
91
+ puts "fluentd -- failed to send #{@event['action']} incident -- #{event_name}"
92
92
  puts "fluentd -- response: #{response.inspect}"
93
93
  end
94
94
  end
95
95
  rescue Timeout::Error
96
- puts "fluentd -- Timed out while attempting to send #{@event['action']} incident -- #{incident_key}"
96
+ puts "fluentd -- Timed out while attempting to send #{@event['action']} incident -- #{event_name}"
97
97
  end
98
98
  end
99
99
  end
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # metric-fluentd-monitor
4
+ #
5
+ # DESCRIPTION:
6
+ # This plugin uses fluentd monitor_agent to monitor buffer, produces
7
+ # Graphite formatted output.
8
+ #
9
+ # OUTPUT:
10
+ # metric data
11
+ #
12
+ # PLATFORMS:
13
+ # Linux
14
+ #
15
+ # DEPENDENCIES:
16
+ # gem: sensu-plugin
17
+ #
18
+ # USAGE:
19
+ #
20
+ # NOTES:
21
+ #
22
+ # LICENSE:
23
+ # Copyright 2015 Junpei Tsuji.
24
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
25
+ # for details.
26
+ #
27
+
28
+ require 'sensu-plugin/metric/cli'
29
+ require 'socket'
30
+ require 'net/http'
31
+ require 'timeout'
32
+ require 'json'
33
+
34
+ class MetricFluentdMonitorAgent < Sensu::Plugin::Metric::CLI::Graphite
35
+ option :scheme,
36
+ long: '--scheme SCHEME',
37
+ description: 'Metric naming scheme',
38
+ default: "#{Socket.gethostname}.fluentd"
39
+ option :url,
40
+ short: '-u URL',
41
+ long: '--url URL',
42
+ description: 'Fluentd plugins json path',
43
+ default: 'http://localhost:24220/api/plugins.json'
44
+ option :timeout,
45
+ short: '-t SECONDS',
46
+ long: '--timeout SECONDS',
47
+ description: 'Timeout value in seconds',
48
+ default: 5,
49
+ proc: proc(&:to_i)
50
+
51
+ def run
52
+ if config[:url]
53
+ uri = URI.parse(config[:url])
54
+ config[:host] = uri.host
55
+ config[:port] = uri.port
56
+ config[:request_uri] = uri.request_uri
57
+ end
58
+
59
+ begin
60
+ Timeout.timeout(config[:timeout]) do
61
+ acquire_resource
62
+ end
63
+ rescue Timeout::Error
64
+ critical 'Connection timed out'
65
+ rescue => e
66
+ critical "Connection error: #{e.message}"
67
+ end
68
+ end
69
+
70
+ def acquire_resource
71
+ http = Net::HTTP.new(config[:host], config[:port])
72
+ response = http.get(config[:request_uri])
73
+ result = JSON.parse(response.body)
74
+ timestamp = Time.now.to_i
75
+
76
+ result['plugins'].each do |r|
77
+ next if r['retry_count'].nil? || r['buffer_total_queued_size'].nil? || r['buffer_queue_length'].nil?
78
+ output [config[:scheme], r['plugin_id'], 'retry_count'].join('.'), r['retry_count'], timestamp
79
+ output [config[:scheme], r['plugin_id'], 'buffer_total_queued_size'].join('.'), r['buffer_total_queued_size'], timestamp
80
+ output [config[:scheme], r['plugin_id'], 'buffer_queue_length'].join('.'), r['buffer_queue_length'], timestamp
81
+ end
82
+ ok
83
+ end
84
+ end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsFluentd
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 1
3
+ MAJOR = 1
4
+ MINOR = 0
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,182 +1,161 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-12-03 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2017-05-16 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - "~>"
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - "~>"
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
- name: codeclimate-test-reporter
28
+ name: bundler
51
29
  requirement: !ruby/object:Gem::Requirement
52
30
  requirements:
53
31
  - - "~>"
54
32
  - !ruby/object:Gem::Version
55
- version: '0.4'
33
+ version: '1.7'
56
34
  type: :development
57
35
  prerelease: false
58
36
  version_requirements: !ruby/object:Gem::Requirement
59
37
  requirements:
60
38
  - - "~>"
61
39
  - !ruby/object:Gem::Version
62
- version: '0.4'
40
+ version: '1.7'
63
41
  - !ruby/object:Gem::Dependency
64
- name: rubocop
42
+ name: codeclimate-test-reporter
65
43
  requirement: !ruby/object:Gem::Requirement
66
44
  requirements:
67
- - - '='
45
+ - - "~>"
68
46
  - !ruby/object:Gem::Version
69
- version: 0.32.1
47
+ version: '0.4'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
- - - '='
52
+ - - "~>"
75
53
  - !ruby/object:Gem::Version
76
- version: 0.32.1
54
+ version: '0.4'
77
55
  - !ruby/object:Gem::Dependency
78
- name: rspec
56
+ name: github-markup
79
57
  requirement: !ruby/object:Gem::Requirement
80
58
  requirements:
81
59
  - - "~>"
82
60
  - !ruby/object:Gem::Version
83
- version: '3.1'
61
+ version: '1.3'
84
62
  type: :development
85
63
  prerelease: false
86
64
  version_requirements: !ruby/object:Gem::Requirement
87
65
  requirements:
88
66
  - - "~>"
89
67
  - !ruby/object:Gem::Version
90
- version: '3.1'
68
+ version: '1.3'
91
69
  - !ruby/object:Gem::Dependency
92
- name: bundler
70
+ name: pry
93
71
  requirement: !ruby/object:Gem::Requirement
94
72
  requirements:
95
73
  - - "~>"
96
74
  - !ruby/object:Gem::Version
97
- version: '1.7'
75
+ version: '0.10'
98
76
  type: :development
99
77
  prerelease: false
100
78
  version_requirements: !ruby/object:Gem::Requirement
101
79
  requirements:
102
80
  - - "~>"
103
81
  - !ruby/object:Gem::Version
104
- version: '1.7'
82
+ version: '0.10'
105
83
  - !ruby/object:Gem::Dependency
106
84
  name: rake
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
87
  - - "~>"
110
88
  - !ruby/object:Gem::Version
111
- version: '10.0'
89
+ version: '10.5'
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
94
  - - "~>"
117
95
  - !ruby/object:Gem::Version
118
- version: '10.0'
96
+ version: '10.5'
119
97
  - !ruby/object:Gem::Dependency
120
- name: github-markup
98
+ name: redcarpet
121
99
  requirement: !ruby/object:Gem::Requirement
122
100
  requirements:
123
101
  - - "~>"
124
102
  - !ruby/object:Gem::Version
125
- version: '1.3'
103
+ version: '3.2'
126
104
  type: :development
127
105
  prerelease: false
128
106
  version_requirements: !ruby/object:Gem::Requirement
129
107
  requirements:
130
108
  - - "~>"
131
109
  - !ruby/object:Gem::Version
132
- version: '1.3'
110
+ version: '3.2'
133
111
  - !ruby/object:Gem::Dependency
134
- name: redcarpet
112
+ name: rubocop
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
115
  - - "~>"
138
116
  - !ruby/object:Gem::Version
139
- version: '3.2'
117
+ version: 0.40.0
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
121
  requirements:
144
122
  - - "~>"
145
123
  - !ruby/object:Gem::Version
146
- version: '3.2'
124
+ version: 0.40.0
147
125
  - !ruby/object:Gem::Dependency
148
- name: yard
126
+ name: rspec
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
129
  - - "~>"
152
130
  - !ruby/object:Gem::Version
153
- version: '0.8'
131
+ version: '3.4'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
136
  - - "~>"
159
137
  - !ruby/object:Gem::Version
160
- version: '0.8'
138
+ version: '3.4'
161
139
  - !ruby/object:Gem::Dependency
162
- name: pry
140
+ name: yard
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
143
  - - "~>"
166
144
  - !ruby/object:Gem::Version
167
- version: '0.10'
145
+ version: '0.8'
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
- version: '0.10'
152
+ version: '0.8'
175
153
  description: Sensu plugins for working with fluentd
176
154
  email: "<sensu-users@googlegroups.com>"
177
155
  executables:
178
- - handler-fluentd.rb
179
156
  - check-fluentd-monitor-agent.rb
157
+ - handler-fluentd.rb
158
+ - metric-fluentd-monitor-agent.rb
180
159
  extensions: []
181
160
  extra_rdoc_files: []
182
161
  files:
@@ -185,6 +164,7 @@ files:
185
164
  - README.md
186
165
  - bin/check-fluentd-monitor-agent.rb
187
166
  - bin/handler-fluentd.rb
167
+ - bin/metric-fluentd-monitor-agent.rb
188
168
  - lib/sensu-plugins-fluentd.rb
189
169
  - lib/sensu-plugins-fluentd/version.rb
190
170
  homepage: https://github.com/sensu-plugins/sensu-plugins-fluentd
@@ -205,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
205
185
  requirements:
206
186
  - - ">="
207
187
  - !ruby/object:Gem::Version
208
- version: 1.9.3
188
+ version: 2.0.0
209
189
  required_rubygems_version: !ruby/object:Gem::Requirement
210
190
  requirements:
211
191
  - - ">="
@@ -213,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
193
  version: '0'
214
194
  requirements: []
215
195
  rubyforge_project:
216
- rubygems_version: 2.4.8
196
+ rubygems_version: 2.4.5
217
197
  signing_key:
218
198
  specification_version: 4
219
199
  summary: Sensu plugins for working with fluentd
@@ -1 +0,0 @@
1
- ���}�
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- 1 VF�
metadata.gz.sig DELETED
Binary file