# Uncloud Prometheus


[Prometheus metrics](https://github.com/psviderski/uncloud/pull/304) are being worked on by
[me](https://ratms.nl/projects/uncloud/), and will hopefully soon be merged in [Uncloud](https://uncloud.run).

The _uncloudd_ metrics endpoint is exposed into the cluster network, so this makes it possible for a
Prometheus service running inside the cluster to scrape it. For this it just needs to be able to access the API
to get all machines in the cluster. This can be done by mounting the uncloud socket inside the container, and
using `uc` with [structured output](https://github.com/psviderski/uncloud/issues/335).

This will need another container inside the Prometheus service that will get the machine data from the
cluster every few minutes and write a `prometheus.yml` with file _service discovery_.

Later this can be extended to probe for other services as well, but that might need labels, so Prometheus can
see what services need to be scraped, and labels are not supported for any else than
[volumes](https://uncloud.run/docs/cli-reference/uc_volume_create).

When running multiple cluster, we are likely to have a control-cluster. So in that control cluster we run a
prometheus _that_ also scrapes the local cluster _and_ scrapes all remote prometheus servers as well. How
those are discovered is still an open question, but we might settle on a fixed DNS name for that prometheus
server in each cluster.

