BlogPost
From Prometheus to a public status page in ten minutes
A hands-on walkthrough with Observer's open-source demo stack. Run the agent next to Prometheus, describe two metrics and a page in one YAML file, apply it with the CLI, and watch the page follow a PromQL query.
7 min readTaha Al-Jody
If you already run Prometheus, the numbers that should drive your status page exist. Someone just has to turn them into a status and publish it. This walkthrough does that end to end: an agent that runs PromQL next to Prometheus, two metrics with thresholds, and a public page that changes when the query does.
It uses Observer's open-source demo stack, so you can follow along on a laptop without touching production. At the end there is a short section on pointing the same agent at your own Prometheus.
What you need
- Docker with Compose.
- An Observer account. The two metrics and the page fit the Free plan, which includes one status page, one agent and up to ten metrics. Applying the file with the CLI needs an API key, which comes with Starter and above, including the 14-day Starter trial. On Free, you can paste the same file into the console instead (step 5).
- About ten minutes.
How the pieces fit
Three things run in this setup:
- Prometheus, which in the demo scrapes itself.
- The Observer agent, a container inside the same network. It runs your PromQL queries against Prometheus, compares each result with your thresholds and sends the reading and the resulting status to Observer over an outbound HTTPS connection. Prometheus is never exposed to the internet, and its URL and any credentials stay on the agent's host. The agent page and the agent and cloud boundary docs cover exactly what is sent.
- Observer Cloud, which stores the results and serves the public page.
Configuration lives in a YAML file that you apply with the Observer CLI, so the whole setup can sit in a repository and go through review like any other change.
Step 1: install the CLI
curl -fsSL https://raw.githubusercontent.com/useobserver/cli/main/install.sh | sh
observer --version
The script installs into a directory on your PATH that you can write to (or ~/.local/bin), so it does not need sudo. To choose the directory yourself, set OBSERVER_INSTALL_DIR:
curl -fsSL https://raw.githubusercontent.com/useobserver/cli/main/install.sh | OBSERVER_INSTALL_DIR="$HOME/.local/bin" sh
The CLI docs list the release binaries if you would rather download one directly.
Step 2: create an agent and an API key
In the Observer console:
- Open Agents and choose Add agent. Under Customize, name it
demo-agent; the configuration below binds metrics to the agent by that name. Copying the install command creates the agent and its key. The key starts withobs_live_and is shown only in that command, so keep it for the next step. - Open Developers, then API keys, and create a key with the
write:configscope. It starts withobs_pub_. The CLI uses it to apply configuration. API keys need Starter or above, or the Starter trial; on Free, skip this and use the console in step 5.
Step 3: start Prometheus and the agent
Clone the demo and give it the agent key:
git clone https://github.com/useobserver/demo
cd demo
cp .env.example .env
Open .env and paste the key after AGENT_KEY=. That is the only required value.
The full demo runs seventeen metrics across thirteen source types and wants about 3 GB of free memory, mostly for Elasticsearch. For this walkthrough you only need Prometheus and the agent:
docker compose up -d observer-agent
Compose also starts the services the agent depends on in the demo file (Prometheus and the four small databases), which is fine. The agent's environment in docker-compose.yml already points it at Prometheus:
PROMETHEUS_SERVER_URL: http://prometheus:9090
PROMETHEUS_BASIC_AUTH_ENABLED: "false"
Check that it connected:
docker compose logs -f observer-agent
The agent also shows as connected on the console's Agents page.
Step 4: describe the metrics and the page
Create a file called prometheus-status.yaml in the demo directory:
apiVersion: observer/v1
metrics:
- key: prom-up
title: Prometheus
description: up{} for Prometheus scraping itself. 1 is up, 0 is down.
source_type: prometheus
source_config:
query: 'up{job="prometheus"}'
thresholds:
healthy_operation: over
healthy_value: 0
unhealthy_operation: under
unhealthy_value: 1
interval: 1
interval_agent_push: 10
agent: demo-agent
- key: prom-scrape-duration
title: Scrape duration
description: Seconds Prometheus took to scrape itself.
source_type: prometheus
source_config:
query: 'scrape_duration_seconds{job="prometheus"}'
thresholds:
healthy_operation: under
healthy_value: 0.5
unhealthy_operation: over
unhealthy_value: 2
interval: 1
interval_agent_push: 10
agent: demo-agent
pages:
- key: demo-status
subdomain: replace-with-your-subdomain
title: Demo status
metrics:
- metric: prom-up
group: Monitoring
- metric: prom-scrape-duration
group: Monitoring
Replace replace-with-your-subdomain with a subdomain of your own: 3 to 32 lowercase letters, digits or dashes. Subdomains are unique across Observer, so pick something specific.
A few things worth knowing about this file:
- Each query must return exactly one series. The agent reads an instant query and refuses to pick one series out of several; a query that returns more than one reports no data with the reason
prom_multiple_series. Aggregate (sum,max,histogram_quantile) or filter by label until one series is left. - Thresholds are strict.
overmeans greater than andundermeans less than; a value exactly on a threshold does not match it. A healthy match makes the metric healthy, otherwise an unhealthy match makes it unhealthy, and anything in between is degraded. For scrape duration, under 0.5 seconds is healthy, over 2 seconds is unhealthy, and the range between is degraded. intervalis how often the agent polls, in minutes;interval_agent_pushis the keepalive. The agent sends a reading immediately whenever the status changes, and at least everyinterval_agent_pushminutes otherwise, so Observer can tell a quiet metric from a silent agent.keyis the stable identity. You can renametitlefreely; the CLI matches objects by key.
Step 5: plan, then apply
Export the API key and preview the change:
export OBSERVER_API_KEY=obs_pub_...
observer apply -f prometheus-status.yaml --dry-run
The dry run prints what would be created and changes nothing. If it looks right, apply it:
observer apply -f prometheus-status.yaml
Within a minute or two, both metrics show their first readings in the console, and your page is live at https://<your-subdomain>.use.observer, showing both metrics as healthy.
On the Free plan, or without the CLI, open Developers, then Config as code, and paste the file under Apply in the browser. Check the plan shows the same preview as the dry run, and Apply makes the change. It follows the same rules as observer apply.
Step 6: make it fail on purpose
A status page you have never seen change is a status page you cannot trust. Tighten the scrape duration threshold so the current value breaks it. In prometheus-status.yaml, change the second metric's thresholds to:
thresholds:
healthy_operation: under
healthy_value: 0.0001
unhealthy_operation: over
unhealthy_value: 0.0002
Preview and apply again, in the terminal or in the console:
observer apply -f prometheus-status.yaml --dry-run
observer apply -f prometheus-status.yaml
The dry run shows a single change to prom-scrape-duration. The agent refreshes its metric definitions every few minutes, and once it has the new thresholds its next reading is unhealthy. Observer holds a new status for a short confirmation window before it changes the page, so a single bad sample does not flap it. After that, the page shows the metric as unhealthy, with nobody typing anything. Put the original thresholds back and apply once more to watch it recover the same way.
Two other things to try:
- Stop Prometheus with
docker compose stop prometheus. The agent cannot reach it, so both metrics report no data, and the page says so instead of freezing on the last green value. - Stop the agent with
docker compose stop observer-agent. When the expected pushes stop arriving (after 15 minutes with these settings), the page shows that monitoring is delayed rather than trusting the last result.
Start them again with docker compose start prometheus observer-agent.
Pointing it at your own Prometheus
The same agent image runs anywhere Docker does. Put the settings in a .env file on a host that can reach Prometheus:
AGENT_KEY=obs_live_...
CLOUD_SERVER_URL=https://use.observer
PROMETHEUS_SERVER_URL=http://prometheus.internal:9090
If Prometheus needs authentication, add PROMETHEUS_USERNAME and PROMETHEUS_PASSWORD for basic auth, or PROMETHEUS_BEARER_TOKEN for a token (one or the other, not both). For Grafana Mimir or Cortex, PROMETHEUS_TENANT_ID sets the tenant header. Then run:
docker run -v observer-agent-buffer:/data --env-file .env ghcr.io/useobserver/agent:1
The volume holds the agent's local buffer, so readings queued while Observer cannot be reached survive the container being recreated. The Prometheus source guide covers multi-tenant setups and custom headers, and the Docker install guide covers running the agent as a service.
From there, write the queries that match what you promise customers. If your SLA is about API latency, use the latency histogram, not up. The metrics page lists every source the agent can read, and SLO monitoring turns the same metrics into error budgets.
Cleaning up
Stop the demo and remove its volumes:
docker compose down -v
Then delete the page and the two metrics from the console. You can also run observer apply --prune with a file that no longer lists them, but --prune deletes every config-managed object missing from the file, so only use it in an organisation where nothing else is managed by configuration.
Keep reading
Connect one metric. See it on a status page in ten minutes.
Free plan, no card. Move up or down any time.