chef-handler-librato 1.1.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- metadata +21 -40
- data/.gitignore +0 -19
- data/README.md +0 -85
- data/Rakefile +0 -1
- data/chef-handler-librato.gemspec +0 -25
- data/lib/chef/chef_handler_librato.rb +0 -70
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5ac9db9b0ca8d4ed6f2960e546995dca2d571b98
|
4
|
+
data.tar.gz: 5a2fa4ba181a8611d16d242472e023db2f2f1fcf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a7df111935cd2cc70890bcfd45a50e75733ca45ce0ea721e1499830da7558567548578aae74844518340667e1f680aae173b19812999ced8b5ba44d083ff4680
|
7
|
+
data.tar.gz: bb41562a854c49d9312516b84e940c87422aa937aa11b7ea247275979120a2f192aefb59a4499f75f7e5787b5fbdd6baf85a6e1c815911bd92e5e136cfdc1d18
|
metadata
CHANGED
@@ -1,110 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-handler-librato
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brian Scott
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
14
|
+
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: chef
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: aggregate
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: multi_json
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: faraday
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: librato-metrics
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
description: Push reporting stats to Librato metrics
|
@@ -113,34 +100,28 @@ email:
|
|
113
100
|
executables: []
|
114
101
|
extensions: []
|
115
102
|
extra_rdoc_files: []
|
116
|
-
files:
|
117
|
-
- .gitignore
|
118
|
-
- README.md
|
119
|
-
- Rakefile
|
120
|
-
- chef-handler-librato.gemspec
|
121
|
-
- lib/chef/chef_handler_librato.rb
|
103
|
+
files: []
|
122
104
|
homepage: ''
|
123
105
|
licenses: []
|
106
|
+
metadata: {}
|
124
107
|
post_install_message:
|
125
108
|
rdoc_options: []
|
126
109
|
require_paths:
|
127
110
|
- lib
|
128
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
112
|
requirements:
|
131
|
-
- -
|
113
|
+
- - '>='
|
132
114
|
- !ruby/object:Gem::Version
|
133
115
|
version: '0'
|
134
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
-
none: false
|
136
117
|
requirements:
|
137
|
-
- -
|
118
|
+
- - '>='
|
138
119
|
- !ruby/object:Gem::Version
|
139
120
|
version: '0'
|
140
121
|
requirements: []
|
141
122
|
rubyforge_project:
|
142
|
-
rubygems_version:
|
123
|
+
rubygems_version: 2.3.0
|
143
124
|
signing_key:
|
144
|
-
specification_version:
|
125
|
+
specification_version: 4
|
145
126
|
summary: Push reporting stats to Librato metrics
|
146
127
|
test_files: []
|
data/.gitignore
DELETED
data/README.md
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
chef-handler-librato
|
2
|
-
|
3
|
-
====================
|
4
|
-
|
5
|
-
Chef Handler to send metrics to Librato metrics!
|
6
|
-
|
7
|
-
====Description====
|
8
|
-
|
9
|
-
This is a simple Chef report handler that reports status of a Chef run through librato.
|
10
|
-
|
11
|
-
http://wiki.opscode.com/display/chef/Exception+and+Report+Handlers
|
12
|
-
|
13
|
-
Requirements:
|
14
|
-
|
15
|
-
|
16
|
-
There are two ways to use Chef Handlers.
|
17
|
-
|
18
|
-
##Method 1
|
19
|
-
|
20
|
-
You can install the RubyGem ahead of time, and configure Chef to use them. To do so:
|
21
|
-
|
22
|
-
gem install chef-handler-librato
|
23
|
-
|
24
|
-
Then add to the configuration (/etc/chef/solo.rb for chef-solo or /etc/chef/client.rb for chef-client):
|
25
|
-
|
26
|
-
require "chef-handler-librato"
|
27
|
-
|
28
|
-
##### Configure the handler:
|
29
|
-
|
30
|
-
librato_handler = LibratoReporting.new
|
31
|
-
|
32
|
-
#### Arguments:
|
33
|
-
|
34
|
-
#### metric_type is a string that sets the Metrics type in Librato, defaults to counter
|
35
|
-
|
36
|
-
librato_handler.metric_type = "gauge"
|
37
|
-
|
38
|
-
#### Email and Api_key arguments
|
39
|
-
|
40
|
-
librato_handler.email = "user@domain.com"
|
41
|
-
librato_handler.api_key = "667hhff544300096423345"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
### Add your handler:
|
46
|
-
|
47
|
-
report_handlers << librato_handler
|
48
|
-
exception_handlers << librato_handler
|
49
|
-
|
50
|
-
##Method 2
|
51
|
-
|
52
|
-
Use the chef_handler cookbook by Opscode. Create a recipe with the following:
|
53
|
-
|
54
|
-
##### Install the `chef-handler-librato` RubyGem during the compile phase
|
55
|
-
|
56
|
-
gem_package "chef-handler-librato" do
|
57
|
-
action :nothing
|
58
|
-
end.run_action(:install)
|
59
|
-
|
60
|
-
or
|
61
|
-
|
62
|
-
chef_gem "chef-handler-librato" # This workd with Chef-0.10.10 or higher
|
63
|
-
|
64
|
-
### Activate the handler with the `chef_handler` LWRP
|
65
|
-
|
66
|
-
argument_array = [
|
67
|
-
:metric_type => "counter" ,
|
68
|
-
:email => "user@domain.com",
|
69
|
-
:api_key => "c544637891cf5498f9efac33257689rtt57777894"
|
70
|
-
]
|
71
|
-
|
72
|
-
|
73
|
-
chef_handler "LibratoReporting" do
|
74
|
-
source "#{File.join(Gem.all_load_paths.grep(/chef-handler-librato/).first,'chef',
|
75
|
-
'chef_handler_librato.rb')}"
|
76
|
-
arguments argument_array
|
77
|
-
action :nothing
|
78
|
-
end.run_action(:enable)
|
79
|
-
|
80
|
-
|
81
|
-
Patches welcome, just send me a pull request!
|
82
|
-
|
83
|
-
Author: Brian Scott (brainscott@gmail.com)
|
84
|
-
|
85
|
-
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
@@ -1,25 +0,0 @@
|
|
1
|
-
$:.push File.expand_path("../lib", __FILE__)
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = "chef-handler-librato"
|
5
|
-
s.version = "1.1.6"
|
6
|
-
s.authors = ["Brian Scott"]
|
7
|
-
s.email = ["brainscott@gmail.com"]
|
8
|
-
s.homepage = ""
|
9
|
-
s.summary = %q{Push reporting stats to Librato metrics}
|
10
|
-
s.description = %q{Push reporting stats to Librato metrics}
|
11
|
-
|
12
|
-
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
|
18
|
-
# specify any dependencies here; for example:
|
19
|
-
s.add_development_dependency "librato-metrics"
|
20
|
-
s.add_runtime_dependency "chef"
|
21
|
-
s.add_runtime_dependency "aggregate"
|
22
|
-
s.add_runtime_dependency "multi_json"
|
23
|
-
s.add_runtime_dependency "faraday"
|
24
|
-
s.add_runtime_dependency "librato-metrics"
|
25
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Brian Scott <brainscott@gmail.com>
|
3
|
-
# Copyright:: Copyright (c) 2012, Brian Scott
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
require "rubygems"
|
21
|
-
Gem.clear_paths
|
22
|
-
require "librato/metrics"
|
23
|
-
require "chef"
|
24
|
-
require "chef/handler"
|
25
|
-
|
26
|
-
class LibratoReporting < Chef::Handler
|
27
|
-
attr_writer :metric_type, :source, :email, :api_key
|
28
|
-
|
29
|
-
def initialize(options = {})
|
30
|
-
@metric_type = options[:metric_type] || "counter"
|
31
|
-
@source = options[:source] || "#{Chef::Config[:node_name]}"
|
32
|
-
@email = options[:email]
|
33
|
-
@api_key = options[:api_key]
|
34
|
-
end
|
35
|
-
|
36
|
-
def report
|
37
|
-
gemspec = if Gem::Specification.respond_to? :find_by_name
|
38
|
-
Gem::Specification.find_by_name('chef-handler-librato')
|
39
|
-
else
|
40
|
-
Gem.source_index.find_name('chef-handler-librato').last
|
41
|
-
end
|
42
|
-
|
43
|
-
Chef::Log.debug("#{gemspec.full_name} loaded as a handler.")
|
44
|
-
|
45
|
-
Librato::Metrics.authenticate "#{@email}", "#{@api_key}"
|
46
|
-
|
47
|
-
metrics = Hash.new
|
48
|
-
metrics[:updated_resources] = run_status.updated_resources.length
|
49
|
-
metrics[:all_resources] = run_status.all_resources.length
|
50
|
-
metrics[:elapsed_time] = run_status.elapsed_time.to_i
|
51
|
-
|
52
|
-
if run_status.success?
|
53
|
-
metrics[:success] = 1
|
54
|
-
metrics[:fail] = 0
|
55
|
-
else
|
56
|
-
metrics[:success] = 0
|
57
|
-
metrics[:fail] = 1
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
metrics.each do |metric, value|
|
62
|
-
Chef::Log.debug("#{metric} #{value} #{Time.now}")
|
63
|
-
begin
|
64
|
-
Librato::Metrics.submit :"#{metric}" => {:type => :"#{@metric_type}", :value => "#{value}", :source => "#{@source}" }
|
65
|
-
rescue Exception => e
|
66
|
-
puts "#{e}"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|