【问题标题】:statsd influxdb retention policy not found未找到 statsd influxdb 保留策略
【发布时间】:2015-09-10 08:03:32
【问题描述】:

向 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

【问题讨论】:

    标签: statsd influxdb


    【解决方案1】:

    您确实找到了正确的解决方案,即任何包含句点的标识符都必须用双引号引起来。原始查询解析为select * from the measurement "counter" from the retention policy "foo",因此出现foo not found 错误。

    【讨论】:

      【解决方案2】:

      对不起,查询应该是

      $curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=mydb" --data-urlencode 'q=SELECT * FROM "foo.counter"'
      

      在 "foo.counter" 上加上双引号,错误信息没有帮助。

      【讨论】:

        猜你喜欢
        • 2018-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-10-08
        • 2019-09-11
        相关资源
        最近更新 更多