Intended to be run in a container, the exporter takes a list servers (Windows Kubernetes nodes) from each it extracts the following for each pod and exports them (to be scraped by Prometheus)
- Pod name
- CPU
- Memory
- Disk usage
- Tx
- Rx
The following env vars are required
-
USER="administrator"
(a user with crictl permissions) -
PASSWORD="XXXXXXX"
-
LOG_LEVEL="DEBUG"
(DEBUG, INFO, WARN, ERROR) -
SERVER_FILE="servers.txt"
(can be called anything, one server/windows kubernetes node per line)
docker build -t windows-cri-metrics -f Dockerfile .
docker run -d -p 8000:8000 --name windows-cri-metrics \
-v $(pwd)/servers.txt:/home/metrics/servers.txt \
-e LOG_LEVEL=DEBUG \
-e USER="administrator" \
-e PASSWORD="XXXXX" \
-e SERVERS_FILE="/home/metrics/servers.txt" \
windows-cri-metrics
In Prometheus the metrics are called
- pod_cpu_usage_mcores
- pod_memory_usage_mb
- pod_disk_usage_mb
- pod_tx_mb
- pod_rx_mb
If using Grafana query for the metrics are called
- pod_cpu_usage_mcores
- pod_memory_usage_mb
- pod_disk_usage_mb
- pod_tx_mb
- pod_rx_mb
Use a custom legend e.g. {{pod}} - CPU (for pod_cpu_usage_mcores) to label the query.
This will update dynamically as pods are created and destroy.
All the nodes must have the same credentials, PSRemoting
must be enabled and working for WSMan
, though the exporter communicates with Windows nodes, it run on Linux
windows_metrics.py
- Contacts to every Windows node, extracts pod stats, parses the metrics and exposes them for Prometheus.
config.py
- reads the environment variables.
metricslogger.py
- stdout logging.
requirements.txt
- PIP requirements.
servers.txt
- sample server list.
Dockerfile
- build file.