dogeventer 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dogeventer/event_emitter.rb +50 -0
- data/lib/dogeventer/scope.rb +6 -0
- metadata +3 -3
@@ -128,4 +128,54 @@ module DogEventer
|
|
128
128
|
end
|
129
129
|
|
130
130
|
end
|
131
|
+
|
132
|
+
|
133
|
+
class ChefRun < EventEmitter
|
134
|
+
def initialize(host, start_time)
|
135
|
+
@host = host
|
136
|
+
@start_time = start_time
|
137
|
+
@events = []
|
138
|
+
end
|
139
|
+
|
140
|
+
def msg_title(duration)
|
141
|
+
"Chef completed in #{duration} seconds on #{@host}"
|
142
|
+
end
|
143
|
+
|
144
|
+
def event_object()
|
145
|
+
@host
|
146
|
+
end
|
147
|
+
|
148
|
+
def event_type()
|
149
|
+
"config_management.run"
|
150
|
+
end
|
151
|
+
|
152
|
+
def date_happened(date=nil)
|
153
|
+
(date || @start_time).to_i
|
154
|
+
end
|
155
|
+
|
156
|
+
def source_type_name()
|
157
|
+
"Chef"
|
158
|
+
end
|
159
|
+
|
160
|
+
def to_event(alert_type, duration=nil, date=nil)
|
161
|
+
duration = duration || rand(1000)
|
162
|
+
@events << {
|
163
|
+
:event_object => event_object,
|
164
|
+
:event_type => event_type,
|
165
|
+
:alert_type => alert_type,
|
166
|
+
:date_happened => date_happened(date),
|
167
|
+
:msg_title => msg_title(duration),
|
168
|
+
:source_type_name => source_type_name,
|
169
|
+
:host => @host
|
170
|
+
}
|
171
|
+
end
|
172
|
+
|
173
|
+
def success(duration=nil, date=nil)
|
174
|
+
to_event :success, duration
|
175
|
+
end
|
176
|
+
def error(duration=nil, date=nil)
|
177
|
+
to_event :error, duration
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|
131
181
|
end
|
data/lib/dogeventer/scope.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dogeventer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Datadog, Inc.
|