• opentsdb操作草稿


    插入数据api/put

    192.168.1.68:4242/api/put?details

    http://localhost:4242/api/put?details
    method:POST
    [ {
    "metric": "gas_patrol", "timestamp": 1571028638, "value": 58, "tags": { "host": "web01", "dc": "lga" } }, { "metric": "gas_patrol", "timestamp": 1571028638, "value": 18, "tags": { "host": "web02", "dc": "lga2" } } ]

    return

    {
    "success": 2,
    "failed": 0,
    "errors": []
    }

    查询api/query

    http://localhost:4242/api/query
    method:POST
    {
        "start": 1571028630,
        "end": 1571028639,
        "showTSUIDs":"true",  
        "queries": [
            {
                "aggregator": "avg",
                "metric": "gas_patrol",
                "tags": {
                     "host": "web*",
                     "dc": "lga"
                 }
            }
        ]
    }
    return

    [
        {
            "metric": "gas_patrol",
            "tags": {
                "host": "web01",
                "dc": "lga"
            },
            "aggregateTags": [],
            "tsuids": [
                "000001000001000001000002000002"
            ],
            "dps": {
                "1571028635": 18,
                "1571028636": 28,
                "1571028637": 38,
                "1571028638": 58
            }
        },
        {
            "metric": "gas_patrol",
            "tags": {
                "host": "web02",
                "dc": "lga"
            },
            "aggregateTags": [],
            "tsuids": [
                "000001000001000003000002000002"
            ],
            "dps": {
                "1571028637": 38,
                "1571028638": 18
            }
        },
        {
            "metric": "gas_patrol",
            "tags": {
                "host": "web02",
                "dc": "lga2"
            },
            "aggregateTags": [],
            "tsuids": [
                "000001000001000003000002000004"
            ],
            "dps": {
                "1571028638": 18
            }
        }
    ]

    平均值:"downsample":"0all-avg"

    {
        "start": 1271028034,
        "end": 1571028939,
        "showTSUIDs":"true",  
        "queries": [
            {
                "aggregator": "avg",
                "metric": "gas_patrol",
                "downsample":"0all-avg",
                "tags": {
                     "host": "web*",
                     "dc": "lga"
                 }
            }
        ]
    }

    求和:"downsample":"0all-sum"

    下采样(按1分钟/1小时/1天聚合)

    "downsample":"1m-avg"
    
    "downsample":"1h-avg"
    
    "downsample":"1d-avg"
    
    "downsample":"0y-avg"

    可以查询相应的 5分钟  10小时  22天 等等

    下采样补值:

    1m-avg-null
    1m-avg-zero
    。。。
    
    
    可用的政策包括:
    
    None(none) - 默认行为,在序列化期间不输出缺失值,在聚合序列时执行线性插值(或以其他方式指定插值)的。
    NaN(nan) - 当序列中缺少所有值时,在序列化输出中输出NaN 。缺少值时跳过聚合中的NaN,而不是将整个分组计算转换为NaN(参见下表)。
    Null(null) - 与NaN的行为相同,只是在序列化期间它会发出一个null,而不是一个NaN。
    零(zero) - 缺少时间戳时替换为零。零值将合并到汇总结果中。
  • 相关阅读:
    linux中和salt中的fqdn测试小节
    centos7离线安装rpm包自动解决依赖
    (转)mysql创建表时反引号的作用
    mysql更新一个表里的字段等于另一个表某字段的值
    Navicat permium工具连接Oracle的配置
    IA64与x64的区别
    vsphere和vmware快照的不足之处
    mysql查看某库表大小
    sql之left join、right join、inner join的区别(转)
    读锁和写锁
  • 原文地址:https://www.cnblogs.com/zhzhlong/p/11671955.html
Copyright © 2020-2023  润新知