gpt4 book ai didi

linux - 如何使用 Prometheus 在 Linux 机器上设置网络流量警报?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:06:08 25 4
gpt4 key购买 nike

我正在使用 Prometheus 监控 Linux 机器上的网络流量。我看到了几个有用的指标,例如 node_network_receive_bytes_totalnode_network_transmit_bytes_totalnode_network_receive_errs_total。当我不知道机器的网络带宽时,如何设置网络流量警报?

最佳答案

您应该使用一些查询来获得良好的网络监控结果。我在 Grafana 上使用了一些查询,并与您分享:

  1. 热门查询:

Query-outbound sum (irate(node_network_transmit_bytes{hostname=~"$hostname", device!~"lo|bond[0-9]|cbr[0-9]|veth.*"}[1m])) by (hostname) > 0

Legend format: {{hostname}} - {{device}} - outbound

Query-inbound sum (irate(node_network_receive_bytes{hostname=~"$hostname", device!~"lo|bond[0-9]|cbr[0-9]|veth.*"}[1m])) by (hostname) > 0

Legend format: {{hostname}} - {{device}} - inbound

  1. 复杂查询:

eno(或任何你想要的东西)设备的网络 terafic:

Legend format: {{hostname}} - ({{device}})_in

irate(node_network_receive_bytes{hostname=~'$hostname',device=~"^en.*"}[5m])*8

Legend format: {{hostname}} - ({{device}})_out

irate(node_network_transmit_bytes{hostname=~'$hostname',device=~"^en.*"}[5m])*8

网络统计:

Legend format: {{hostname}} established

node_netstat_Tcp_CurrEstab{hostname=~'$hostname'}

udp 统计:

irate(node_netstat_Udp_InDatagrams{hostname=~"$hostname"}[5m])

irate(node_netstat_Udp_InErrors{hostname=~"$hostname"}[5m])

irate(node_netstat_Udp_OutDatagrams{hostname=~"$hostname"}[5m])

irate(node_netstat_Udp_NoPorts{hostname=~"$hostname"}[5m])

契约(Contract)

Legend format: Queue Used ({{hostname}})

node_nf_conntrack_entries{hostname=~"$hostname"}/node_nf_conntrack_entries_limit{hostname=~"$hostname"}

请注意主机名。它是 Grafan 上的模板变量。图例格式是 Grafana 上指标的标签解析。

关于linux - 如何使用 Prometheus 在 Linux 机器上设置网络流量警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46368241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com