我在Prometheus中加载了一些自定义指标
我写了这个API请求
http://prometheus01/api/v1/query_range?query=count(kpi_metrics)&start=1515747230&end=1515750830&step=60
返回
{"status":"success","data":{"resultType":"matrix","result":[{"metric":{},"values":[[1515747230,"39"],[1515747290,"39"],[1515747350,"39"],[1515747410,"39"],[1515747470,"39"],[1515747530,"39"],[1515747590,"39"],[1515747650,"39"],[1515747710,"39"],[1515747770,"39"],[1515747830,"39"],[1515747890,"39"],[1515747950,"39"],[1515748010,"39"],[1515748070,"39"],[1515748130,"39"],[1515748190,"39"],[1515748250,"39"],[1515748310,"39"],[1515748370,"39"],[1515748430,"39"],[1515748490,"39"],[1515748550,"39"],[1515748610,"39"],[1515748670,"39"],[1515748730,"39"],[1515748790,"39"],[1515748850,"39"],[1515748910,"39"],[1515748970,"39"],[1515749030,"39"],[1515749090,"39"],[1515749150,"39"],[1515749210,"39"],[1515749270,"39"],[1515749330,"39"],[1515749390,"39"],[1515749450,"39"],[1515749510,"39"],[1515749570,"39"],[1515749630,"39"],[1515749690,"39"],[1515749750,"39"],[1515749810,"39"],[1515749870,"39"],[1515749930,"39"],[1515749990,"39"],[1515750050,"39"],[1515750110,"39"],[1515750170,"39"],[1515750230,"39"],[1515750290,"39"],[1515750350,"39"],[1515750410,"39"],[1515750470,"39"],[1515750530,"39"],[1515750590,"39"],[1515750650,"39"],[1515750710,"39"],[1515750770,"39"],[1515750830,"39"]]}]}}
这个好。
如果值满足条件
,我想获取信息kpi_metrics<1
我写了API请求
http://prometheus01/api/v1/query_range?query=count(kpi_metrics<1)&start=1515747230&end=1515750830&step=60
但prometheus只返回了
{"status":"success","data":{"resultType":"matrix","result":[]}}
如何根据条件kpi_metrics&lt; 1来改变api请求以获得结果?
答案 0 :(得分:0)
查询和结果是正确的,kpi_metrics的所有时间序列都是39,不小于1.