Once the /metrics
endpoint is available in MAAS services, Prometheus can be configured to scrape metric values from these. You can configure this by adding a stanza like the following to the prometheus configuration:
- job_name: maas
static_configs:
- targets:
- <maas-host1-IP>:5239 # for regiond
- <maas-host1-IP>:5249 # for rackd
- <maas-host2-IP>:5239 # regiond-only
- <maas-host3-IP>:5249 # rackd-only
If the MAAS installation includes multiple nodes, the targets
entries must be adjusted accordingly, to match services deployed on each node.
If you have enabled MAAS stats, you must add an additional Prometheus job to the config:
- job_name: maas
metrics_path: /MAAS/metrics
static_configs:
- targets:
- <maas-host-IP>:5240
In case of a multi-host deploy, adding a single IP for any of the MAAS hosts running regiond
will suffice.
Deploying Prometheus and Grafana
Grafana and Prometheus can be easily deployed using Juju.
The MAAS performance repo repository provides a sample deploy-stack
script that will deploy and configure the stack on LXD containers.
First, you must install juju via:
sudo snap install --classic juju
Then you can run the script from the repo:
grafana/deploy-stack <MAAS-IP>
To follow the progress of the deployment, run the following:
watch -c juju status --color
Once you deploy everything, the Grafana UI is accessible on port 3000
with the credentials admin
/grafana
. The Prometheus UI will be available on port 9090
.
The repository also provides some sample dashboard covering the most common use cases for graphs. These are available under grafana/dashboards
. You can import them from the Grafana UI or API.