cadvisor for arm64
date:
tags: containers cadvisor homelab prometheus grafana raspberry pi metrics
categories: Homelab Containers Observability Rasperry Pi
cadvisor exporter is used by Prometheus to monitor container metrics. If you are not familiar with prometheus, check out a previous post. The cadvisor program will collect metrics and make them available on a http server. Prometheus needs to be configured to collect metrics from the cadvisor exporter and then grafana can be used to visualize those metrics.
Build docker image
The existing official image for cadvisor does not have a image published for the arm cpu architecture. This is what is found in a Raspberry Pi CPU and in Apple’s M series CPUs.
The same source code can be used to build a compatible image and run it alongside other containers on an arm system. The following code was found on a github issue for the cadvisor github repository.
First prepare the container image with a Dockerfile:
|
|
The container can be deployed with docker-compose
. Some metrics are disabled, notably the memory metrics. Make sure that the cadvisor
container is on the same docker network as prometheus server.
docker-compose.yml
|
|
Start the new container after updating docker-compose.yml
. The tool will detect the new container and bring it up without disrupting other running containers:
|
|
Configure prometheus server
Once cadvisor is running, the prometheus server needs to be configured to monitor the new exporter. When cadvisor and prometheus are on the same container network, you can configure the target for cadvisor with just the name of the container. Update the prometheus server config:
/etc/prometheus/prometheus.yml
|
|
Restart the prometheus container to start scraping the new target.
docker restart prometheus
Visualize new metrics with premade grafana dashboard
The aforementioned post included deploying grafana. Check it out for help getting grafana running. There are free dashboards available online:
https://grafana.com/grafana/dashboards/
There is a dashboard for cadvisor.
At this time it has the ID 11600
.
-
Navigate to the left-hand menu and Select “+” > “Import” > “Import via grafana.com”
-
Enter the ID of the dashboard you would like to import and then select “Load”
-
You should now see a dashboard like below.