Class: DogapiDemo::V1::MonitorService
Constant Summary
collapse
- API_VERSION =
'v1'
Instance Method Summary
collapse
-
#cancel_downtime(downtime_id) ⇒ Object
-
#delete_monitor(monitor_id) ⇒ Object
-
#get_all_downtimes(options = {}) ⇒ Object
-
#get_all_monitors(options = {}) ⇒ Object
-
#get_downtime(downtime_id) ⇒ Object
-
#get_monitor(monitor_id, options = {}) ⇒ Object
-
#monitor(type, query, options = {}) ⇒ Object
-
#mute_host(hostname, options = {}) ⇒ Object
-
#mute_monitor(monitor_id, options = {}) ⇒ Object
-
#mute_monitors ⇒ Object
-
#schedule_downtime(scope, options = {}) ⇒ Object
-
#unmute_host(hostname) ⇒ Object
-
#unmute_monitor(monitor_id, options = {}) ⇒ Object
-
#unmute_monitors ⇒ Object
-
#update_downtime(downtime_id, options = {}) ⇒ Object
-
#update_monitor(monitor_id, query, options) ⇒ Object
Methods inherited from APIService
#connect, #initialize, #request, #suppress_error_if_silent
Instance Method Details
#cancel_downtime(downtime_id) ⇒ Object
203
204
205
206
207
208
209
210
211
212
213
214
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 203
def cancel_downtime(downtime_id)
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Delete, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#delete_monitor(monitor_id) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 63
def delete_monitor(monitor_id)
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Delete, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#get_all_downtimes(options = {}) ⇒ Object
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 216
def get_all_downtimes(options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
if options[:current_only]
params[:current_only] = options[:current_only]
options.delete :current_only
end
request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#get_all_monitors(options = {}) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 76
def get_all_monitors(options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
if options[:group_states]
params[:group_states] = options[:group_states]
params[:group_states] = params[:group_states].join(',') if params[:group_states].respond_to?(:join)
end
if options[:tags]
params[:tags] = options[:tags]
params[:tags] = params[:tags].join(',') if params[:tags].respond_to?(:join)
end
request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#get_downtime(downtime_id) ⇒ Object
190
191
192
193
194
195
196
197
198
199
200
201
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 190
def get_downtime(downtime_id)
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Get, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#get_monitor(monitor_id, options = {}) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 45
def get_monitor(monitor_id, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
params[:group_states] = options[:group_states].join(',') if options[:group_states]
request(Net::HTTP::Get, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#monitor(type, query, options = {}) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 10
def monitor(type, query, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
body = {
'type' => type,
'query' => query,
}.merge options
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor", params, body, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#mute_host(hostname, options = {}) ⇒ Object
237
238
239
240
241
242
243
244
245
246
247
248
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 237
def mute_host(hostname, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/host/#{hostname}/mute", params, options, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#mute_monitor(monitor_id, options = {}) ⇒ Object
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 131
def mute_monitor(monitor_id, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/#{monitor_id}/mute", params, options, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#mute_monitors ⇒ Object
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 105
def mute_monitors()
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/mute_all", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#schedule_downtime(scope, options = {}) ⇒ Object
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 160
def schedule_downtime(scope, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
body = {
'scope' => scope
}.merge options
request(Net::HTTP::Post, "/api/#{API_VERSION}/downtime", params, body, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#unmute_host(hostname) ⇒ Object
249
250
251
252
253
254
255
256
257
258
259
260
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 249
def unmute_host(hostname)
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/host/#{hostname}/unmute", params, nil, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#unmute_monitor(monitor_id, options = {}) ⇒ Object
144
145
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 144
def unmute_monitor(monitor_id, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/#{monitor_id}/unmute", params, options, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#unmute_monitors ⇒ Object
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 118
def unmute_monitors()
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Post, "/api/#{API_VERSION}/monitor/unmute_all", params, nil, false)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#update_downtime(downtime_id, options = {}) ⇒ Object
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 177
def update_downtime(downtime_id, options = {})
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
request(Net::HTTP::Put, "/api/#{API_VERSION}/downtime/#{downtime_id}", params, options, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|
#update_monitor(monitor_id, query, options) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/dogapi-demo/v1/monitor.rb', line 28
def update_monitor(monitor_id, query, options)
begin
params = {
:api_key => @api_key,
:application_key => @application_key
}
body = {
'query' => query,
}.merge options
request(Net::HTTP::Put, "/api/#{API_VERSION}/monitor/#{monitor_id}", params, body, true)
rescue Exception => e
suppress_error_if_silent e
end
end
|