1

我正在使用以下命令在 kairosdb 中插入数据:reference

bin/kairosdb.sh 导入 -f 导出.txt

但在 kairosdb.log 文件中,我收到以下错误:

08-10|13:54:33.443 [main] INFO  [Main.java:267] -      KairosDB service started
08-10|13:54:33.443 [main] INFO  [Main.java:268] - ------------------------------------------
08-10|14:00:38.236 [main] INFO  [TelnetServerModule.java:42] - Configuring module TelnetServerModule
08-10|14:00:39.259 [main] INFO  [CassandraHostRetryService.java:48] - Downed Host Retry service started with queue size -1 and retry delay 10s
08-10|14:00:39.357 [main] INFO  [JmxMonitor.java:52] - Registering JMX me.prettyprint.cassandra.service_kairosdb-cluster:ServiceType=hector,MonitorType=hector
08-10|14:00:39.734 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.
08-10|14:00:40.023 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.
08-10|14:00:40.216 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.
08-10|14:00:40.295 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.
08-10|14:00:40.391 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.
08-10|14:00:40.439 [main] ERROR [Main.java:345] - metric[0](name=meterreadings).tag[building_type].value may not be empty.

我的 export.txt 文件是:

administrator@administrator-IdeaCentre-Q190:~/Abharthan/kairosdb$ head -10 export.txt
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"1","building_type":"ElementarySchool","meter_type":"temperature","unit":"F"},"value":"34.85"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"2","building_type":"Park","meter_type":"temperature","unit":"F"},"value":"0"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"3","building_type":"Industrial","meter_type":"temperature","unit":"F"},"value":"0.07"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"4","building_type":"RecreationCenter","meter_type":"temperature","unit":"F"},"value":"0"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"5","building_type":"Park","meter_type":"temperature","unit":"F"},"value":"2.2"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"6","building_type":"CommunityCenter","meter_type":"temperature","unit":"F"},"value":"31.41"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"7","building_type":"Office","meter_type":"temperature","unit":"F"},"value":"0"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"8","building_type":"ElementarySchool","meter_type":"temperature","unit":"F"},"value":"10.88"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"9","building_type":"ElementarySchool","meter_type":"temperature","unit":"F"},"value":"42.27"}
{"name": "meterreadings", "timestamp":"1359695700","tags": {"Building_id":"10","building_type":"ElementarySchool","meter_type":"temperature","unit":"F"},"value":"10.14"}

请建议如何解决此错误。

4

1 回答 1

1

通常,您描述的问题来自没有关联值的标签。T看起来你在前 10 行之后的值是 building_type 的空值(查找"building_type":""或类似)。

通过查看您的 JSON,我看到了几个不相关的可能问题:

  • 您的时间戳似乎以 Unix 秒为单位 - 它应该以毫秒为单位(由于 OpenTSDB 兼容性,它可以与 Telnet API 一起使用,但 KairosDB 需要毫秒)
  • 您的时间戳始终相同(因此您会一次又一次地更新相同的样本)
  • 您的值是一个字符串(虽然您可能希望使用长整数或浮点数),它可能有效,但我不建议以这种方式进行
于 2015-08-11T11:52:57.143 回答