Update example Prometheus queries

* Update metric names to match current release.
* Improve descriptions.
* Improve examples to show more query language functionality.

Memory:
* Show use of `or` function.
* Automatically select "MemAvailable" kernel metric if possible.

CPU:
* Show use of `avg without ...`.
* Show CPU utilization per node.

Network:
* Show use of `!=` label matching.
* Don't show "localhost" metrics.
This commit is contained in:
Ben Kochie 2018-09-12 10:23:25 +02:00
parent a3c3776b5c
commit e91c7469ad
No known key found for this signature in database
GPG key ID: 7D88366AC0FCE38A

View file

@ -97,10 +97,10 @@ For a more fully featured dashboard, Grafana can be used and has
Sample Prometheus queries:
- **% Memory used:** `(1 - ((node_memory_MemFree + node_memory_Cached) / node_memory_MemTotal)) * 100`
- **% CPU load:** `1 - rate(node_cpu{mode="idle"}[5m])`
- **Data transmitted:** `irate(node_network_transmit_bytes[5m])`
- **Data received:** `irate(node_network_receive_bytes[5m])`
- **% Memory available:** `((node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) or ((node_memory_MemFree_bytes + node_memory_Buffers_bytes + node_memory_Cached_bytes) / node_memory_MemTotal_bytes)) * 100`
- **% CPU utilization:** `1 - avg without (mode,cpu) (rate(node_cpu_seconds_total{mode="idle"}[5m]))`
- **Data transmitted:** `rate(node_network_transmit_bytes_total{device!="lo"}[5m])`
- **Data received:** `rate(node_network_receive_bytes_total{device!="lo"}[5m])`
## Configuring Prometheus to monitor Kubernetes