We created a VM called prom-sd-demo through the NodeRings API at 23:27:33 UTC. Nobody touched the Prometheus configuration. At 23:28:26 Prometheus knew about the new server, labelled with its city, plan, provider and the tags web and demo. Once the VM had finished installing, Prometheus started scraping it. When we deleted the VM at 23:32:24, it dropped out of Prometheus 62 seconds later.
The piece in the middle is prometheus-noderings-sd, a small open-source service that tells Prometheus which NodeRings VMs you have. This post shows what it does, how to run it, and what our test run looked like, with screenshots.
What it does, and what it doesn't
Prometheus collects metrics by visiting each server and reading a page of numbers, usually from node_exporter on port 9100. To do that, it needs a list of servers. Most people type that list into prometheus.yml by hand and then forget to update it.
prometheus-noderings-sd keeps that list for you:
- It asks the NodeRings API which VMs exist, every 60 seconds by default.
- Prometheus asks prometheus-noderings-sd for its target list, using Prometheus' built-in HTTP service discovery.
- Prometheus scrapes each VM directly.
It never collects metrics itself, and it only reads from the API. It never creates, changes or deletes anything. The metrics come from whatever exporter you run on the VMs.
NodeRings already records CPU, memory, disk and network for every VM from the hypervisor, and you can view them in your own Grafana or the one in the console. Use prometheus-noderings-sd when you run your own Prometheus and want metrics from inside the VM: per-filesystem disk usage, systemd units, or your application's own /metrics.
What you need
- A Prometheus server: 2.28 or newer for
http_sd_configs, or any version with file-based discovery. Grafana Alloy and VictoriaMetrics understand the same format. - A NodeRings API token. A service account token that can read virtual machines is enough. Create one in the console under Settings → Service accounts.
- An exporter on each VM you want metrics from. On Ubuntu and Debian that is
apt install prometheus-node-exporter. - A network path from Prometheus to each VM on the exporter's port. More on that in step 3.
Step 1: Run prometheus-noderings-sd
Download the archive for your platform from the releases page, or use the container image:
docker run -d --name noderings-sd --restart unless-stopped \
-p 127.0.0.1:10064:10064 \
-e NODERINGS_TOKEN=<TOKEN> \
ghcr.io/noderings/prometheus-noderings-sd:latest \
--target.port=9100The token is read from the environment, or from a file with --noderings.token-file, so it never shows up in the process list. Port 10064 is the service's default, taken from Prometheus' default port allocations.
Check that it sees your VMs:
curl -s localhost:10064/targetsThis is what it returned for one of our VMs, trimmed:
[
{
"targets": ["203.0.113.10:9100"],
"labels": {
"__meta_noderings_vm_hostname": "fairowl-sc-gc-1c-1g-20-01",
"__meta_noderings_vm_status": "started",
"__meta_noderings_vm_distro": "ubuntu_26_04",
"__meta_noderings_vm_cpus": "1",
"__meta_noderings_vm_memory_bytes": "1073741824",
"__meta_noderings_region_city": "Ashburn",
"__meta_noderings_region_country": "United States",
"__meta_noderings_plan_code": "SC-GC-1C-1G-20",
"__meta_noderings_provider_name": "Enzonix",
"__meta_noderings_billing_type": "usage",
"__meta_noderings_tags": ""
}
}
]Each VM gets its public IPv4 address plus the port as the target, and 23 labels in total. The full list is in the README.
Step 2: Point Prometheus at it
scrape_configs:
- job_name: noderings-node
http_sd_configs:
- url: http://127.0.0.1:10064/targets?port=9100
relabel_configs:
# Only scrape VMs that are running.
- source_labels: [__meta_noderings_vm_status]
regex: started
action: keep
# Show the hostname instead of IP:port.
- source_labels: [__meta_noderings_vm_hostname]
target_label: instance
- source_labels: [__meta_noderings_region_city]
target_label: city
- source_labels: [__meta_noderings_plan_code]
target_label: plan
- source_labels: [__meta_noderings_provider_name]
target_label: provider
# Every NodeRings tag becomes a tag_<name>="true" label.
- regex: __meta_noderings_tag_(.+)
action: labelmap
replacement: tag_$1Labels that start with __meta_ exist only during relabeling. Copy the ones you want onto your metrics, as above. The ?port= parameter sets the port for this job, so a second job can scrape your application on 8080 from the same service. To pick VMs by tag, keep only the ones whose __meta_noderings_tags matches .*,web,.*.
After a reload, open Status → Service discovery in Prometheus. The left column shows everything NodeRings reported, and the right column shows the labels your metrics will carry:

Step 3: Let Prometheus reach the exporter
Install the exporter on the VM:
sudo apt-get install -y prometheus-node-exporterIt listens on port 9100 on all interfaces. Don't leave that port open to the internet. Allow only your Prometheus server, either with a rule in the VM's firewall ruleset in the console or on the VM itself. In our test we used nftables on the VM, with 203.0.113.5 standing in for the Prometheus server's address:
sudo nft add table inet prom
sudo nft 'add chain inet prom input { type filter hook input priority 0 ; policy accept ; }'
sudo nft add rule inet prom input tcp dport 9100 ip saddr != 203.0.113.5 drop
sudo nft add rule inet prom input tcp dport 9100 meta nfproto ipv6 dropUse nft list ruleset > /etc/nftables.conf to keep the rules across reboots. If you create VMs with Ansible, Terraform or any other tool, add the exporter and the firewall rule to the same playbook or cloud-init. Every new VM is then ready to be scraped the moment it is discovered.
What happened when we added a VM
Our test used one existing VM, fairowl-sc-gc-1c-1g-20-01, which already ran node_exporter. The VMs' public addresses are blurred in the screenshots and replaced with documentation addresses (203.0.113.x) in the text. We set --discovery.refresh-interval=30s on the service and refresh_interval: 30s in Prometheus, so the timings below are faster than the 60-second defaults. Then we created a second VM with the tags web and demo:
| Time (UTC) | What happened |
|---|---|
| 23:27:33 | prom-sd-demo created through the API |
| 23:27:51 | It appears in /targets (18 s) |
| 23:28:26 | Prometheus sees it. Its status is still created, so the keep started rule holds it back. |
| 23:28:56 | The status changes to started and it becomes an active target. It shows DOWN because nothing listens on port 9100 yet. |
| 23:30:24 | We install node_exporter on it, and the next scrape is UP |
This is the Prometheus targets page at the DOWN step. Notice the tag_demo and tag_web labels that came from the NodeRings tags:

Once the exporter was running, both VMs reported about 1,900 series each. We put a CPU load on the new VM to have something to look at. A query for CPU use per VM, grouped by the labels we copied, returned:
fairowl-sc-gc-1c-1g-20-01 Ashburn SC-GC-1C-1G-20 0.72 %
prom-sd-demo Ashburn SC-GC-1C-1G-20 79.56 %A Grafana dashboard for the whole fleet
The repository includes a dashboard, examples/grafana-dashboard.json. It expects the relabeling from step 2. It shows how many VMs were discovered, scraped and down, a fleet table, and CPU, memory, disk, network, load and uptime per VM. You can filter it by city and plan.

Import it under Dashboards → New → Import and pick your Prometheus data source.
What happened when we deleted it
We deleted prom-sd-demo at 23:32:24. It left /targets at 23:32:52 and Prometheus' target list at 23:33:26, 62 seconds after the delete. Nothing was left behind to alert on, and the original VM carried on as before:

If the NodeRings API can't be reached, the service keeps serving the last list it fetched, so your targets don't disappear during an outage. Until its very first fetch succeeds, it answers 503, and Prometheus then keeps whatever targets it already had.
Game servers and DNS host names too
The same service can discover two more kinds of NodeRings resources. Turn them on with
--discovery.role=vm,gameserver,dns, then pick one per scrape job with ?role=:
| Role | Targets | What to do with them |
|---|---|---|
vm (default) | Each VM's public IP and a port | Scrape node_exporter or your app, as above |
gameserver | Each game server's IP and game port | Check with blackbox_exporter that every server accepts connections |
dns | Every A, AAAA and CNAME host name in your NodeRings DNS zones | Check that each site answers over HTTPS, and see when its certificate expires |
Game servers and host names don't run an exporter, so Prometheus asks blackbox_exporter to probe them instead. This job checks every web host name in zones that are delegated to NodeRings:
- job_name: noderings-dns-https
metrics_path: /probe
params:
module: [https_2xx]
http_sd_configs:
- url: http://127.0.0.1:10064/targets?role=dns
relabel_configs:
- source_labels: [__meta_noderings_dns_zone_delegated]
regex: "true"
action: keep
- source_labels: [__address__]
regex: (.+)
target_label: __param_target
replacement: https://$1
- source_labels: [__meta_noderings_dns_record_fqdn]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115probe_success then tells you which sites are down, and probe_ssl_earliest_cert_expiry when
each certificate runs out. That pairs well with the certificates from
cert-manager on NodeRings DNS. The game server job is the same with
?role=gameserver and a tcp_connect module. Both are in
examples/blackbox.yml.
In our test account, the dns role returned the apex of our test zone with both of its A
records and the zone state pending_ns, because that zone isn't delegated yet. The gameserver
role returned an empty list, because the account has no game servers.
Running it properly
-
Keep the target list private. It contains your VMs' addresses. Run the service next to Prometheus and bind it to
127.0.0.1, as above. If it has to listen on a network, protect it with--web.config.file, which enables TLS and basic auth through the standard Prometheus exporter toolkit, and setbasic_authinhttp_sd_configs. -
Watch the discovery itself. It exposes
noderings_sd_*metrics. This alert fires when discovery has been stale for ten minutes:- alert: NodeRingsSDStale expr: time() - noderings_sd_last_refresh_success_timestamp_seconds > 600 for: 5m -
Using an older Prometheus, or a tool that only reads files? Run it with
--file.output=/etc/prometheus/noderings.jsonand usefile_sd_configs. The file is replaced atomically, and only when something changes. -
Using Grafana Alloy? Use
discovery.httpwith the same URL. There is an example in the repository.
Get it
prometheus-noderings-sd is open source under Apache 2.0:
github.com/noderings/prometheus-noderings-sd.
Releases include binaries for Linux, macOS, Windows and FreeBSD, plus a multi-arch container image at ghcr.io/noderings/prometheus-noderings-sd.
It works well alongside the other NodeRings integrations: create VMs with Terraform or Pulumi, set them up with Ansible, and they appear in Prometheus a minute later.
