在向statsd发送数据时:
echo "foo:1|c" | nc -u -w0 127.0.0.1 8125
statsd将在刷新后输出结果并将数据插入到InfluxDB中:
{ counters:
{ 'statsd.bad_lines_seen': 0,
'statsd.packets_received': 1,
'statsd.metrics_received': 1,
foo: 1 },
timers: {},
gauges: { 'statsd.timestamp_lag': 0 },
timer_data: {},
counter_rates:
{ 'statsd.bad_lines_seen': 0,
'statsd.packets_received': 0.03333333333333333,
'statsd.metrics_received': 0.03333333333333333,
foo: 0.03333333333333333 },
sets: {},
pctThreshold: [ 90 ] }
运行命令以显示InfluxDB信息:
$curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SHOW MEASUREMENTS"
会成功回复:
{
"results": [
{
"series": [
{
"name": "measurements",
"columns": [
"name"
],
"values": [
[
"cpu_load_short"
],
[
"foo.counter"
]
]
}
]
}
]
}
然后我想查询来自InfluxDB的数据:
$curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode "q=SELECT value FROM foo.counter"
我收到错误消息:
{
"results": [
{
"error": "retention policy not found"
}
]
}
有任何想法吗?流入数据库:0.9.3
2 回答
您确实找到了正确的解决方案,即包含句点的任何标识符都必须加双引号 . 原始查询解析为
select * from the measurement "counter" from the retention policy "foo"
,因此foo not found
错误 .对不起,查询应该是
在“foo.counter”上加上双引号,错误信息无济于事 .