监控相关
ZABBIX安装与使用
自动发现与自动注册
配置文件
分布式监控
zabbix_sender安装和使用
zabbix_get安装与使用
自定义监控
自动发现监控json
PERCONA插件
PERCONA多实例
日志监控
相关项目监控
监控MySQL
监控Haproxy
Fluentd日志监控
Grafana(可视化监控指标)
grafana地图插件
添加prometheus模板
开启HTTPS
添加zabbix插件
Grafana模板
正则表达式
Prometheus监控
安装与使用
Prometheus存储
服务发现
Prometheus标签
PromQL查询
PushGateway推送组件
AlertManager告警组件
告警规则rule
K8S监控(kube-state-metric/cadvisor)
探针监控(blackbox_exporter)
Node_export
Mysql_export
Redis-exporter
cloudeye-exporter【华为云监控】
RabbitMQ-exporter
K8S监控
本文档使用MrDoc发布
返回首页
-
+
PromQL查询
2021年6月18日 15:32
admin
#常用匹配 =:匹配与标签相等的内容 !=:不匹配与标签相等的内容 =~: 根据正则表达式匹配与标签符合的内容 !~:根据正则表达式不匹配与标签符合的内容 --- #常用类型 Counter可以增长,并且在程序重启的时候会被重设为0,常被用于任务个数,总处理时间,错误个数等只增不减的指标。 Gauge与Counter类似,唯一不同的是Gauge数值可以减少,常被用于温度、利用率等指标。 #算术运算符 >####支持的算术运算符有 +,-,*,/,%,^, 例如 http_requests_total * 2 表示将 http_requests_total 所有数据 double 一倍。 http_requests_total * 2 --- #比较运算符 >####支持的比较运算符有 ==,!=,>,<,>=,<=, 例如 http_requests_total > 100 表示 http_requests_total 结果中大于 100 的数据。 http_requests_total > 100 --- #逻辑运算符 >####支持的逻辑运算符有 and,or,unless, 例如 http_requests_total == 5 or http_requests_total == 2 表示 http_requests_total 结果中等于 5 或者 2 的数据。 http_requests_total == 5 or http_requests_total == 2 --- #PromQL聚合操作 >####sum (求和) >####min (最小值) >####max (最大值) >####avg (平均值) >####stddev (标准差) >####stdvar (标准差异) >####count (计数) >####count_values (对value进行计数) >####bottomk (后n条时序) >####topk (前n条时序) >####quantile (分布统计)  --- ##分组聚合 sum(pushgateway_http_requests_total) by (code,handler,job)  --- ##分组聚合(剔除) sum(pushgateway_http_requests_total{code="200"}) without (method)  --- ##排序 topk(5, pushgateway_http_requests_total{code="200",method="get"})  --- #PromQL内置函数 ##increase >####increase函数获取区间向量中的第一个后最后一个样本并返回其增长量。因此,可以通过以下表达式Counter类型指标的增长率: increase(http_request_total[2m])/120  --- ##rate >####rate函数可以直接计算区间向量v在时间窗口内平均增长速率。因此,通过以下表达式可以得到与increase函数相同的结果 rate(http_request_total[2m])  --- ##irate >####irate同样用于计算区间向量的计算率,但是其反应出的是瞬时增长率 irate(http_request_total[2m]) 
分享到: