通过 API 在 OTSDB 中添加指标名称

Add metric name in OTSDB via API

我正在从不同来源向 OTSDB 添加数据。但我使用 XML 文件为每个数据点提供指标名称。此外,我无权访问 OTSDB 以通过终端

创建指标名称

我已参考以下链接:-

API PUT

GitHub Issue

在gitHub问题中,我无法理解如何使用--auto-metirc

我知道如何使用终端创建指标:-

我在这里使用终端创建 abxcs metirc。

./tsdb mkmetric abxcs

但是如何使用 API 创建指标?

仅供参考:- 请建议使用 JAVA

的解决方案

提前感谢您的帮助。

为了即时自动创建指标名称,您需要设置

tsd.core.auto_create_metrics = true

在 OpenTSDB 配置文件中。参考:http://opentsdb.net/docs/build/html/user_guide/configuration.html

Whether or not a data point with a new metric will assign a UID to the metric. When false, a data point with a metric that is not in the database will be rejected and an exception will be thrown.

CLI 等效于在启动 tsd 进程时通过 --auto-metric 开关。