云监控 --- PutCustomEvent

简介: 调用PutCustomEvent接口上报自定义事件的监控数据。

Step By Step

  1. API参数
  2. 调用API
  3. 查看结果

一.API参数

Content String

事件内容。最低范围:1~50。

EventInfo.N.EventName String

事件名称。最大值范围:1~50。

EventInfo.N.Time String

发生事件的时间。最大范围:1~50。

EventInfo.N.GroupId String

应用分组ID。最大范围:0~50。

默认值:0.0表示上报的事件不属于任何一个应用分组。


二.调用API

<dependencies><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-cms</artifactId><version>4.23.12</version></dependency><dependency><groupId>com.aliyun</groupId><artifactId>aliyun-java-sdk-core</artifactId><version>[4.0.0,5.0.0)</version></dependency></dependencies>
importcom.aliyuncs.DefaultAcsClient;
importcom.aliyuncs.IAcsClient;
importcom.aliyuncs.exceptions.ClientException;
importcom.aliyuncs.exceptions.ServerException;
importcom.aliyuncs.profile.DefaultProfile;
importcom.google.gson.Gson;
importjava.util.*;
importcom.aliyuncs.cms.model.v20190101.*;
publicclassPutCustomEvent {
publicstaticvoidmain(String[] args) {
DefaultProfileprofile=DefaultProfile.getProfile("cn-shanghai", "<accessKeyId>", "<accessSecret>");
IAcsClientclient=newDefaultAcsClient(profile);
PutCustomEventRequestrequest=newPutCustomEventRequest();
request.setRegionId("cn-shanghai");
List<PutCustomEventRequest.EventInfo>eventInfoList=newArrayList<PutCustomEventRequest.EventInfo>();
PutCustomEventRequest.EventInfoeventInfo1=newPutCustomEventRequest.EventInfo();
eventInfo1.setEventName("事件名称");
eventInfo1.setContent("事件内容");
eventInfo1.setTime("事件发生时间");
eventInfo1.setGroupId("应用分组ID,0不属于任何应用分组");
eventInfoList.add(eventInfo1);
request.setEventInfos(eventInfoList);
try {
PutCustomEventResponseresponse=client.getAcsResponse(request);
System.out.println(newGson().toJson(response));
        } catch (ServerExceptione) {
e.printStackTrace();
        } catch (ClientExceptione) {
System.out.println("ErrCode:"+e.getErrCode());
System.out.println("ErrMsg:"+e.getErrMsg());
System.out.println("RequestId:"+e.getRequestId());
        }
    }
}

三.查看结果

云监控 - 事件监控 - 自定义事件

image.png


目录
相关文章
|
应用服务中间件 nginx 数据安全/隐私保护
nginx中session ticket重用Session提高https性能分析
使用session ticket机制可以提高ssl握手的效率,并节约有效的服务器计算资源
16468 0
|
6月前
|
Prometheus 监控 Cloud Native
从系统监控到业务洞察:ARMS 自定义指标采集功能全解析
阿里云应用实时监控服务 ARMS 推出自定义指标采集功能,让 APM 真正深入业务核心,订单、库存、转化率等核心数据尽在掌控!
591 68
|
10月前
|
Oracle Java Linux
JDK
JDK
5337 0
|
KVM 虚拟化
KVM虚拟机的热迁移
这篇文章详细介绍了KVM虚拟机的热迁移过程,包括临时迁移和永久迁移的步骤,以及可能遇到的故障和解决方案。
891 1
KVM虚拟机的热迁移
Adobe Photoshop CC 2019下载中文永久安装和破解教程
Adobe Photoshop CC 2019下载中文永久安装和破解教程
52056 0
|
网络协议 Linux 缓存
|
监控 安全 API
阿里云短信服务控制台发送记录查询操作示例
短信服务(Short Message Service)是广大企业客户快速触达手机用户所优选使用的通信能力。调用API或用群发助手,即可发送验证码、通知类和营销类短信;国内验证短信秒级触达,到达率最高可达99%;国际/港澳台短信覆盖200多个国家和地区,安全稳定,接入便捷,智能监控调度广受出海企业选用。客户在使用服务后,往往有查询发送记录的需求。短信发送后可通过短信服务控制台查询短信发送记录和详细信息。但查询记录页面仅支持查询最近6个月的单日发送明细,如果需要更长时间段的发送明细,就需要使用导出功能。导出功能支持导出近三年的数据,但是一些客户通常不知这隐藏操作。本文快速演示下导出操作,以供参考。
2541 0
阿里云短信服务控制台发送记录查询操作示例
|
安全 网络协议 Shell
2022渗透测试-反弹shell的详细讲解
2022渗透测试-反弹shell的详细讲解
2022渗透测试-反弹shell的详细讲解