chef-handler-splunk 1.0.0 → 1.1.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.
Files changed (2) hide show
  1. data/lib/chef/handler/splunk.rb +15 -3
  2. metadata +3 -3
@@ -18,7 +18,7 @@ require 'rest-client'
18
18
  class Chef
19
19
  class Handler
20
20
  class Splunk < Chef::Handler
21
- VERSION = '1.0.0'
21
+ VERSION = '1.1.0'
22
22
  API_ENDPOINT = 'services/receivers/simple'
23
23
 
24
24
  # * *Args*:
@@ -52,8 +52,19 @@ class Chef
52
52
  :start_time => run_status.start_time,
53
53
  :end_time => run_status.end_time,
54
54
  :elapsed_time => run_status.elapsed_time,
55
- :exception => run_status.formatted_exception,
56
- :updated_resources => run_status.updated_resources}.to_json
55
+ :exception => run_status.formatted_exception}.to_json
56
+
57
+ splunk_post(event, metadata)
58
+ end
59
+
60
+ # Reports metrics to Splunk.
61
+ def report_resources
62
+ metadata = {
63
+ :sourcetype => 'json_chef-resources',
64
+ :source => 'chef-handler',
65
+ :host => node.hostname,
66
+ :index => @index}
67
+ event = run_status.updated_resources.to_json
57
68
 
58
69
  splunk_post(event, metadata)
59
70
  end
@@ -73,6 +84,7 @@ class Chef
73
84
  # Wrapper for metrics and backtrace.
74
85
  def report
75
86
  report_metrics
87
+ report_resources
76
88
  if run_status.failed?
77
89
  report_backtrace
78
90
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-handler-splunk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Greg Albrecht