Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save justlooks/d5c13848015f29fa32214ce6ec0acaee to your computer and use it in GitHub Desktop.
Save justlooks/d5c13848015f29fa32214ce6ec0acaee to your computer and use it in GitHub Desktop.
t1
# tar xvf prometheus-1.6.3.linux-amd64.tar
# cd prometheus-1.6.3.linux-amd64
prometheus表达式使用
获取特定名字的job的http请求数目
http_requests_total{job=~"server$"}
获取返回状态不为4xx的请求
http_requests_total{status!~"^4..$"}
以5分钟为窗口,获取指标的增长速度
rate(http_requests_total[5m])
通过job纬度做聚合处理
sum(rate(http_requests_total[5m])) by (job)
或者
sum by (job) (rate(http_requests_total[5m]))
topk(10, sum(mysql_info_schema_table_size{instance="$host", component!="data_free"}) by (schema, table)) > 0
topk(5, sum(mysql_info_schema_table_size{instance="$host", component="data_free"}) by (schema, table)) > 0
https://www.howtoing.com/how-to-query-prometheus-on-ubuntu-14-04-part-1/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment