# How Monitoring collects data

What runs where for metrics, logs, alarms, uptime checks and status pages, what the platform sees, and what happens when a part fails.

## Machine metrics

The platform's control plane reads the metrics of every running compute instance and managed
database node from the hosting provider at most once a minute. The provider's rate limit is shared per hosting
project, so when a project holds more machines than fit in a minute's share, each is read less
often, and every read catches up the minutes since the last (up to an hour). Nothing runs on your machine for them, and
they show only what the hypervisor sees: no memory, filesystem or process figures. A machine in a
Hetzner project of your own is read with your project's token; while that token does not work,
nothing is collected for its machines. The database nodes report their volume fill level,
connections, replication lag and statement slowdown themselves.

## Other built-in metrics

VPN connections, Kubernetes clusters and CDN distributions are measured by the platform per minute:
the tunnel by its gateway, the cluster's API by the platform through its endpoint, a distribution by
its edge nodes. An app's deployment metrics are written when each deployment finishes.

## Logs and StatsD on an app's machine

The agent that runs an app's containers also:

- reads what each container prints and sends it to the control plane about every ten seconds, in
  batches of at most 500 lines, each line cut at 16 KiB. It keeps at most 5000 lines waiting; when
  the app prints faster, it drops the rest and reports how many;
- listens on UDP port 8125 for StatsD from the containers on the machine only, and sends what it
  aggregated once a minute.

It sends both with the app's own credentials. Lines and metrics of a load balancer, a CDN
distribution, a schedule, a function or an event rule are written by those services.

## Alarms

Every alarm is evaluated on the control plane every minute. Mails and webhooks are sent from there.
An alarm whose query fails is skipped in that minute; the others are still evaluated.

## Uptime checks

The control plane and each probe location request the URL. The probes are separate machines in
other locations; they fetch their work from the control plane and report their results to it. The
requests carry the user agent `EWS-Uptime/1`, followed by a link to this guide. A run with no
result at all, because no location could judge it, is neither up nor down, and nobody is notified.

## Status pages

Your status pages are served by the platform. Deutsche Cloud's own status, at `status.<domain>`, is
served by the probes from the last state the control plane published and their own view of the
Deutsche Cloud Console, so it keeps answering when the console does not.

## Related

- [Metrics](metrics.md)
- [How uptime checks work](how-uptime-checks-work.md)
- [Security](security.md)
