chef-handler-librato 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +62 -1
- data/chef-handler-librato.gemspec +1 -1
- data/lib/chef/chef_handler_librato.rb +1 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -4,7 +4,68 @@ Author - Brian Scott (b@bscott.me)
|
|
4
4
|
|
5
5
|
Chef Handler to send metrics to Librato metrics
|
6
6
|
|
7
|
-
|
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
|
+
Platform: All Platforms
|
16
|
+
|
17
|
+
|
18
|
+
There are two ways to use Chef Handlers.
|
19
|
+
Method 1
|
20
|
+
|
21
|
+
You can install the RubyGem ahead of time, and configure Chef to use them. To do so:
|
22
|
+
|
23
|
+
gem install chef-handler-librato
|
24
|
+
|
25
|
+
Then add to the configuration (/etc/chef/solo.rb for chef-solo or /etc/chef/client.rb for chef-client):
|
26
|
+
|
27
|
+
require "chef-handler-librato"
|
28
|
+
|
29
|
+
# Configure the handler
|
30
|
+
librato_handler = LibratoReporting.new
|
31
|
+
|
32
|
+
# metric_type is a string that sets the Metrics type in Librato, defaults to counter
|
33
|
+
librato_handler.metric_type = "counter"
|
34
|
+
|
35
|
+
# Email and Api_key
|
36
|
+
librato_handler.email = "user@domain.com"
|
37
|
+
librato_handler.api_key = "667hhff544300096423345"
|
38
|
+
|
39
|
+
# Add your handler
|
40
|
+
report_handlers << librato_handler
|
41
|
+
exception_handlers << librato_handler
|
42
|
+
|
43
|
+
Method 2
|
44
|
+
|
45
|
+
Use the chef_handler cookbook by Opscode. Create a recipe with the following:
|
46
|
+
|
47
|
+
# Install the `chef-handler-librato` RubyGem during the compile phase
|
48
|
+
gem_package "chef-handler-librato" do
|
49
|
+
action :nothing
|
50
|
+
end.run_action(:install)
|
51
|
+
|
52
|
+
or
|
53
|
+
|
54
|
+
chef_gem "chef-handler-librato" # This workd with Chef-0.10.10 or higher
|
55
|
+
|
56
|
+
# Then activate the handler with the `chef_handler` LWRP
|
57
|
+
argument_array = [
|
58
|
+
:metric_type => "counter",
|
59
|
+
:email => "user@domain.com",
|
60
|
+
:api_key => "c544637891cf5498f9efac33257689rtt57777894"
|
61
|
+
]
|
62
|
+
|
63
|
+
chef_handler "LibratoReporting" do
|
64
|
+
source "#{File.join(Gem.all_load_paths.grep(/chef-handler-librato/).first,'chef', 'chef_handler_librato.rb')}"
|
65
|
+
arguments argument_array
|
66
|
+
action :nothing
|
67
|
+
end.run_action(:enable)
|
68
|
+
|
8
69
|
|
9
70
|
Patches welcome, just send me a pull request!
|
10
71
|
|
@@ -42,8 +42,7 @@ class LibratoReporting < Chef::Handler
|
|
42
42
|
|
43
43
|
Chef::Log.debug("#{gemspec.full_name} loaded as a handler.")
|
44
44
|
|
45
|
-
@l = Librato::Metrics.
|
46
|
-
@l.authenticate "#{@email}" "#{@api_key}"
|
45
|
+
@l = Librato::Metrics.authenticate "#{@email}" "#{@api_key}"
|
47
46
|
|
48
47
|
metrics = Hash.new
|
49
48
|
metrics[:updated_resources] = run_status.updated_resources.length
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 1.1.
|
8
|
+
- 1
|
9
|
+
version: 1.1.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brian Scott
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-06-
|
17
|
+
date: 2012-06-30 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|