【问题标题】:How to find all metrics associated to a tag value如何查找与标签值关联的所有指标
【发布时间】:2014-02-11 23:37:02
【问题描述】:

给定一个特定的标签值,有没有办法获取与其关联的所有指标的列表?

示例

  • 标签(键=值)
    • host=box1.onenet.tv
    • host=box2.onenet.tv
  • 指标
    • net.bytes_received
    • net.bytes_sent
    • net.error_count
  • 与标签值“box1.onenet.tv”关联的指标
    • net.bytes_received
    • net.bytes_sent
    • net.error_count"

如何使用标签值“box1.onenet.tv”获取“net.bytes_received,net.bytes_sent,net.error_count”?

【问题讨论】:

    标签: opentsdb


    【解决方案1】:

    不,我不认为您可以在没有给定指标的情况下找到数据,而只能通过提供标签名称。度量名称是最大的聚合级别。在一个指标下,您只能使用标签来查找特殊的数据区域。 也许您必须将度量名称向下转换为标记名,以便定义一个新的通用度量名称,该名称适合所有可能的聚合查询。然后,您可以在具有新通用指标名称的指标中搜索所有具有旧指标名称的标签。希望这是可以理解的。

    顺便说一下,更详细的信息供您参考: 在您的查询中,您可以为标签使用通配符(例如 tag1=*),但不能用于指标名称。

    这里概述了您的查询所包含的内容(请参阅:http://opentsdb.net/query-execution.html):

    All queries have:
      - A metric name for which to retrieve data;
      - A start time;
      - A stop time (optional, if not set, assumed to be "now");
      - A possibly empty set of tags to filter the data
          (e.g. host=foo, or wildcards such as host=*);
      - An aggregation function (e.g. sum or avg);
        Whether or not to get the "rate of change" the data (in mathematical terms: 
        the first derivative). Optionally: a downsampling interval (e.g. 10 minutes) 
        and downsampling function (e.g. avg)
    

    而且我认为阅读 OpenTSDB 文档非常有用,尤其是关于度量和标签的文档。见这里:http://opentsdb.net/metrics.html

    Right now, you cannot combine two metrics into one plot line.
    This means you want a metric to be the biggest possible aggregation point. 
    If you want to drill down to specifics within a metric, use tags. 
    

    【讨论】:

    • 我不太确定你的回答。我不是要获取数据点,而是要获取与标签关联的指标列表。不需要通过查询(还有其他方法吗?)。
    • 好的,我明白了。但我想,事情没那么简单。我找到了一篇文章,如何通过搜索字符串查找所有指标,但无法按标签过滤。看看这个:stackoverflow.com/questions/18396365/…
    【解决方案2】:

    仅供参考,OpenTSDB 2.1.0 可以实现,它引入了元数据处理: Google Groups: Pulling (meta)data from OpenTSDB

    记得启用元数据解析,然后您就可以提取您梦寐以求的所有数据 :-)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-09-22
      • 2011-10-25
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多