tencentcloud-sdk-monitor 1.0.200

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1260 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Monitor
21
+ module V20180724
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2018-07-24'
26
+ api_endpoint = 'monitor.tencentcloudapi.com'
27
+ sdk_version = 'MONITOR_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 将告警策略绑定到特定对象
33
+
34
+ # @param request: Request instance for BindingPolicyObject.
35
+ # @type request: :class:`Tencentcloud::monitor::V20180724::BindingPolicyObjectRequest`
36
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::BindingPolicyObjectResponse`
37
+ def BindingPolicyObject(request)
38
+ body = send_request('BindingPolicyObject', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = BindingPolicyObjectResponse.new
42
+ model.deserialize(response['Response'])
43
+ model
44
+ else
45
+ code = response['Response']['Error']['Code']
46
+ message = response['Response']['Error']['Message']
47
+ reqid = response['Response']['RequestId']
48
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
49
+ end
50
+ rescue TencentCloud::Common::TencentCloudSDKException => e
51
+ raise e
52
+ rescue StandardError => e
53
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
54
+ end
55
+
56
+ # 创建通知模板
57
+
58
+ # @param request: Request instance for CreateAlarmNotice.
59
+ # @type request: :class:`Tencentcloud::monitor::V20180724::CreateAlarmNoticeRequest`
60
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::CreateAlarmNoticeResponse`
61
+ def CreateAlarmNotice(request)
62
+ body = send_request('CreateAlarmNotice', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = CreateAlarmNoticeResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+ # 创建告警策略
81
+
82
+ # @param request: Request instance for CreateAlarmPolicy.
83
+ # @type request: :class:`Tencentcloud::monitor::V20180724::CreateAlarmPolicyRequest`
84
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::CreateAlarmPolicyResponse`
85
+ def CreateAlarmPolicy(request)
86
+ body = send_request('CreateAlarmPolicy', request.serialize)
87
+ response = JSON.parse(body)
88
+ if response['Response'].key?('Error') == false
89
+ model = CreateAlarmPolicyResponse.new
90
+ model.deserialize(response['Response'])
91
+ model
92
+ else
93
+ code = response['Response']['Error']['Code']
94
+ message = response['Response']['Error']['Message']
95
+ reqid = response['Response']['RequestId']
96
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
97
+ end
98
+ rescue TencentCloud::Common::TencentCloudSDKException => e
99
+ raise e
100
+ rescue StandardError => e
101
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
102
+ end
103
+
104
+ # 创建 Prometheus 告警规则。
105
+
106
+ # 请注意,**告警对象和告警消息是 Prometheus Rule Annotations 的特殊字段,需要通过 annotations 来传递,对应的 Key 分别为summary/description**,,请参考 [Prometheus Rule更多配置请参考](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)。
107
+
108
+ # @param request: Request instance for CreateAlertRule.
109
+ # @type request: :class:`Tencentcloud::monitor::V20180724::CreateAlertRuleRequest`
110
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::CreateAlertRuleResponse`
111
+ def CreateAlertRule(request)
112
+ body = send_request('CreateAlertRule', request.serialize)
113
+ response = JSON.parse(body)
114
+ if response['Response'].key?('Error') == false
115
+ model = CreateAlertRuleResponse.new
116
+ model.deserialize(response['Response'])
117
+ model
118
+ else
119
+ code = response['Response']['Error']['Code']
120
+ message = response['Response']['Error']['Message']
121
+ reqid = response['Response']['RequestId']
122
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
123
+ end
124
+ rescue TencentCloud::Common::TencentCloudSDKException => e
125
+ raise e
126
+ rescue StandardError => e
127
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
128
+ end
129
+
130
+ # 增加策略组
131
+
132
+ # @param request: Request instance for CreatePolicyGroup.
133
+ # @type request: :class:`Tencentcloud::monitor::V20180724::CreatePolicyGroupRequest`
134
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::CreatePolicyGroupResponse`
135
+ def CreatePolicyGroup(request)
136
+ body = send_request('CreatePolicyGroup', request.serialize)
137
+ response = JSON.parse(body)
138
+ if response['Response'].key?('Error') == false
139
+ model = CreatePolicyGroupResponse.new
140
+ model.deserialize(response['Response'])
141
+ model
142
+ else
143
+ code = response['Response']['Error']['Code']
144
+ message = response['Response']['Error']['Message']
145
+ reqid = response['Response']['RequestId']
146
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
147
+ end
148
+ rescue TencentCloud::Common::TencentCloudSDKException => e
149
+ raise e
150
+ rescue StandardError => e
151
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
152
+ end
153
+
154
+ # 在腾讯云容器服务下创建 Prometheus 服务发现。
155
+ # <p>注意:前提条件,已经通过 Prometheus 控制台集成了对应的腾讯云容器服务,具体请参考
156
+ # <a href="https://cloud.tencent.com/document/product/248/48859" target="_blank">Agent 安装</a>。</p>
157
+
158
+ # @param request: Request instance for CreateServiceDiscovery.
159
+ # @type request: :class:`Tencentcloud::monitor::V20180724::CreateServiceDiscoveryRequest`
160
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::CreateServiceDiscoveryResponse`
161
+ def CreateServiceDiscovery(request)
162
+ body = send_request('CreateServiceDiscovery', request.serialize)
163
+ response = JSON.parse(body)
164
+ if response['Response'].key?('Error') == false
165
+ model = CreateServiceDiscoveryResponse.new
166
+ model.deserialize(response['Response'])
167
+ model
168
+ else
169
+ code = response['Response']['Error']['Code']
170
+ message = response['Response']['Error']['Message']
171
+ reqid = response['Response']['RequestId']
172
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
173
+ end
174
+ rescue TencentCloud::Common::TencentCloudSDKException => e
175
+ raise e
176
+ rescue StandardError => e
177
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
178
+ end
179
+
180
+ # 云监控告警删除告警通知模板
181
+
182
+ # @param request: Request instance for DeleteAlarmNotices.
183
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DeleteAlarmNoticesRequest`
184
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DeleteAlarmNoticesResponse`
185
+ def DeleteAlarmNotices(request)
186
+ body = send_request('DeleteAlarmNotices', request.serialize)
187
+ response = JSON.parse(body)
188
+ if response['Response'].key?('Error') == false
189
+ model = DeleteAlarmNoticesResponse.new
190
+ model.deserialize(response['Response'])
191
+ model
192
+ else
193
+ code = response['Response']['Error']['Code']
194
+ message = response['Response']['Error']['Message']
195
+ reqid = response['Response']['RequestId']
196
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
197
+ end
198
+ rescue TencentCloud::Common::TencentCloudSDKException => e
199
+ raise e
200
+ rescue StandardError => e
201
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
202
+ end
203
+
204
+ # 删除告警策略
205
+
206
+ # @param request: Request instance for DeleteAlarmPolicy.
207
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DeleteAlarmPolicyRequest`
208
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DeleteAlarmPolicyResponse`
209
+ def DeleteAlarmPolicy(request)
210
+ body = send_request('DeleteAlarmPolicy', request.serialize)
211
+ response = JSON.parse(body)
212
+ if response['Response'].key?('Error') == false
213
+ model = DeleteAlarmPolicyResponse.new
214
+ model.deserialize(response['Response'])
215
+ model
216
+ else
217
+ code = response['Response']['Error']['Code']
218
+ message = response['Response']['Error']['Message']
219
+ reqid = response['Response']['RequestId']
220
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
221
+ end
222
+ rescue TencentCloud::Common::TencentCloudSDKException => e
223
+ raise e
224
+ rescue StandardError => e
225
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
226
+ end
227
+
228
+ # 批量删除 Prometheus 报警规则
229
+
230
+ # @param request: Request instance for DeleteAlertRules.
231
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DeleteAlertRulesRequest`
232
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DeleteAlertRulesResponse`
233
+ def DeleteAlertRules(request)
234
+ body = send_request('DeleteAlertRules', request.serialize)
235
+ response = JSON.parse(body)
236
+ if response['Response'].key?('Error') == false
237
+ model = DeleteAlertRulesResponse.new
238
+ model.deserialize(response['Response'])
239
+ model
240
+ else
241
+ code = response['Response']['Error']['Code']
242
+ message = response['Response']['Error']['Message']
243
+ reqid = response['Response']['RequestId']
244
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
245
+ end
246
+ rescue TencentCloud::Common::TencentCloudSDKException => e
247
+ raise e
248
+ rescue StandardError => e
249
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
250
+ end
251
+
252
+ # 删除告警策略组
253
+
254
+ # @param request: Request instance for DeletePolicyGroup.
255
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DeletePolicyGroupRequest`
256
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DeletePolicyGroupResponse`
257
+ def DeletePolicyGroup(request)
258
+ body = send_request('DeletePolicyGroup', request.serialize)
259
+ response = JSON.parse(body)
260
+ if response['Response'].key?('Error') == false
261
+ model = DeletePolicyGroupResponse.new
262
+ model.deserialize(response['Response'])
263
+ model
264
+ else
265
+ code = response['Response']['Error']['Code']
266
+ message = response['Response']['Error']['Message']
267
+ reqid = response['Response']['RequestId']
268
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
269
+ end
270
+ rescue TencentCloud::Common::TencentCloudSDKException => e
271
+ raise e
272
+ rescue StandardError => e
273
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
274
+ end
275
+
276
+ # 删除在腾讯云容器服务下创建的 Prometheus 服务发现。
277
+ # <p>注意:前提条件,已经通过 Prometheus 控制台集成了对应的腾讯云容器服务,具体请参考
278
+ # <a href="https://cloud.tencent.com/document/product/248/48859" target="_blank">Agent 安装</a>。</p>
279
+
280
+ # @param request: Request instance for DeleteServiceDiscovery.
281
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DeleteServiceDiscoveryRequest`
282
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DeleteServiceDiscoveryResponse`
283
+ def DeleteServiceDiscovery(request)
284
+ body = send_request('DeleteServiceDiscovery', request.serialize)
285
+ response = JSON.parse(body)
286
+ if response['Response'].key?('Error') == false
287
+ model = DeleteServiceDiscoveryResponse.new
288
+ model.deserialize(response['Response'])
289
+ model
290
+ else
291
+ code = response['Response']['Error']['Code']
292
+ message = response['Response']['Error']['Message']
293
+ reqid = response['Response']['RequestId']
294
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
295
+ end
296
+ rescue TencentCloud::Common::TencentCloudSDKException => e
297
+ raise e
298
+ rescue StandardError => e
299
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
300
+ end
301
+
302
+ # 获取平台事件列表
303
+
304
+ # @param request: Request instance for DescribeAccidentEventList.
305
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAccidentEventListRequest`
306
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAccidentEventListResponse`
307
+ def DescribeAccidentEventList(request)
308
+ body = send_request('DescribeAccidentEventList', request.serialize)
309
+ response = JSON.parse(body)
310
+ if response['Response'].key?('Error') == false
311
+ model = DescribeAccidentEventListResponse.new
312
+ model.deserialize(response['Response'])
313
+ model
314
+ else
315
+ code = response['Response']['Error']['Code']
316
+ message = response['Response']['Error']['Message']
317
+ reqid = response['Response']['RequestId']
318
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
319
+ end
320
+ rescue TencentCloud::Common::TencentCloudSDKException => e
321
+ raise e
322
+ rescue StandardError => e
323
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
324
+ end
325
+
326
+ # 查询告警事件列表
327
+
328
+ # @param request: Request instance for DescribeAlarmEvents.
329
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmEventsRequest`
330
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmEventsResponse`
331
+ def DescribeAlarmEvents(request)
332
+ body = send_request('DescribeAlarmEvents', request.serialize)
333
+ response = JSON.parse(body)
334
+ if response['Response'].key?('Error') == false
335
+ model = DescribeAlarmEventsResponse.new
336
+ model.deserialize(response['Response'])
337
+ model
338
+ else
339
+ code = response['Response']['Error']['Code']
340
+ message = response['Response']['Error']['Message']
341
+ reqid = response['Response']['RequestId']
342
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
343
+ end
344
+ rescue TencentCloud::Common::TencentCloudSDKException => e
345
+ raise e
346
+ rescue StandardError => e
347
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
348
+ end
349
+
350
+ # 查询告警历史
351
+
352
+ # 请注意,**如果使用子用户进行告警历史的查询,只能查询到被授权项目下的告警历史**,或不区分项目的产品的告警历史。如何对子账户授予项目的权限,请参考 [访问管理-项目与标签](https://cloud.tencent.com/document/product/598/32738)。
353
+
354
+ # @param request: Request instance for DescribeAlarmHistories.
355
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmHistoriesRequest`
356
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmHistoriesResponse`
357
+ def DescribeAlarmHistories(request)
358
+ body = send_request('DescribeAlarmHistories', request.serialize)
359
+ response = JSON.parse(body)
360
+ if response['Response'].key?('Error') == false
361
+ model = DescribeAlarmHistoriesResponse.new
362
+ model.deserialize(response['Response'])
363
+ model
364
+ else
365
+ code = response['Response']['Error']['Code']
366
+ message = response['Response']['Error']['Message']
367
+ reqid = response['Response']['RequestId']
368
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
369
+ end
370
+ rescue TencentCloud::Common::TencentCloudSDKException => e
371
+ raise e
372
+ rescue StandardError => e
373
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
374
+ end
375
+
376
+ # 查询告警指标列表
377
+
378
+ # @param request: Request instance for DescribeAlarmMetrics.
379
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmMetricsRequest`
380
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmMetricsResponse`
381
+ def DescribeAlarmMetrics(request)
382
+ body = send_request('DescribeAlarmMetrics', request.serialize)
383
+ response = JSON.parse(body)
384
+ if response['Response'].key?('Error') == false
385
+ model = DescribeAlarmMetricsResponse.new
386
+ model.deserialize(response['Response'])
387
+ model
388
+ else
389
+ code = response['Response']['Error']['Code']
390
+ message = response['Response']['Error']['Message']
391
+ reqid = response['Response']['RequestId']
392
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
393
+ end
394
+ rescue TencentCloud::Common::TencentCloudSDKException => e
395
+ raise e
396
+ rescue StandardError => e
397
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
398
+ end
399
+
400
+ # 查询单个通知模板的详情
401
+
402
+ # @param request: Request instance for DescribeAlarmNotice.
403
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticeRequest`
404
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticeResponse`
405
+ def DescribeAlarmNotice(request)
406
+ body = send_request('DescribeAlarmNotice', request.serialize)
407
+ response = JSON.parse(body)
408
+ if response['Response'].key?('Error') == false
409
+ model = DescribeAlarmNoticeResponse.new
410
+ model.deserialize(response['Response'])
411
+ model
412
+ else
413
+ code = response['Response']['Error']['Code']
414
+ message = response['Response']['Error']['Message']
415
+ reqid = response['Response']['RequestId']
416
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
417
+ end
418
+ rescue TencentCloud::Common::TencentCloudSDKException => e
419
+ raise e
420
+ rescue StandardError => e
421
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
422
+ end
423
+
424
+ # 云监控告警获取告警通知模板所有回调URL
425
+
426
+ # @param request: Request instance for DescribeAlarmNoticeCallbacks.
427
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticeCallbacksRequest`
428
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticeCallbacksResponse`
429
+ def DescribeAlarmNoticeCallbacks(request)
430
+ body = send_request('DescribeAlarmNoticeCallbacks', request.serialize)
431
+ response = JSON.parse(body)
432
+ if response['Response'].key?('Error') == false
433
+ model = DescribeAlarmNoticeCallbacksResponse.new
434
+ model.deserialize(response['Response'])
435
+ model
436
+ else
437
+ code = response['Response']['Error']['Code']
438
+ message = response['Response']['Error']['Message']
439
+ reqid = response['Response']['RequestId']
440
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
441
+ end
442
+ rescue TencentCloud::Common::TencentCloudSDKException => e
443
+ raise e
444
+ rescue StandardError => e
445
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
446
+ end
447
+
448
+ # 查询通知模板列表
449
+
450
+ # @param request: Request instance for DescribeAlarmNotices.
451
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticesRequest`
452
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmNoticesResponse`
453
+ def DescribeAlarmNotices(request)
454
+ body = send_request('DescribeAlarmNotices', request.serialize)
455
+ response = JSON.parse(body)
456
+ if response['Response'].key?('Error') == false
457
+ model = DescribeAlarmNoticesResponse.new
458
+ model.deserialize(response['Response'])
459
+ model
460
+ else
461
+ code = response['Response']['Error']['Code']
462
+ message = response['Response']['Error']['Message']
463
+ reqid = response['Response']['RequestId']
464
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
465
+ end
466
+ rescue TencentCloud::Common::TencentCloudSDKException => e
467
+ raise e
468
+ rescue StandardError => e
469
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
470
+ end
471
+
472
+ # 查询告警策略列表
473
+
474
+ # @param request: Request instance for DescribeAlarmPolicies.
475
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmPoliciesRequest`
476
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmPoliciesResponse`
477
+ def DescribeAlarmPolicies(request)
478
+ body = send_request('DescribeAlarmPolicies', request.serialize)
479
+ response = JSON.parse(body)
480
+ if response['Response'].key?('Error') == false
481
+ model = DescribeAlarmPoliciesResponse.new
482
+ model.deserialize(response['Response'])
483
+ model
484
+ else
485
+ code = response['Response']['Error']['Code']
486
+ message = response['Response']['Error']['Message']
487
+ reqid = response['Response']['RequestId']
488
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
489
+ end
490
+ rescue TencentCloud::Common::TencentCloudSDKException => e
491
+ raise e
492
+ rescue StandardError => e
493
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
494
+ end
495
+
496
+ # 获取单个告警策略详情
497
+
498
+ # @param request: Request instance for DescribeAlarmPolicy.
499
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmPolicyRequest`
500
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlarmPolicyResponse`
501
+ def DescribeAlarmPolicy(request)
502
+ body = send_request('DescribeAlarmPolicy', request.serialize)
503
+ response = JSON.parse(body)
504
+ if response['Response'].key?('Error') == false
505
+ model = DescribeAlarmPolicyResponse.new
506
+ model.deserialize(response['Response'])
507
+ model
508
+ else
509
+ code = response['Response']['Error']['Code']
510
+ message = response['Response']['Error']['Message']
511
+ reqid = response['Response']['RequestId']
512
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
513
+ end
514
+ rescue TencentCloud::Common::TencentCloudSDKException => e
515
+ raise e
516
+ rescue StandardError => e
517
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
518
+ end
519
+
520
+ # Prometheus 报警规则查询接口
521
+
522
+ # @param request: Request instance for DescribeAlertRules.
523
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAlertRulesRequest`
524
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAlertRulesResponse`
525
+ def DescribeAlertRules(request)
526
+ body = send_request('DescribeAlertRules', request.serialize)
527
+ response = JSON.parse(body)
528
+ if response['Response'].key?('Error') == false
529
+ model = DescribeAlertRulesResponse.new
530
+ model.deserialize(response['Response'])
531
+ model
532
+ else
533
+ code = response['Response']['Error']['Code']
534
+ message = response['Response']['Error']['Message']
535
+ reqid = response['Response']['RequestId']
536
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
537
+ end
538
+ rescue TencentCloud::Common::TencentCloudSDKException => e
539
+ raise e
540
+ rescue StandardError => e
541
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
542
+ end
543
+
544
+ # 查询所有名字空间
545
+
546
+ # @param request: Request instance for DescribeAllNamespaces.
547
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeAllNamespacesRequest`
548
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeAllNamespacesResponse`
549
+ def DescribeAllNamespaces(request)
550
+ body = send_request('DescribeAllNamespaces', request.serialize)
551
+ response = JSON.parse(body)
552
+ if response['Response'].key?('Error') == false
553
+ model = DescribeAllNamespacesResponse.new
554
+ model.deserialize(response['Response'])
555
+ model
556
+ else
557
+ code = response['Response']['Error']['Code']
558
+ message = response['Response']['Error']['Message']
559
+ reqid = response['Response']['RequestId']
560
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
561
+ end
562
+ rescue TencentCloud::Common::TencentCloudSDKException => e
563
+ raise e
564
+ rescue StandardError => e
565
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
566
+ end
567
+
568
+ # 获取基础指标属性
569
+
570
+ # @param request: Request instance for DescribeBaseMetrics.
571
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeBaseMetricsRequest`
572
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeBaseMetricsResponse`
573
+ def DescribeBaseMetrics(request)
574
+ body = send_request('DescribeBaseMetrics', request.serialize)
575
+ response = JSON.parse(body)
576
+ if response['Response'].key?('Error') == false
577
+ model = DescribeBaseMetricsResponse.new
578
+ model.deserialize(response['Response'])
579
+ model
580
+ else
581
+ code = response['Response']['Error']['Code']
582
+ message = response['Response']['Error']['Message']
583
+ reqid = response['Response']['RequestId']
584
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
585
+ end
586
+ rescue TencentCloud::Common::TencentCloudSDKException => e
587
+ raise e
588
+ rescue StandardError => e
589
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
590
+ end
591
+
592
+ # 获取基础告警列表
593
+
594
+ # @param request: Request instance for DescribeBasicAlarmList.
595
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeBasicAlarmListRequest`
596
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeBasicAlarmListResponse`
597
+ def DescribeBasicAlarmList(request)
598
+ body = send_request('DescribeBasicAlarmList', request.serialize)
599
+ response = JSON.parse(body)
600
+ if response['Response'].key?('Error') == false
601
+ model = DescribeBasicAlarmListResponse.new
602
+ model.deserialize(response['Response'])
603
+ model
604
+ else
605
+ code = response['Response']['Error']['Code']
606
+ message = response['Response']['Error']['Message']
607
+ reqid = response['Response']['RequestId']
608
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
609
+ end
610
+ rescue TencentCloud::Common::TencentCloudSDKException => e
611
+ raise e
612
+ rescue StandardError => e
613
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
614
+ end
615
+
616
+ # 获取已绑定对象列表
617
+
618
+ # @param request: Request instance for DescribeBindingPolicyObjectList.
619
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeBindingPolicyObjectListRequest`
620
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeBindingPolicyObjectListResponse`
621
+ def DescribeBindingPolicyObjectList(request)
622
+ body = send_request('DescribeBindingPolicyObjectList', request.serialize)
623
+ response = JSON.parse(body)
624
+ if response['Response'].key?('Error') == false
625
+ model = DescribeBindingPolicyObjectListResponse.new
626
+ model.deserialize(response['Response'])
627
+ model
628
+ else
629
+ code = response['Response']['Error']['Code']
630
+ message = response['Response']['Error']['Message']
631
+ reqid = response['Response']['RequestId']
632
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
633
+ end
634
+ rescue TencentCloud::Common::TencentCloudSDKException => e
635
+ raise e
636
+ rescue StandardError => e
637
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
638
+ end
639
+
640
+ # 云监控支持多种类型的监控,此接口列出支持的所有类型
641
+
642
+ # @param request: Request instance for DescribeMonitorTypes.
643
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeMonitorTypesRequest`
644
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeMonitorTypesResponse`
645
+ def DescribeMonitorTypes(request)
646
+ body = send_request('DescribeMonitorTypes', request.serialize)
647
+ response = JSON.parse(body)
648
+ if response['Response'].key?('Error') == false
649
+ model = DescribeMonitorTypesResponse.new
650
+ model.deserialize(response['Response'])
651
+ model
652
+ else
653
+ code = response['Response']['Error']['Code']
654
+ message = response['Response']['Error']['Message']
655
+ reqid = response['Response']['RequestId']
656
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
657
+ end
658
+ rescue TencentCloud::Common::TencentCloudSDKException => e
659
+ raise e
660
+ rescue StandardError => e
661
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
662
+ end
663
+
664
+ # 获取基础告警策略条件
665
+
666
+ # @param request: Request instance for DescribePolicyConditionList.
667
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribePolicyConditionListRequest`
668
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribePolicyConditionListResponse`
669
+ def DescribePolicyConditionList(request)
670
+ body = send_request('DescribePolicyConditionList', request.serialize)
671
+ response = JSON.parse(body)
672
+ if response['Response'].key?('Error') == false
673
+ model = DescribePolicyConditionListResponse.new
674
+ model.deserialize(response['Response'])
675
+ model
676
+ else
677
+ code = response['Response']['Error']['Code']
678
+ message = response['Response']['Error']['Message']
679
+ reqid = response['Response']['RequestId']
680
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
681
+ end
682
+ rescue TencentCloud::Common::TencentCloudSDKException => e
683
+ raise e
684
+ rescue StandardError => e
685
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
686
+ end
687
+
688
+ # 获取基础策略组详情
689
+
690
+ # @param request: Request instance for DescribePolicyGroupInfo.
691
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribePolicyGroupInfoRequest`
692
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribePolicyGroupInfoResponse`
693
+ def DescribePolicyGroupInfo(request)
694
+ body = send_request('DescribePolicyGroupInfo', request.serialize)
695
+ response = JSON.parse(body)
696
+ if response['Response'].key?('Error') == false
697
+ model = DescribePolicyGroupInfoResponse.new
698
+ model.deserialize(response['Response'])
699
+ model
700
+ else
701
+ code = response['Response']['Error']['Code']
702
+ message = response['Response']['Error']['Message']
703
+ reqid = response['Response']['RequestId']
704
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
705
+ end
706
+ rescue TencentCloud::Common::TencentCloudSDKException => e
707
+ raise e
708
+ rescue StandardError => e
709
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
710
+ end
711
+
712
+ # 获取基础策略告警组列表
713
+
714
+ # @param request: Request instance for DescribePolicyGroupList.
715
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribePolicyGroupListRequest`
716
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribePolicyGroupListResponse`
717
+ def DescribePolicyGroupList(request)
718
+ body = send_request('DescribePolicyGroupList', request.serialize)
719
+ response = JSON.parse(body)
720
+ if response['Response'].key?('Error') == false
721
+ model = DescribePolicyGroupListResponse.new
722
+ model.deserialize(response['Response'])
723
+ model
724
+ else
725
+ code = response['Response']['Error']['Code']
726
+ message = response['Response']['Error']['Message']
727
+ reqid = response['Response']['RequestId']
728
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
729
+ end
730
+ rescue TencentCloud::Common::TencentCloudSDKException => e
731
+ raise e
732
+ rescue StandardError => e
733
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
734
+ end
735
+
736
+ # 分页获取产品事件的列表
737
+
738
+ # @param request: Request instance for DescribeProductEventList.
739
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeProductEventListRequest`
740
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeProductEventListResponse`
741
+ def DescribeProductEventList(request)
742
+ body = send_request('DescribeProductEventList', request.serialize)
743
+ response = JSON.parse(body)
744
+ if response['Response'].key?('Error') == false
745
+ model = DescribeProductEventListResponse.new
746
+ model.deserialize(response['Response'])
747
+ model
748
+ else
749
+ code = response['Response']['Error']['Code']
750
+ message = response['Response']['Error']['Message']
751
+ reqid = response['Response']['RequestId']
752
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
753
+ end
754
+ rescue TencentCloud::Common::TencentCloudSDKException => e
755
+ raise e
756
+ rescue StandardError => e
757
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
758
+ end
759
+
760
+ # 查询云监控产品列表
761
+
762
+ # @param request: Request instance for DescribeProductList.
763
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeProductListRequest`
764
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeProductListResponse`
765
+ def DescribeProductList(request)
766
+ body = send_request('DescribeProductList', request.serialize)
767
+ response = JSON.parse(body)
768
+ if response['Response'].key?('Error') == false
769
+ model = DescribeProductListResponse.new
770
+ model.deserialize(response['Response'])
771
+ model
772
+ else
773
+ code = response['Response']['Error']['Code']
774
+ message = response['Response']['Error']['Message']
775
+ reqid = response['Response']['RequestId']
776
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
777
+ end
778
+ rescue TencentCloud::Common::TencentCloudSDKException => e
779
+ raise e
780
+ rescue StandardError => e
781
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
782
+ end
783
+
784
+ # 列出在腾讯云容器服务下创建的 Prometheus 服务发现。
785
+ # <p>注意:前提条件,已经通过 Prometheus 控制台集成了对应的腾讯云容器服务,具体请参考
786
+ # <a href="https://cloud.tencent.com/document/product/248/48859" target="_blank">Agent 安装</a>。</p>
787
+
788
+ # @param request: Request instance for DescribeServiceDiscovery.
789
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeServiceDiscoveryRequest`
790
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeServiceDiscoveryResponse`
791
+ def DescribeServiceDiscovery(request)
792
+ body = send_request('DescribeServiceDiscovery', request.serialize)
793
+ response = JSON.parse(body)
794
+ if response['Response'].key?('Error') == false
795
+ model = DescribeServiceDiscoveryResponse.new
796
+ model.deserialize(response['Response'])
797
+ model
798
+ else
799
+ code = response['Response']['Error']['Code']
800
+ message = response['Response']['Error']['Message']
801
+ reqid = response['Response']['RequestId']
802
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
803
+ end
804
+ rescue TencentCloud::Common::TencentCloudSDKException => e
805
+ raise e
806
+ rescue StandardError => e
807
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
808
+ end
809
+
810
+ # 根据维度条件查询监控数据
811
+
812
+ # @param request: Request instance for DescribeStatisticData.
813
+ # @type request: :class:`Tencentcloud::monitor::V20180724::DescribeStatisticDataRequest`
814
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::DescribeStatisticDataResponse`
815
+ def DescribeStatisticData(request)
816
+ body = send_request('DescribeStatisticData', request.serialize)
817
+ response = JSON.parse(body)
818
+ if response['Response'].key?('Error') == false
819
+ model = DescribeStatisticDataResponse.new
820
+ model.deserialize(response['Response'])
821
+ model
822
+ else
823
+ code = response['Response']['Error']['Code']
824
+ message = response['Response']['Error']['Message']
825
+ reqid = response['Response']['RequestId']
826
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
827
+ end
828
+ rescue TencentCloud::Common::TencentCloudSDKException => e
829
+ raise e
830
+ rescue StandardError => e
831
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
832
+ end
833
+
834
+ # 获取云产品的监控数据。此接口不适用于拉取容器服务监控数据,如需拉取容器服务监控数据,请使用[根据维度条件查询监控数据](https://cloud.tencent.com/document/product/248/51845)接口。
835
+ # 传入产品的命名空间、对象维度描述和监控指标即可获得相应的监控数据。
836
+ # 接口调用频率限制为:20次/秒,1200次/分钟。单请求最多可支持批量拉取10个实例的监控数据,单请求的数据点数限制为1440个。
837
+ # 若您需要调用的指标、对象较多,可能存在因限频出现拉取失败的情况,建议尽量将请求按时间维度均摊。
838
+
839
+ # @param request: Request instance for GetMonitorData.
840
+ # @type request: :class:`Tencentcloud::monitor::V20180724::GetMonitorDataRequest`
841
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::GetMonitorDataResponse`
842
+ def GetMonitorData(request)
843
+ body = send_request('GetMonitorData', request.serialize)
844
+ response = JSON.parse(body)
845
+ if response['Response'].key?('Error') == false
846
+ model = GetMonitorDataResponse.new
847
+ model.deserialize(response['Response'])
848
+ model
849
+ else
850
+ code = response['Response']['Error']['Code']
851
+ message = response['Response']['Error']['Message']
852
+ reqid = response['Response']['RequestId']
853
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
854
+ end
855
+ rescue TencentCloud::Common::TencentCloudSDKException => e
856
+ raise e
857
+ rescue StandardError => e
858
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
859
+ end
860
+
861
+ # 云监控告警编辑告警通知模板
862
+
863
+ # @param request: Request instance for ModifyAlarmNotice.
864
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmNoticeRequest`
865
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmNoticeResponse`
866
+ def ModifyAlarmNotice(request)
867
+ body = send_request('ModifyAlarmNotice', request.serialize)
868
+ response = JSON.parse(body)
869
+ if response['Response'].key?('Error') == false
870
+ model = ModifyAlarmNoticeResponse.new
871
+ model.deserialize(response['Response'])
872
+ model
873
+ else
874
+ code = response['Response']['Error']['Code']
875
+ message = response['Response']['Error']['Message']
876
+ reqid = response['Response']['RequestId']
877
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
878
+ end
879
+ rescue TencentCloud::Common::TencentCloudSDKException => e
880
+ raise e
881
+ rescue StandardError => e
882
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
883
+ end
884
+
885
+ # 修改告警策略触发条件
886
+
887
+ # @param request: Request instance for ModifyAlarmPolicyCondition.
888
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyConditionRequest`
889
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyConditionResponse`
890
+ def ModifyAlarmPolicyCondition(request)
891
+ body = send_request('ModifyAlarmPolicyCondition', request.serialize)
892
+ response = JSON.parse(body)
893
+ if response['Response'].key?('Error') == false
894
+ model = ModifyAlarmPolicyConditionResponse.new
895
+ model.deserialize(response['Response'])
896
+ model
897
+ else
898
+ code = response['Response']['Error']['Code']
899
+ message = response['Response']['Error']['Message']
900
+ reqid = response['Response']['RequestId']
901
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
902
+ end
903
+ rescue TencentCloud::Common::TencentCloudSDKException => e
904
+ raise e
905
+ rescue StandardError => e
906
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
907
+ end
908
+
909
+ # 告警2.0编辑告警策略基本信息,包括策略名、备注
910
+
911
+ # @param request: Request instance for ModifyAlarmPolicyInfo.
912
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyInfoRequest`
913
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyInfoResponse`
914
+ def ModifyAlarmPolicyInfo(request)
915
+ body = send_request('ModifyAlarmPolicyInfo', request.serialize)
916
+ response = JSON.parse(body)
917
+ if response['Response'].key?('Error') == false
918
+ model = ModifyAlarmPolicyInfoResponse.new
919
+ model.deserialize(response['Response'])
920
+ model
921
+ else
922
+ code = response['Response']['Error']['Code']
923
+ message = response['Response']['Error']['Message']
924
+ reqid = response['Response']['RequestId']
925
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
926
+ end
927
+ rescue TencentCloud::Common::TencentCloudSDKException => e
928
+ raise e
929
+ rescue StandardError => e
930
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
931
+ end
932
+
933
+ # 云监控告警修改告警策略绑定的告警通知模板
934
+
935
+ # @param request: Request instance for ModifyAlarmPolicyNotice.
936
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyNoticeRequest`
937
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyNoticeResponse`
938
+ def ModifyAlarmPolicyNotice(request)
939
+ body = send_request('ModifyAlarmPolicyNotice', request.serialize)
940
+ response = JSON.parse(body)
941
+ if response['Response'].key?('Error') == false
942
+ model = ModifyAlarmPolicyNoticeResponse.new
943
+ model.deserialize(response['Response'])
944
+ model
945
+ else
946
+ code = response['Response']['Error']['Code']
947
+ message = response['Response']['Error']['Message']
948
+ reqid = response['Response']['RequestId']
949
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
950
+ end
951
+ rescue TencentCloud::Common::TencentCloudSDKException => e
952
+ raise e
953
+ rescue StandardError => e
954
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
955
+ end
956
+
957
+ # 启停告警策略
958
+
959
+ # @param request: Request instance for ModifyAlarmPolicyStatus.
960
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyStatusRequest`
961
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyStatusResponse`
962
+ def ModifyAlarmPolicyStatus(request)
963
+ body = send_request('ModifyAlarmPolicyStatus', request.serialize)
964
+ response = JSON.parse(body)
965
+ if response['Response'].key?('Error') == false
966
+ model = ModifyAlarmPolicyStatusResponse.new
967
+ model.deserialize(response['Response'])
968
+ model
969
+ else
970
+ code = response['Response']['Error']['Code']
971
+ message = response['Response']['Error']['Message']
972
+ reqid = response['Response']['RequestId']
973
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
974
+ end
975
+ rescue TencentCloud::Common::TencentCloudSDKException => e
976
+ raise e
977
+ rescue StandardError => e
978
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
979
+ end
980
+
981
+ # 云监控告警修改告警策略的触发任务,TriggerTasks字段放触发任务列表,TriggerTasks传空数组时,代表解绑该策略的所有触发任务。
982
+
983
+ # @param request: Request instance for ModifyAlarmPolicyTasks.
984
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyTasksRequest`
985
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmPolicyTasksResponse`
986
+ def ModifyAlarmPolicyTasks(request)
987
+ body = send_request('ModifyAlarmPolicyTasks', request.serialize)
988
+ response = JSON.parse(body)
989
+ if response['Response'].key?('Error') == false
990
+ model = ModifyAlarmPolicyTasksResponse.new
991
+ model.deserialize(response['Response'])
992
+ model
993
+ else
994
+ code = response['Response']['Error']['Code']
995
+ message = response['Response']['Error']['Message']
996
+ reqid = response['Response']['RequestId']
997
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
998
+ end
999
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1000
+ raise e
1001
+ rescue StandardError => e
1002
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1003
+ end
1004
+
1005
+ # 修改告警接收人
1006
+
1007
+ # @param request: Request instance for ModifyAlarmReceivers.
1008
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmReceiversRequest`
1009
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyAlarmReceiversResponse`
1010
+ def ModifyAlarmReceivers(request)
1011
+ body = send_request('ModifyAlarmReceivers', request.serialize)
1012
+ response = JSON.parse(body)
1013
+ if response['Response'].key?('Error') == false
1014
+ model = ModifyAlarmReceiversResponse.new
1015
+ model.deserialize(response['Response'])
1016
+ model
1017
+ else
1018
+ code = response['Response']['Error']['Code']
1019
+ message = response['Response']['Error']['Message']
1020
+ reqid = response['Response']['RequestId']
1021
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1022
+ end
1023
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1024
+ raise e
1025
+ rescue StandardError => e
1026
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1027
+ end
1028
+
1029
+ # 更新策略组
1030
+
1031
+ # @param request: Request instance for ModifyPolicyGroup.
1032
+ # @type request: :class:`Tencentcloud::monitor::V20180724::ModifyPolicyGroupRequest`
1033
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::ModifyPolicyGroupResponse`
1034
+ def ModifyPolicyGroup(request)
1035
+ body = send_request('ModifyPolicyGroup', request.serialize)
1036
+ response = JSON.parse(body)
1037
+ if response['Response'].key?('Error') == false
1038
+ model = ModifyPolicyGroupResponse.new
1039
+ model.deserialize(response['Response'])
1040
+ model
1041
+ else
1042
+ code = response['Response']['Error']['Code']
1043
+ message = response['Response']['Error']['Message']
1044
+ reqid = response['Response']['RequestId']
1045
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1046
+ end
1047
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1048
+ raise e
1049
+ rescue StandardError => e
1050
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1051
+ end
1052
+
1053
+ # 默认接口请求频率限制:50次/秒。
1054
+ # 默认单租户指标上限:100个。
1055
+ # 单次上报最多 30 个指标/值对,请求返回错误时,请求中所有的指标/值均不会被保存。
1056
+
1057
+ # 上报的时间戳为期望保存的时间戳,建议构造整数分钟时刻的时间戳。
1058
+ # 时间戳时间范围必须为当前时间到 300 秒前之间。
1059
+ # 同一 IP 指标对的数据需按分钟先后顺序上报。
1060
+
1061
+ # @param request: Request instance for PutMonitorData.
1062
+ # @type request: :class:`Tencentcloud::monitor::V20180724::PutMonitorDataRequest`
1063
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::PutMonitorDataResponse`
1064
+ def PutMonitorData(request)
1065
+ body = send_request('PutMonitorData', request.serialize)
1066
+ response = JSON.parse(body)
1067
+ if response['Response'].key?('Error') == false
1068
+ model = PutMonitorDataResponse.new
1069
+ model.deserialize(response['Response'])
1070
+ model
1071
+ else
1072
+ code = response['Response']['Error']['Code']
1073
+ message = response['Response']['Error']['Message']
1074
+ reqid = response['Response']['RequestId']
1075
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1076
+ end
1077
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1078
+ raise e
1079
+ rescue StandardError => e
1080
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1081
+ end
1082
+
1083
+ # 发送自定义消息告警
1084
+
1085
+ # @param request: Request instance for SendCustomAlarmMsg.
1086
+ # @type request: :class:`Tencentcloud::monitor::V20180724::SendCustomAlarmMsgRequest`
1087
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::SendCustomAlarmMsgResponse`
1088
+ def SendCustomAlarmMsg(request)
1089
+ body = send_request('SendCustomAlarmMsg', request.serialize)
1090
+ response = JSON.parse(body)
1091
+ if response['Response'].key?('Error') == false
1092
+ model = SendCustomAlarmMsgResponse.new
1093
+ model.deserialize(response['Response'])
1094
+ model
1095
+ else
1096
+ code = response['Response']['Error']['Code']
1097
+ message = response['Response']['Error']['Message']
1098
+ reqid = response['Response']['RequestId']
1099
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1100
+ end
1101
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1102
+ raise e
1103
+ rescue StandardError => e
1104
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1105
+ end
1106
+
1107
+ # 设置一个策略为该告警策略类型、该项目的默认告警策略。
1108
+ # 同一项目下相同的告警策略类型,就会被设置为非默认。
1109
+
1110
+ # @param request: Request instance for SetDefaultAlarmPolicy.
1111
+ # @type request: :class:`Tencentcloud::monitor::V20180724::SetDefaultAlarmPolicyRequest`
1112
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::SetDefaultAlarmPolicyResponse`
1113
+ def SetDefaultAlarmPolicy(request)
1114
+ body = send_request('SetDefaultAlarmPolicy', request.serialize)
1115
+ response = JSON.parse(body)
1116
+ if response['Response'].key?('Error') == false
1117
+ model = SetDefaultAlarmPolicyResponse.new
1118
+ model.deserialize(response['Response'])
1119
+ model
1120
+ else
1121
+ code = response['Response']['Error']['Code']
1122
+ message = response['Response']['Error']['Message']
1123
+ reqid = response['Response']['RequestId']
1124
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1125
+ end
1126
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1127
+ raise e
1128
+ rescue StandardError => e
1129
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1130
+ end
1131
+
1132
+ # 删除全部的关联对象
1133
+
1134
+ # @param request: Request instance for UnBindingAllPolicyObject.
1135
+ # @type request: :class:`Tencentcloud::monitor::V20180724::UnBindingAllPolicyObjectRequest`
1136
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::UnBindingAllPolicyObjectResponse`
1137
+ def UnBindingAllPolicyObject(request)
1138
+ body = send_request('UnBindingAllPolicyObject', request.serialize)
1139
+ response = JSON.parse(body)
1140
+ if response['Response'].key?('Error') == false
1141
+ model = UnBindingAllPolicyObjectResponse.new
1142
+ model.deserialize(response['Response'])
1143
+ model
1144
+ else
1145
+ code = response['Response']['Error']['Code']
1146
+ message = response['Response']['Error']['Message']
1147
+ reqid = response['Response']['RequestId']
1148
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1149
+ end
1150
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1151
+ raise e
1152
+ rescue StandardError => e
1153
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1154
+ end
1155
+
1156
+ # 删除策略的关联对象
1157
+
1158
+ # @param request: Request instance for UnBindingPolicyObject.
1159
+ # @type request: :class:`Tencentcloud::monitor::V20180724::UnBindingPolicyObjectRequest`
1160
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::UnBindingPolicyObjectResponse`
1161
+ def UnBindingPolicyObject(request)
1162
+ body = send_request('UnBindingPolicyObject', request.serialize)
1163
+ response = JSON.parse(body)
1164
+ if response['Response'].key?('Error') == false
1165
+ model = UnBindingPolicyObjectResponse.new
1166
+ model.deserialize(response['Response'])
1167
+ model
1168
+ else
1169
+ code = response['Response']['Error']['Code']
1170
+ message = response['Response']['Error']['Message']
1171
+ reqid = response['Response']['RequestId']
1172
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1173
+ end
1174
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1175
+ raise e
1176
+ rescue StandardError => e
1177
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1178
+ end
1179
+
1180
+ # 更新 Prometheus 的报警规则。
1181
+
1182
+ # 请注意,**告警对象和告警消息是 Prometheus Rule Annotations 的特殊字段,需要通过 annotations 来传递,对应的 Key 分别为summary/description**,,请参考 [Prometheus Rule更多配置请参考](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/)。
1183
+
1184
+ # @param request: Request instance for UpdateAlertRule.
1185
+ # @type request: :class:`Tencentcloud::monitor::V20180724::UpdateAlertRuleRequest`
1186
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::UpdateAlertRuleResponse`
1187
+ def UpdateAlertRule(request)
1188
+ body = send_request('UpdateAlertRule', request.serialize)
1189
+ response = JSON.parse(body)
1190
+ if response['Response'].key?('Error') == false
1191
+ model = UpdateAlertRuleResponse.new
1192
+ model.deserialize(response['Response'])
1193
+ model
1194
+ else
1195
+ code = response['Response']['Error']['Code']
1196
+ message = response['Response']['Error']['Message']
1197
+ reqid = response['Response']['RequestId']
1198
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1199
+ end
1200
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1201
+ raise e
1202
+ rescue StandardError => e
1203
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1204
+ end
1205
+
1206
+ # 更新 Prometheus 报警策略状态
1207
+
1208
+ # @param request: Request instance for UpdateAlertRuleState.
1209
+ # @type request: :class:`Tencentcloud::monitor::V20180724::UpdateAlertRuleStateRequest`
1210
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::UpdateAlertRuleStateResponse`
1211
+ def UpdateAlertRuleState(request)
1212
+ body = send_request('UpdateAlertRuleState', request.serialize)
1213
+ response = JSON.parse(body)
1214
+ if response['Response'].key?('Error') == false
1215
+ model = UpdateAlertRuleStateResponse.new
1216
+ model.deserialize(response['Response'])
1217
+ model
1218
+ else
1219
+ code = response['Response']['Error']['Code']
1220
+ message = response['Response']['Error']['Message']
1221
+ reqid = response['Response']['RequestId']
1222
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1223
+ end
1224
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1225
+ raise e
1226
+ rescue StandardError => e
1227
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1228
+ end
1229
+
1230
+ # 在腾讯云容器服务下更新 Prometheus 服务发现。
1231
+ # <p>注意:前提条件,已经通过 Prometheus 控制台集成了对应的腾讯云容器服务,具体请参考
1232
+ # <a href="https://cloud.tencent.com/document/product/248/48859" target="_blank">Agent 安装</a>。</p>
1233
+
1234
+ # @param request: Request instance for UpdateServiceDiscovery.
1235
+ # @type request: :class:`Tencentcloud::monitor::V20180724::UpdateServiceDiscoveryRequest`
1236
+ # @rtype: :class:`Tencentcloud::monitor::V20180724::UpdateServiceDiscoveryResponse`
1237
+ def UpdateServiceDiscovery(request)
1238
+ body = send_request('UpdateServiceDiscovery', request.serialize)
1239
+ response = JSON.parse(body)
1240
+ if response['Response'].key?('Error') == false
1241
+ model = UpdateServiceDiscoveryResponse.new
1242
+ model.deserialize(response['Response'])
1243
+ model
1244
+ else
1245
+ code = response['Response']['Error']['Code']
1246
+ message = response['Response']['Error']['Message']
1247
+ reqid = response['Response']['RequestId']
1248
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
1249
+ end
1250
+ rescue TencentCloud::Common::TencentCloudSDKException => e
1251
+ raise e
1252
+ rescue StandardError => e
1253
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
1254
+ end
1255
+
1256
+
1257
+ end
1258
+ end
1259
+ end
1260
+ end