Overview
Introduction
A prometheus.yml file is small but unforgiving: a scrape config nested one level wrong, or a targets list written as a string instead of a list, and Prometheus refuses to start or silently scrapes nothing.
This tool builds that file from a form, letting you add scrape jobs, wire up Alertmanager, and set a remote_write endpoint without hand-indenting YAML.
What Is Prometheus Config Generator?
A visual builder for prometheus.yml, Prometheus's main configuration file, covering the global block, any number of static-target scrape_configs, an optional alerting.alertmanagers block, and an optional remote_write entry.
It mirrors the structure Prometheus itself expects: global settings apply to every job unless a job overrides them, and scrape_configs is the list of jobs Prometheus will poll.
How Prometheus Config Generator Works
The global block is emitted first with your scrape_interval and evaluation_interval (how often Prometheus polls targets and how often it evaluates alerting/recording rules).
Each scrape config becomes one entry under scrape_configs, with its job_name and a static_configs.targets list built from the host:port you provide. If alerting is enabled, an alerting.alertmanagers.static_configs block is added pointing at your Alertmanager instance; if remote_write is enabled, a remote_write list with your URL is appended.
When To Use Prometheus Config Generator
Use it when standing up a new Prometheus instance and you need a starting prometheus.yml with a handful of scrape targets, for example node_exporter, cAdvisor, or an app's own /metrics endpoint.
It's also useful for quickly wiring in an Alertmanager or remote_write endpoint to an existing setup without re-deriving the exact YAML shape from memory.
Often used alongside Alertmanager Config Generator, Grafana Dashboard Generator and OpenTelemetry Collector Config Generator.
Features
Advantages
- Produces correctly nested YAML for scrape_configs, the section most hand-written configs get wrong (targets as a string instead of a list is a very common mistake).
- Validates job names, hostnames, and port ranges before generating output, catching typos before they reach a running Prometheus instance.
- Covers alerting and remote_write, letting you sketch a complete config in one pass instead of assembling it from multiple docs pages.
Limitations
- Only supports static_configs targets, not service discovery mechanisms like Kubernetes SD, EC2 SD, or Consul SD; add those manually if you need dynamic discovery.
- Doesn't verify targets are reachable, only that job names, hostnames, and ports are well-formed.
- Doesn't generate alerting or recording rule files, only the alerting.alertmanagers pointer; write your rules separately and reference them with rule_files.
Examples
Best Practices & Notes
Best Practices
- Give each scrape job a descriptive job_name (e.g. node, api-server) since it becomes a label on every metric that job produces, and is how you filter in PromQL later.
- Keep scrape_interval at 15s-60s for most workloads; shorter intervals increase storage and CPU cost quickly on high-cardinality targets.
- Point remote_write at a durable long-term-storage backend if you need retention beyond Prometheus's local TSDB window.
Developer Notes
The generator is a pure string-building function emitting a fixed 2-space YAML indentation, with no YAML library dependency. job_name is validated against /^[a-zA-Z0-9_-]+$/, hostnames against /^[a-zA-Z0-9_.-]+$/, and ports against a numeric range of 1-65535; targets are always emitted as a single-element YAML flow-sequence (targets: ["host:port"]) to match Prometheus's expected static_configs shape.
Prometheus Config Generator Use Cases
- Bootstrapping a new Prometheus instance's config with a handful of scrape targets
- Adding an Alertmanager pointer to an existing prometheus.yml
- Wiring a remote_write endpoint to forward samples to a long-term storage backend
Common Mistakes
- Writing a scrape target as a bare string instead of a YAML list under static_configs.targets, which Prometheus rejects.
- Setting evaluation_interval far apart from scrape_interval, causing alerting rules to evaluate against stale data.
- Enabling remote_write with an internal-only URL that isn't reachable from wherever Prometheus actually runs.
Tips
- Use the Alertmanager Config Generator next to build the alertmanager.yml that this config's alerting block points at.
- Use the OpenTelemetry Collector Config Generator if you'd rather have an OTel Collector scrape and forward metrics to Prometheus instead of scraping targets directly.