Prometheus Config Generator

Write one line per job with its targets and optional metrics path, and get a prometheus.yml with global settings, Alertmanager and rule files.

Use the tool

Why this tool exists

A first prometheus.yml is short, but the indentation and list syntax catch people out: targets must be a list inside static_configs, which sits inside a scrape config. When you are adding a dozen hosts, typing that YAML by hand invites a stray space that stops Prometheus from starting.

Enter each job as a name followed by comma-separated host:port targets, and add a metrics path where it differs from the default, as with a Spring Boot actuator endpoint. The tool writes the global block, an optional self-scrape job, the alerting section and rule_files. It covers static targets only, so service discovery blocks need to be added by hand.

How to use it

  1. Enter one job per line as name, comma-separated targets, then an optional metrics path.
  2. Set the scrape and evaluation intervals, the Alertmanager address and the rule file glob.
  3. Copy the YAML into prometheus.yml and validate it with promtool check config.

Frequently asked questions

Can I add Kubernetes or Consul discovery?

No. Only static_configs are generated. Add service discovery blocks by hand after you paste the output into your file.

What if I leave Alertmanager blank?

The alerting section is left out. The same goes for the rule_files line when its glob is empty, so you get a minimal valid file.

Is the self-scrape job necessary?

It is optional. Prometheus exposes its own metrics on localhost:9090, and scraping them is useful for monitoring the server itself. Untick the box to remove it.

Does it check that targets are reachable?

No. It only formats text. Open the Targets page in the Prometheus UI after loading the file to see whether each target is up.