From 7ab8c7dde4737a919ee7c913dced51621054e27f Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Mon, 26 Aug 2019 20:58:47 +1000 Subject: [PATCH] Add documentation for net collector --- docs/collector.net.md | 46 +++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/docs/collector.net.md b/docs/collector.net.md index 83c6d27e..f3d95dd1 100644 --- a/docs/collector.net.md +++ b/docs/collector.net.md @@ -22,24 +22,40 @@ If given, an interface name needs to *not* match the blacklist regexp in order f Name | Description | Type | Labels -----|-------------|------|------- -`wmi_net_bytes_received_total` | _Not yet documented_ | counter | `nic` -`wmi_net_bytes_sent_total` | _Not yet documented_ | counter | `nic` -`wmi_net_bytes_total` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_outbound_discarded` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_outbound_errors` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_received_discarded` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_received_errors` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_received_total` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_received_unknown` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_total` | _Not yet documented_ | counter | `nic` -`wmi_net_packets_sent_total` | _Not yet documented_ | counter | `nic` -`wmi_net_current_bandwidth` | _Not yet documented_ | counter | `nic` +`wmi_net_bytes_received_total` | Total bytes received by interface | counter | `nic` +`wmi_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic` +`wmi_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic` +`wmi_net_packets_outbound_discarded` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic` +`wmi_net_packets_outbound_errors` | Total packets that could not be transmitted due to errors | counter | `nic` +`wmi_net_packets_received_discarded` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic` +`wmi_net_packets_received_errors` | Total packets that could not be received due to errors | counter | `nic` +`wmi_net_packets_received_total` | Total packets received by interface | counter | `nic` +`wmi_net_packets_received_unknown` | Total packets received by interface that were discarded because of an unknown or unsupported protocol | counter | `nic` +`wmi_net_packets_total` | Total packets received and transmitted by interface | counter | `nic` +`wmi_net_packets_sent_total` | Total packets transmitted by interface | counter | `nic` +`wmi_net_current_bandwidth` | Estimate of the interface's current bandwidth in bits per second (bps) | counter | `nic` ### Example metric -_This collector does not yet have explained examples, we would appreciate your help adding them!_ +Query the rate of transmitted network traffic +``` +rate(wmi_net_bytes_sent_total{instance="localhost"}[2m]) +``` ## Useful queries -_This collector does not yet have any useful queries added, we would appreciate your help adding them!_ +Get total utilisation of network interface as a percentage +``` +rate(wmi_net_bytes_total{instance="localhost", nic="Microsoft_Hyper_V_Network_Adapter__1"}[2m]) * 8 / wmi_net_current_bandwidth{instance="locahost", nic="Microsoft_Hyper_V_Network_Adapter__1"} * 100 +``` ## Alerting examples -_This collector does not yet have alerting examples, we would appreciate your help adding them!_ +**prometheus.rules** +``` +- alert: NetInterfaceUsage + expr: rate(wmi_net_bytes_total[2m]) * 8 / wmi_net_current_bandwidth * 100 > 90 + for: 10m + labels: + severity: high + annotations: + summary: "Network Interface Usage (instance {{ $labels.instance }})" + description: "Network traffic usage is greater than 95% for interface {{ $labels.nic }}\n VALUE = {{ $value }}\n LABELS: {{ $labels }}" +```