容器CPU使用率:
sum(irate(container_cpu_usage_seconds_total{image!=""}[1m])) without (cpu)
全部容器的CPU使用率总和:
sum(sum(rate(container_cpu_usage_seconds_total{name=~".+"}[1m])) by (name) * 100)
查询容器内存使用量(单位:字节):
container_memory_usage_bytes{image!=""}
所有容器总和:
sum(container_memory_rss{name=~".+"})
所有容器当前内存使用:
container_memory_usage_bytes{name=~".+"}
## container_memory_usage_bytes : Current memory usage in bytes.
所有容器当前内存使用总和:
sum(container_memory_usage_bytes{name=~".+"})
查询容器网络接收量速率(单位:字节/秒):
sum(rate(container_network_receive_bytes_total{image!=""}[1m])) without (interface)
查询容器网络传输量速率(单位:字节/秒):
sum(rate(container_network_transmit_bytes_total{image!=""}[1m])) without (interface)
查询容器文件系统读取速率(单位:字节/秒):
sum(rate(container_fs_reads_bytes_total{image!=""}[1m])) without (device)
查询容器文件系统写入速率(单位:字节/秒):
sum(rate(container_fs_writes_bytes_total{image!=""}[1m])) without (device)
容器入带宽大于50M
sum by (namespace,job,pod_name) (irate(container_network_receive_bytes_total{image!=""}[3m])) / 1024 /1024 > 50
容器出带宽大于50M
sum by (namespace,job,pod_name) (irate(container_network_transmit_bytes_total{image!=""}[1m])) / 1024 /1024 > 50
1.时间序列是指将同一统计指标的数值按其发生的时间先后顺序排列而成的数列
=:选择正好相等的字符串标签
!=:选择不相等的字符串标签
=~:选择匹配正则表达式的标签(或子标签)
!~:选择不匹配正则表达式的标签(或子标签)
s:seconds
m:minutes
h:hours
d:days
w:weeks
y:years
注: [1m]指过去的1分钟内
4.操作符
bool
and
or
unless
on
without : without(label)在结果中移除括号内的标签和值
by : by(label)在结果中只保留括号内的标签和值
原文:https://www.cnblogs.com/shunzi115/p/12439356.html