Prometheus 查询以获取节点和 Pod 的出口流量。

huangapple go评论73阅读模式
英文:

Prometheus query to get node and pod egress

问题

有没有查询可以获取从节点发送到远程对等方的流量的字节传输速率?对于Pod也是一样,我需要从Pod向外流出的流量,通过节点,然后从节点向外流出的流量。我想通常的 "container_network_transmit_bytes_total" 和 "node_network_transmit_bytes_total" 给出了发送到所有目的地的总字节传输量。例如,如果两个Pod正在同一节点上运行并相互通信,我不想计算该流量。

英文:

Is there any query to get bytes transmitted rate, of the traffic which is out of the node to a remote peer? For pod also, I need the traffic which goes outwards from the pod, through the node, and outwards from the node. I suppose the usual "container_network_transmit_bytes_total" and "node_network_transmit_bytes_total" give the total bytes transmitted to all destinations. For example, if two pods are running on the same node and communicating with each other, I do not want to count that traffic.

答案1

得分: 1

尝试使用以下查询:

sum(irate(node_network_receive_bytes_total[1m])) by (instance)

irate(container_network_transmit_bytes_total{name="redis"}[1m])

其中 irate(v range-vector) 计算范围向量中时间序列的每秒瞬时增长率。这基于最后两个数据点。对于单调性的中断(例如由于目标重新启动而导致的计数器重置),会自动进行调整。

您可以在此官方文档中找到更多信息。

英文:

Try using the following queries:

sum(irate(node_network_receive_bytes_total[1m])) by (instance)

irate(container_network_transmit_bytes_total{name="redis"}[1m])

Where irate(v range-vector) calculates the per-second instant rate of increase of the time series in the range vector. This is based on the last two data points. Breaks in monotonicity (such as counter resets due to target restarts) are automatically adjusted for.

You can find more information in this Official doc.

huangapple
  • 本文由 发表于 2023年7月6日 13:36:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/76625785.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定