chef-handler-datadog-demo 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.env.example +2 -0
  3. data/.gitignore +63 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +44 -0
  6. data/.travis.yml +25 -0
  7. data/Appraisals +16 -0
  8. data/CHANGELOG.md +102 -0
  9. data/CONTRIBUTING.md +23 -0
  10. data/Gemfile +14 -0
  11. data/Guardfile +37 -0
  12. data/LICENSE.txt +20 -0
  13. data/README.md +40 -0
  14. data/Rakefile +23 -0
  15. data/chef-handler-datadog-demo.gemspec +33 -0
  16. data/gemfiles/chef_10.14.4.gemfile +17 -0
  17. data/gemfiles/chef_10.gemfile +16 -0
  18. data/gemfiles/chef_11.gemfile +16 -0
  19. data/gemfiles/chef_12.gemfile +16 -0
  20. data/lib/chef/handler/datadog_demo.rb +123 -0
  21. data/lib/chef/handler/datadog_demo_chef_events.rb +174 -0
  22. data/lib/chef/handler/datadog_demo_chef_metrics.rb +62 -0
  23. data/lib/chef/handler/datadog_demo_chef_tags.rb +140 -0
  24. data/lib/chef_handler_datadog_demo.rb +6 -0
  25. data/spec/datadog_spec.rb +495 -0
  26. data/spec/spec_helper.rb +47 -0
  27. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_alert_handles_when_specified.yml +513 -0
  28. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_event_title_correctly.yml +258 -0
  29. data/spec/support/cassettes/Chef_Handler_Datadog/failed_Chef_run/sets_priority_correctly.yml +258 -0
  30. data/spec/support/cassettes/Chef_Handler_Datadog/handles_no_application_key/fails_when_no_application_key_is_provided.yml +143 -0
  31. data/spec/support/cassettes/Chef_Handler_Datadog/hostname/uses_the_node_name_when_no_config_specified.yml +250 -0
  32. data/spec/support/cassettes/Chef_Handler_Datadog/hostname/uses_the_specified_hostname_when_provided.yml +250 -0
  33. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/does_not_use_the_instance_id_when_config_specified_to_false.yml +250 -0
  34. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/uses_the_instance_id_when_config_is_specified.yml +250 -0
  35. data/spec/support/cassettes/Chef_Handler_Datadog/reports_correct_hostname_on_an_ec2_node/uses_the_instance_id_when_no_config_specified.yml +250 -0
  36. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_events/posts_an_event.yml +250 -0
  37. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_events/sets_priority_correctly.yml +250 -0
  38. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/emits_metrics/reports_metrics.yml +250 -0
  39. data/spec/support/cassettes/Chef_Handler_Datadog/reports_metrics_event_and_sets_tags/sets_tags/puts_the_tags_for_the_current_node.yml +250 -0
  40. data/spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/does_not_emit_metrics.yml +82 -0
  41. data/spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/only_emits_a_failure_metric.yml +134 -0
  42. data/spec/support/cassettes/Chef_Handler_Datadog/resources/failure_during_compile_phase/posts_an_event.yml +134 -0
  43. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_empty_tag_prefix.yml +251 -0
  44. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/allows_for_user-specified_tag_prefix.yml +251 -0
  45. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_specified/sets_the_role_and_env_and_tags.yml +251 -0
  46. data/spec/support/cassettes/Chef_Handler_Datadog/tags/when_unspecified/sets_role_env_and_nothing_else.yml +251 -0
  47. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_not_specified/does_not_retry_after_a_failed_submission.yml +241 -0
  48. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_specified_as_2_retries/retries_no_more_than_twice.yml +331 -0
  49. data/spec/support/cassettes/Chef_Handler_Datadog/tags_submission_retries/when_specified_as_2_retries/stops_retrying_once_submission_is_successful.yml +287 -0
  50. data/spec/support/cassettes/Chef_Handler_Datadog/updated_resources/posts_an_event.yml +250 -0
  51. metadata +285 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9592a69478339cd327d114cfd5875333f8f89046
4
+ data.tar.gz: fc58bf593416d2852a4b7e6d73421034dbaa05e8
5
+ SHA512:
6
+ metadata.gz: 0d8babb0d3e99d258c89a1e253077c533a2675fdda8ebe575a3fcf5ebd398df168eb2c37c48b66d060c75dea85cd35a22a17663b0dc2d2b30d62c9892f1e269f
7
+ data.tar.gz: 9442160ff16ec9ea21ed16253ced2e9c869eb7146be9c95cbba2bd045ade2fe9c043e39adf82673c9cb3d9bf56c2299e5fc4dedf1ebeb5a2852de94b5ade7fcd
@@ -0,0 +1,2 @@
1
+ API_KEY: myapikey
2
+ APPLICATION_KEY: chefhandlerspecificapplicationkey
@@ -0,0 +1,63 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ .DS_Store
31
+
32
+ # For TextMate
33
+ *.tmproj
34
+ # tmtags
35
+
36
+ # For emacs:
37
+ #*~
38
+ #\#*
39
+ #.\#*
40
+
41
+ # For vim:
42
+ #*.swp
43
+
44
+ # For redcar:
45
+ #.redcar
46
+
47
+ # For rubinius:
48
+ #*.rbc
49
+
50
+ json
51
+ rake
52
+ Gemfile.lock
53
+
54
+ # For Ruby Managers:
55
+ .ruby-gemset
56
+ .ruby-version
57
+ .rvmrc
58
+
59
+ # Any environment-specific files
60
+ .env
61
+
62
+ # Ignore Appraisal lock files
63
+ gemfiles/*.gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,44 @@
1
+ AllCops:
2
+ Include:
3
+ - chef-handler-datadog.gemspec
4
+ - '**/Appraisals'
5
+ - '**/Gemfile'
6
+ - '**/Rakefile'
7
+ Exclude:
8
+ - 'spec/*.rb'
9
+ - '*/vendor/**/*'
10
+
11
+ # 80 characters is a nice goal, but not worth currently changing in existing
12
+ # code for the sake of changing it to conform to a length set in 1928 (IBM).
13
+ Metrics/LineLength:
14
+ Max: 150
15
+
16
+ #####
17
+ # These exceptions are good goals to attain, and probably will over time,
18
+ # so periodic disabling and re-running to inspect values is suggested.
19
+
20
+ # TODO: main method `report` does a lot of work, which drives this number up.
21
+ Metrics/AbcSize:
22
+ Max: 38
23
+
24
+ # TODO: Main class is currently over 100 lines of code, making comprehending
25
+ # it harder. With refactors and simplifications, we can bring this down,
26
+ # but for now, let's not make it too much worse.
27
+ Metrics/ClassLength:
28
+ Max: 158
29
+
30
+ # TODO: this is currently down to 7 from 22, and should be a constant
31
+ # goal to reduce method complexity. The accepted goal is 6.
32
+ # Method `select_hostname`
33
+ Metrics/CyclomaticComplexity:
34
+ Max: 7
35
+
36
+ # TODO: The main method `report` is now down from 85 lines. As refactors
37
+ # continue, this should drop. However, the goal of 10 lines in a method may
38
+ # be a little lofty.
39
+ Metrics/MethodLength:
40
+ Max: 36
41
+
42
+ # TODO: select_hostname, report are both higher than the default of 7
43
+ Metrics/PerceivedComplexity:
44
+ Max: 9
@@ -0,0 +1,25 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.1.5
8
+
9
+ bundler_args: --without=localdev
10
+
11
+ gemfile:
12
+ - gemfiles/chef_10.14.4.gemfile
13
+ - gemfiles/chef_10.gemfile
14
+ - gemfiles/chef_11.gemfile
15
+ - gemfiles/chef_12.gemfile
16
+
17
+ env:
18
+ - API_KEY=somefakeapikey APPLICATION_KEY=somefakeapplicationkey
19
+
20
+ matrix:
21
+ exclude:
22
+ # Chef 12.x with Ohai 8.2.x doesn't work on Chef 1.9.3
23
+ - rvm: 1.9.3
24
+ gemfile: gemfiles/chef_12.gemfile
25
+ allow_failures:
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+
3
+ # Latest release of mainline Chef versions here.
4
+ %w(10 11 12).each do |tv|
5
+ appraise "chef-#{tv}" do
6
+ gem 'chef', "~> #{tv}.0"
7
+ end
8
+ end
9
+
10
+ # Describe any specific Chef versions here.
11
+ appraise 'chef-10.14.4' do
12
+ gem 'chef', '10.14.4'
13
+ # Old versions of Chef didn't pin the max version of Ohai they supported.
14
+ # See: http://git.io/vecAn
15
+ gem 'ohai', '< 8.0'
16
+ end
@@ -0,0 +1,102 @@
1
+ Changes
2
+ =======
3
+
4
+ # 0.9.0 / 2016-03-22
5
+
6
+ * [FEATURE] Enable users to select tag prefix [#81][] [@mstepniowski][]
7
+
8
+ # 0.8.0 / 2016-03-01
9
+
10
+ * [FEATURE] Add success/failure metric [#75][] [@jhulten][]
11
+ * [FEATURE] Retry tags submission when host is not yet present on DD [#80][] [@olivielpeau][]
12
+ * [OPTIMIZE] Ensure tags always returns an array [#78][] [@rlaveycal][]
13
+ * [OPTIMIZE] More robust failed chef run checking [#69][] [@bigbam505][]
14
+
15
+ # 0.7.0 / 2015-10-22
16
+
17
+ * [FEATURE] Support passing `DATADOG_PROXY` env var to control `dogapi` behavior, [#65][] [@datwiz][]
18
+ * [OPTIMIZE] Only map `tags` if non-nil, [#66][] [@owen][]
19
+ * [MISC] Style updates, [#60][] [@miketheman][]
20
+ * [MISC] Update test matrix to handle latest released major versions, [#59][] [@miketheman][]
21
+
22
+ # 0.6.0 / 2014-09-17
23
+
24
+ * [FEATURE] Submit Chef-related tags to Datadog for Events, [#52][] [@miketheman][]
25
+
26
+ # 0.5.0 / 2014-08-21
27
+
28
+ * [FEATURE] Place recent updated resources above stacktrace on failure, [#46][] [@miketheman][]
29
+ * [BUGFIX] Handle cases where Chef fails during compile phase, [#51][] [@miketheman][]
30
+ * [FEATURE] Allow credentials to be passed as string keys vs symbols, [#50][] [@dwradcliffe][]
31
+ * [MISC] Testing framework updates, [@miketheman][]
32
+ * [MISC] Doc updates
33
+
34
+ # 0.4.0 / 2014-05-08
35
+
36
+ * [FEATURE] Allow specification of a `:hostname` to config to override `node.name`, [#41][] [@miketheman][]
37
+ * [FEATURE] Allow passing an array of handles in config to alert when Chef fails, [#29][] [@miketheman][]
38
+ * [OPTIMIZE] Use new version of `dogapi` lib to submit tags for Chef only, [#28][] [@miketheman][]
39
+ * [MISC] Updated versions of Chef tested
40
+ * [MISC] Style update for source file name, parens
41
+
42
+ # 0.3.0 / 2014-01-23
43
+
44
+ * [MISC] **Breaking Change**: Chef 0.9.x is no longer supported. Extra code implemented for 0.9 versions has been removed. [@miketheman][]
45
+ * [BUGFIX] Report correct response when failing to submit tags, [#39][] [@miketheman][]
46
+ * [OPTIMIZE] Refactor hostname resolution to its own method, simplify `report` method. [@miketheman][]
47
+ * [OPTIMIZE] Refactor metrics reporting to its own method, simplify `report` method. [@miketheman][]
48
+ * [OPTIMIZE] Refactor tagging get/set to own methods, simplify `report` method. [@miketheman][]
49
+ * [MISC] Converted `opts` to an instance variable of `config` to reduce the amount of instance variables passing around. [@miketheman][]
50
+ * [OPTIMIZE] Don't try to tag node when Application Key isn't provided, [#31][] [@miketheman][]
51
+ * [OPTIMIZE] Only load in the parts of the Chef gem that are used. [@miketheman][]
52
+ * [OPTIMIZE] Change order in which event_data is constructed, to not lose the full backtrace, [#37][] [@miketheman][]
53
+
54
+ Testing suite: [#18][], [@miketheman][]
55
+ * Removed Tailor testing in favor of Rubocop
56
+ * Added Appraisals with specific Chef versions to be tested
57
+ * Added RSpec testing via VCR and Webmock
58
+
59
+ # 0.2.0 / 2013-10-31
60
+
61
+ * [BUGFIX] moved Chef gem dependency to development, [#34][] [@miketheman][]
62
+ * [BUGFIX] redis python client check was not properly checking the default version, [@remh][]
63
+ * [MISC] tailor 1.3.1 caught some cosmetic issue, [@alq][]
64
+ * [MISC] fixed a few repo & build issues, [@miketheman][]
65
+
66
+ # 0.1.2 / 2013-04-03
67
+
68
+ And all other versions were prior to this. See git history for more.
69
+
70
+ <!--- The following link definition list is generated by PimpMyChangelog --->
71
+ [#18]: https://github.com/DataDog/chef-handler-datadog/issues/18
72
+ [#28]: https://github.com/DataDog/chef-handler-datadog/issues/28
73
+ [#29]: https://github.com/DataDog/chef-handler-datadog/issues/29
74
+ [#31]: https://github.com/DataDog/chef-handler-datadog/issues/31
75
+ [#34]: https://github.com/DataDog/chef-handler-datadog/issues/34
76
+ [#37]: https://github.com/DataDog/chef-handler-datadog/issues/37
77
+ [#39]: https://github.com/DataDog/chef-handler-datadog/issues/39
78
+ [#41]: https://github.com/DataDog/chef-handler-datadog/issues/41
79
+ [#46]: https://github.com/DataDog/chef-handler-datadog/issues/46
80
+ [#50]: https://github.com/DataDog/chef-handler-datadog/issues/50
81
+ [#51]: https://github.com/DataDog/chef-handler-datadog/issues/51
82
+ [#52]: https://github.com/DataDog/chef-handler-datadog/issues/52
83
+ [#59]: https://github.com/DataDog/chef-handler-datadog/issues/59
84
+ [#60]: https://github.com/DataDog/chef-handler-datadog/issues/60
85
+ [#65]: https://github.com/DataDog/chef-handler-datadog/issues/65
86
+ [#66]: https://github.com/DataDog/chef-handler-datadog/issues/66
87
+ [#69]: https://github.com/DataDog/chef-handler-datadog/issues/69
88
+ [#75]: https://github.com/DataDog/chef-handler-datadog/issues/75
89
+ [#78]: https://github.com/DataDog/chef-handler-datadog/issues/78
90
+ [#80]: https://github.com/DataDog/chef-handler-datadog/issues/80
91
+ [#81]: https://github.com/DataDog/chef-handler-datadog/issues/81
92
+ [@alq]: https://github.com/alq
93
+ [@bigbam505]: https://github.com/bigbam505
94
+ [@datwiz]: https://github.com/datwiz
95
+ [@dwradcliffe]: https://github.com/dwradcliffe
96
+ [@jhulten]: https://github.com/jhulten
97
+ [@miketheman]: https://github.com/miketheman
98
+ [@mstepniowski]: https://github.com/mstepniowski
99
+ [@olivielpeau]: https://github.com/olivielpeau
100
+ [@owen]: https://github.com/owen
101
+ [@remh]: https://github.com/remh
102
+ [@rlaveycal]: https://github.com/rlaveycal
@@ -0,0 +1,23 @@
1
+ # Contributing
2
+
3
+ If you'd like to run the test suite, fix a bug or add a feature, please follow these steps:
4
+
5
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
6
+ * Check out the latest `master` branch to make sure the feature hasn't been implemented or the bug hasn't been fixed
7
+ * Fork the project
8
+ * Install all dependencies: `bundle install`
9
+ * Start a feature/bugfix branch: `git checkout -b my_feature_name`
10
+ * Place a `.env` file in the root of the project with `API_KEY` and `APPLICATION_KEY`:
11
+
12
+ API_KEY: myapikey
13
+ APPLICATION_KEY: chefhandlerspecificapplicationkey
14
+
15
+ This file is intentionally .gitignored to prevent security exposure.
16
+ You may use your own Datadog account keys, as the keys are filtered from the test recordings.
17
+ Running the test suite will _not_ make calls to Datadog for existing tests, see `spec/support/cassettes/` for more.
18
+
19
+ * Run `rake` to execute tests, ensure they pass
20
+ * Commit and push until you are happy with your contribution
21
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
22
+ * Please try not to mess with the `Rakefile`, version, or history.
23
+ If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # encoding: utf-8
2
+ source 'http://rubygems.org'
3
+
4
+ # Specify your gem's dependencies in chef-handler-datadog.gemspec
5
+ gemspec
6
+
7
+ group :localdev do
8
+ gem 'guard'
9
+ gem 'guard-rspec'
10
+ gem 'guard-rubocop'
11
+ gem 'pry'
12
+ gem 'terminal-notifier-guard'
13
+ gem 'travis-lint'
14
+ end
@@ -0,0 +1,37 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rubocop do
5
+ watch(%r{.+\.rb$})
6
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
7
+ end
8
+
9
+ # Note: The cmd option is now required due to the increasing number of ways
10
+ # rspec may be run, below are examples of the most common uses.
11
+ # * bundler: 'bundle exec rspec'
12
+ # * bundler binstubs: 'bin/rspec'
13
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
14
+ # installed the spring binstubs per the docs)
15
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
16
+ # * 'just' rspec: 'rspec'
17
+ guard :rspec, cmd: 'bundle exec rspec' do
18
+ watch(%r{^spec/.+_spec\.rb$})
19
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
20
+ watch('spec/spec_helper.rb') { "spec" }
21
+
22
+ # Rails example
23
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
24
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
25
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
26
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
27
+ watch('config/routes.rb') { "spec/routing" }
28
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
29
+ watch('spec/rails_helper.rb') { "spec" }
30
+
31
+ # Capybara features specs
32
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
33
+
34
+ # Turnip features and steps
35
+ watch(%r{^spec/acceptance/(.+)\.feature$})
36
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
37
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011-2012 Datadog, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,40 @@
1
+ # chef-handler-datadog
2
+
3
+ An Exception and Report Handler for Chef.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/chef-handler-datadog.svg)](http://badge.fury.io/rb/chef-handler-datadog)
6
+ [![Build Status](https://travis-ci.org/DataDog/chef-handler-datadog.svg?branch=master)](https://travis-ci.org/DataDog/chef-handler-datadog)
7
+ [![Code Climate](https://codeclimate.com/github/DataDog/chef-handler-datadog/badges/gpa.svg)](https://codeclimate.com/github/DataDog/chef-handler-datadog)
8
+ [![Dependency Status](https://gemnasium.com/DataDog/chef-handler-datadog.svg)](https://gemnasium.com/DataDog/chef-handler-datadog)
9
+
10
+ ## Using chef-handler-datadog
11
+
12
+ This can be installed by using the `dd-handler` recipe from the [datadog cookbook][cookbook].
13
+
14
+ ```ruby
15
+ run_list 'foo::bar', 'datadog::dd-handler'
16
+ ```
17
+
18
+ ### Windows support
19
+
20
+ The chef handler does work on Microsoft Windows however limitations with SSL + Ruby on Windows require extra setup. One solution is to set the `SSL_CERT_FILE` environmental variable to the one that chef uses on the machine to fix this issue. Here is how [chef](https://github.com/chef/omnibus-chef/blob/master/files/openssl-customization/windows/ssl_env_hack.rb) fixes the issue.
21
+
22
+ ```ruby
23
+ # Setup the certs for ruby in windows
24
+ env 'SSL_CERT_FILE' do
25
+ action :create
26
+ value "C:\\opscode\\chef\\embedded\\ssl\\certs\\cacert.pem"
27
+ end
28
+ ```
29
+
30
+ The Datadog Docs on [Chef](http://docs.datadoghq.com/guides/chef/#deployhandler) has detailed instructions.
31
+
32
+ ## Contributing to chef-handler-datadog
33
+
34
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
35
+
36
+ ## Copyright
37
+
38
+ Copyright (c) 2012-2014 Datadog, Inc. See LICENSE.txt for further details.
39
+
40
+ [cookbook]: https://supermarket.getchef.com/cookbooks/datadog
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env rake
2
+ # encoding: utf-8
3
+ require 'rubygems'
4
+ require 'bundler/gem_tasks'
5
+
6
+ require 'rake/clean'
7
+ require 'rspec/core/rake_task'
8
+ require 'rubocop/rake_task'
9
+
10
+ task default: [:cops, :spec]
11
+
12
+ CLEAN.include(['coverage/', 'doc/', 'pkg/'])
13
+
14
+ RSpec::Core::RakeTask.new(:spec)
15
+
16
+ RuboCop::RakeTask.new(:cops)
17
+
18
+ namespace :dev do
19
+ task :setup do
20
+ cp '.env.example', '.env'
21
+ Rake::Task[:default].invoke
22
+ end
23
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ require File.expand_path('../lib/chef_handler_datadog_demo', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.name = 'chef-handler-datadog-demo'
6
+ gem.summary = 'Chef Handler reports events and metrics to Datadog'
7
+ gem.description = 'This Handler will report the events and metrics for a chef-client run to Datadog.'
8
+ gem.license = 'BSD'
9
+ gem.version = ChefHandlerDatadogDemo::VERSION
10
+
11
+ gem.files = `git ls-files`.split($\) # rubocop:disable SpecialGlobalVars
12
+ gem.executables = gem.files.grep(%r{^bin\/}).map { |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)\/})
14
+ gem.require_paths = ['lib']
15
+ gem.extra_rdoc_files = ['README.md', 'LICENSE.txt']
16
+
17
+ gem.add_dependency 'dogapi', '>= 1.6'
18
+
19
+ gem.add_development_dependency 'appraisal', '~> 2.0.1'
20
+ gem.add_development_dependency 'bundler'
21
+ gem.add_development_dependency 'chef', '>= 10.14.4', '<= 13'
22
+ gem.add_development_dependency 'dotenv'
23
+ gem.add_development_dependency 'rake'
24
+ gem.add_development_dependency 'rspec', '~> 3.2.0'
25
+ gem.add_development_dependency 'rubocop', '~> 0.34.2'
26
+ gem.add_development_dependency 'simplecov'
27
+ gem.add_development_dependency 'vcr'
28
+ gem.add_development_dependency 'webmock'
29
+
30
+ gem.authors = ['Mike Fiedler', 'Adam Jacob', 'Alexis Le-Quoc']
31
+ gem.email = ['package@datadoghq.com']
32
+ gem.homepage = 'http://www.datadoghq.com/'
33
+ end