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.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"} . It should be entered completely, where name and format cannot be empty |
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 , for example, {"cpu_usage":"float"} |
options | No | map | Common fine-tuning configuration information, for 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 days but ≤ 20 days | 3 days |
> 20 days but ≤ 49 days | 7 days |
> 49 days but ≤ 3 months | 15 days |
> 3 months | 30 days |
Never expires | 30 days |
error
field. If the response content contains the error
field, the request failed. For the error details, see the error
field description.curl -u root:le201909 -H 'Content-Type:application/json' -X PUT 172.xx.xx.4: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}}'
{"acknowledged": true,"message": "create ctsdb metric ctsdb_test success!"}
{"error": {"reason": "table ctsdb_test already exist","type": "metric_exception"},"status": 201}