问题
I am inserting data in kairosdb using the command: reference
bin/kairosdb.sh import -f export.txt
but in the kairosdb.log file I am getting following error:
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.
My export.txt file is:
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"}
Please suggest how to fix this error.
回答1:
usually the problem you describe comes from tags being provided with no associated value. TIt looks like you have values after the 10 first lines with empty value for building_type (look for "building_type":""
or similar).
By looking at your JSON I see several unrelated possible problems :
- Your timestamp seems to be in Unix seconds - it should be in milliseconds (that could work with Telnet API because of OpenTSDB compatibility, but KairosDB expects milliseconds)
- Your timestamp is always the same (thus you updating the same sample and again)
- Your value is a String (while you'd probably like to use a long or a float), it may work but I don't recommend proceeding this way
来源:https://stackoverflow.com/questions/31926735/kairosdb-error-metric0name-abcd-tagxyz-value-may-not-be-empty