The address is the instance IP and port, such as 10.13.20.15:9200
, which can be obtained in the console.
/_metric/${metric_name}
, where ${metric_name}
is the name of the metric to be created.Note:For the naming limits of metrics, please see System Limits.
None
Parameter | Required | Type | Description |
---|---|---|---|
tags | Yes | map | Tag, which is used to uniquely identify data. It must contain at least one tag and supports the following data types: text (string with tokens and full-text index), string (string without tokens), long , integer , short , byte , double , float , date , and boolean The format is {"region": "string","set": "long","host": "string"} |
time | Yes | map | Configuration of time column, which is used to store the unique time when data is written into the database, such as {"name": "timestamp", "format": "epoch_second"} . If this parameter is left empty, it will be specified as {"name": "timestamp", "format": "epoch_millis"} by the system by default |
fields | No | map | Fields for data storage. We recommend you use data types most suitable for your actual business to save the space. The following data types are supported: string , long , integer , short , byte , double , float , date , and boolean Example: {"cpu_usage":"float"} |
options | No | map | Common fine-tuning configuration information Example: {"expire_day":7,"refresh_interval":"10s","number_of_shards":5,"number_of_replicas":1,"rolling_period":1,"max_string_length": 256,"default_date_format":"strict_date_optional_time","indexed_fields":["host"]} |
name
of the time
field is of the timestamp
type by default. The time formats (format
) are fully compatible with those in Elasticsearch, such as epoch_millis
(Unix timestamp in milliseconds), epoch_second
(Unix timestamp in seconds), basic_date
(in yyyyMMdd
format), and basic_date_time
(in yyyyMMdd'T'HHmmss.SSSZ
format).options
values and their descriptions:date
data type of custom tags and fields, which is strict_date_optional_time
or epoch_millis
by default.tag
and field
, and its default value is tag
.Expiration Time | Child Metric Period |
---|---|
≤ 7 days | 1 day |
> 7 day and ≤ 20 days | 3 days |
> 20 days and ≤ 49 days | 7 days |
> 49 days and ≤ 3 months | 15 days |
> 3 months | 30 days |
Never expire | 30 days |
You need to judge whether a request is successful based on the error
field. If the response content contains the error
field, the request failed. For the error details, please see the error
field description.
Request:
curl -u root:le201909 -H 'Content-Type:application/json' -X PUT 172.16.345.14:9201/_metric/ctsdb_test -d'
{
"tags":
{
"region":"string"
},
"time":
{
"name":"timestamp",
"format":"epoch_second"
},
"fields":
{
"cpuUsage":"float"
},
"options":
{
"expire_day":7,
"refresh_interval":"10s",
"number_of_shards":5
}
}
'
Response upon success:
{
"acknowledged": true,
"message": "create ctsdb metric ctsdb_test success!"
}
Response upon failure:
{
"error": {
"reason": "table ctsdb_test already exist",
"type": "metric_exception"
},
"status": 201
}
Was this page helpful?