Prometheus and Grafana ​

This guide shows how to create a monitoring server and send the metrics of your servers to it. Prometheus collects and stores the metrics. Grafana shows them in dashboards.

Before you begin ​

  • You need the Owner, Admin, or Developer role.
  • The smallest plan for Prometheus and Grafana has 1 vCPU, 1 GiB of memory, and 10 GiB of disk.

1. Create the server ​

  1. Go to Servers. Click New server.

  2. Under Image, select Apps. Under App, select Prometheus and Grafana.

  3. Under Prometheus and Grafana settings, fill in the settings:

    SettingValue
    Site nameRequired. The first part of the web address, such as metrics.
    Prometheus passwordThe password of the admin user of Prometheus. Leave it blank to generate one.
    Push passwordThe password that your other servers use to send metrics. It opens nothing else. Leave it blank to generate one.
    Grafana passwordThe password of the admin user of Grafana. Leave it blank to generate one.
  4. Select a region and a plan. Click Create server.

The regional proxy serves the server at https://<site name>.<region domain> with HTTPS. The server needs no public address for this.

2. Read the passwords ​

Sign in with SSH and read the settings file:

bash
sudo cat /etc/one-click/app.env
SettingValue
SITE_DOMAINThe web address of the server.
GRAFANA_USER, GRAFANA_PASSWORDThe Grafana sign-in. The user is admin.
PROMETHEUS_USER, PROMETHEUS_PASSWORDThe Prometheus sign-in. The user is admin.
PUSH_USER, PUSH_PASSWORDThe login that other servers use to send metrics. The user is push.

3. Open Grafana and Prometheus ​

AddressOpensSign in with
https://<site domain>/Grafana. Prometheus is already a data source.GRAFANA_USER and GRAFANA_PASSWORD
https://<site domain>/prometheus/The Prometheus web UI and API.PROMETHEUS_USER and PROMETHEUS_PASSWORD

4. Send metrics from a server ​

Run this command as root on each Ubuntu or Debian server that you want to monitor. Use the push password from step 2.

bash
curl -fsSL https://<site domain>/connect.sh | sudo PUSH_PASSWORD='<push password>' bash

The script installs Grafana Alloy at a fixed version and checks its checksum. Alloy reads the CPU, memory, disk, and network metrics of the server every 15 seconds and sends them to Prometheus. Each server shows in Grafana by its hostname.

Change a password ​

PasswordDo this
GrafanaChange it in Grafana: Profile > Change password.
PrometheusRun echo "admin:$(openssl passwd -6)" | sudo tee /etc/nginx/one-click/prometheus.htpasswd, then sudo systemctl reload nginx.
PushRun echo "push:$(openssl passwd -6)" | sudo tee /etc/nginx/one-click/push.htpasswd, then sudo systemctl reload nginx.

Change the value in /etc/one-click/app.env too, so the file stays correct. After a change of the push password, run the script of step 4 again on each server.

What next ​

Apps: first boot, passwords, and network access for every app.