CPU查询指标
查询pod_name为order,5分钟cpu平均值
avg(rate(container_cpu_usage_seconds_total{image!="" ,pod_name=~"order.*"}[5m])) by (pod_name)
max(rate(container_cpu_usage_seconds_total{container=~"order.*"}[5m])) by (container) *100
内存查询指标
查询内存使用量
sum(container_memory_working_set_bytes{container="order-service"}) by (id) / 1024^3
指定container查询并计算百分比
100 * (container_memory_working_set_bytes{container="order"} / container_spec_memory_limit_bytes{container="order"})
按照服务名显示结果
avg by (id) (100 * (container_memory_working_set_bytes{container="invoice-backend"} / container_spec_memory_limit_bytes{container="invoice-backend"}))
在上语句基础上修改为显示container
100 * (sum by (container_name) (container_memory_working_set_bytes{container="order"}) / sum by (container_name) (container_spec_memory_limit_bytes{container="order"}))
指定查询区间为1天
100 * (avg_over_time(container_memory_working_set_bytes{container="order"}[1d]) / avg_over_time(container_spec_memory_limit_bytes{container="order"}[1d]))
查询pod_name为order,5分钟mem平均值
sum(container_memory_usage_bytes{image!="" ,pod_name=~"order.*"}) by (pod_name) / 1024/1024
avg(container_memory_usage_bytes{container=~"menu.*"}) / 1024/1024/1024
计算内存使用的百分比
100 * (1 - sum(container_memory_working_set_bytes{image!="",pod_name=~"$Pod"}) by (pod_name) / sum(container_spec_memory_limit_bytes{image!="",pod_name=~"$Pod"}) by (pod_name))
统计所有集群中所有pod内存
sum(container_memory_rss{image!=""}) by(pod_name, namespace) / sum(container_spec_memory_limit_bytes{image!=""}) by(pod_name, namespace) * 100 != +inf
最新评论
# 这只是一个创建远程登录并授权的语句、仅作为记录 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Fit2cloud!' WITH GRANT OPTION;
当MGR集群初始化结束后,需要开启MGR集群自启动(需要有一台节点是自动开启引导) loose-group_replication_start_on_boot = ON #设置节点是否在启动时自动启动 MGR 集群 loose-group_replication_bootstrap_group = ON #设置节点是否作为初始引导节点启动集群
密码:blog.sirliu.com
本内容密码:blog.sirliu.com 最新整理的文章在这里喔:https://blog.sirliu.com/2018/11/shell_lian_xi_ti.html