zoukankan      html  css  js  c++  java
  • prometheus 表达式

    avg_over_time(my_inprogress_requests{job="mhc"}[5m] offset 3m)

    返回time=1550664637开始向前偏移3分钟之前的五分钟的平均值

    curl -X GET
      'http://mhc-linux:9090/api/v1/query?query=avg_over_time%28my_inprogress_requests{job=%22mhc%22}[5m]%20%20offset%203m%29&time=1550664637'
      -H 'Postman-Token: eeede4b6-e57b-42b1-92e1-d2dec4558f0e'
      -H 'cache-control: no-cache'

    {
        "status": "success",
        "data": {
            "resultType": "vector",
            "result": [
                {
                    "metric": {
                        "instance": "192.168.121.58:8000",
                        "job": "mhc"
                    },
                    "value": [
                        1550664637,
                        "425.1333333333333"
                    ]
                }
            ]
        }
    }

    curl -X GET
      'http://mhc-linux:9090/api/v1/query_range?query=avg_over_time%28my_inprogress_requests{job=%22mhc%22}[5m]%20%20offset%2010m%29&start=1550664637&end=1550664937&step=60'
      -H 'Postman-Token: b274b534-eede-4d4b-b85c-2f0ad8dbd44e'
      -H 'cache-control: no-cache'

    {
        "status": "success",
        "data": {
            "resultType": "matrix",
            "result": [
                {
                    "metric": {
                        "instance": "192.168.121.58:8000",
                        "job": "mhc"
                    },
                    "values": [
                        [
                            1550664637,
                            "474.0666666666666"
                        ],
                        [
                            1550664697,
                            "511.11666666666673"
                        ],
                        [
                            1550664757,
                            "468.6666666666667"
                        ],
                        [
                            1550664817,
                            "464.03333333333313"
                        ],
                        [
                            1550664877,
                            "494.83333333333326"
                        ],
                        [
                            1550664937,
                            "491.38333333333327"
                        ]
                    ]
                }
            ]
        }
    }

    sum(avg_over_time(my_inprogress_requests{user="mhc"}[1m]))

  • 相关阅读:
    C# 文件操作 全收录 追加、拷贝、删除、移动文件、创建目录、递归删除文件夹及文件....
    FlexPaper在线文档分享(转载)
    winform中屏蔽对标题栏的操作
    【转】海量数据查询优化
    [转帖]用Reflector和FileDisassembler配合反编译.net Windows程序
    关于中缀表达式和逆波兰表达式(终结篇)
    jQuery教程基础篇之强大的选择器(层次选择器)
    模版方法(Template Method)
    VS2008新建项目时出现“此安装不支持该项目类型”
    并行计算相关文章
  • 原文地址:https://www.cnblogs.com/mhc-fly/p/10409009.html
Copyright © 2011-2022 走看看