You can report custom event monitoring data to CloudMonitor by sending an HTTP request.
Endpoints
For the endpoints used to report custom events, see Appendix 3: Endpoints for reporting monitoring data.
Request syntax
The following syntax is used to report custom events over HTTP:
POST /event/custom/upload HTTP/1.1
Authorization:<AuthorizationString>
Content-Length:<Content Length>
Content-MD5:<Content MD5>
Content-Type:application/json
Date:<GMT Date>
Host:metrichub-cms-cn-hangzhou.aliyuncs.com
x-cms-signature:hmac-sha1
x-cms-api-version:1.0
x-cms-ip:30.27.XX.XX
User-Agent:cms-java-sdk-v-1.0
[{"content":"EventContent","groupId":GroupId,"name":"EventName","time":"20171023T144439.948+0800"}]
Request headers and parameters
The following tables describe the headers and parameters in the HTTP request.
-
Request headers
Header
Type
Description
Authorization
String
The authorization string in the format of
AccessKeyID:SignString.-
To obtain the AccessKey ID, see Obtain an AccessKey pair.
-
To sign the string, see Signature algorithm: HMAC-SHA1.
Content-Length
Long
The body length of the HTTP request, as defined in RFC 2616. Required only if the request has a body.
Content-MD5
String
The MD5 hash of the HTTP request body. The hash is a string of uppercase letters and digits. Required only if the request has a body.
Content-Type
String
The content type of the HTTP request. Set the value to
application/json.Date
String
The standard timestamp header of the HTTP request. The timestamp follows the RFC 1123 format and uses UTC.
Example:
Mon, 3 Jan 2010 08:33:47 GMT.Host
String
The full hostname of the HTTP request, without the protocol prefix such as https://.
Example:
metrichub-cms-cn-hangzhou.aliyuncs.com.x-cms-api-version
String
The version of the API. Set the value to 1.0.
x-cms-signature
String
The signature algorithm. CloudMonitor supports HMAC-SHA1.
x-cms-ip
String
The IP address of the host reporting the custom events.
User-Agent
String
The description of the client.
-
-
Request parameters
Parameter
Type
Required
Description
content
String
Yes
The content of the custom event.
name
String
Yes
The name of the custom event.
groupId
Long
No
The ID of the application group that the custom event belongs to.
time
String
No
The time when the custom event occurred.
Sample response
The following sample response is returned for a successful request:
{
"code":"200",// The HTTP status code 200 indicates that the request was successful.
"msg":""// The value is empty if the events are reported.
}