Prometheus Config Generator
Generate Prometheus configuration files (prometheus.yml). Configure scrape intervals, targets, node exporters, alertmanagers, and service discovery.
Prometheus Configuration
Global Configuration
Alertmanager
Rule Files
Scrape Jobs
Alerting Rules
1global:2 scrape_interval: 15s3 evaluation_interval: 15s4 scrape_timeout: 10s56alerting:7 alertmanagers:8 - static_configs:9 - targets: ['localhost:9093']1011rule_files:12 - '/etc/prometheus/alert_rules.yml'13 - '/etc/prometheus/recording_rules.yml'1415scrape_configs:16 - job_name: 'prometheus'17 scrape_interval: 15s18 scrape_timeout: 10s19 metrics_path: '/metrics'20 scheme: http21 static_configs:22 - targets: ['localhost:9090']
What is this tool?
The Prometheus Config Generator helps you build production-ready prometheus.yml configuration files with scrape targets, alerting rules, recording rules, remote write/read, and service discovery for Kubernetes, Docker, Consul, and cloud environments.
Prometheus uses a pull-based scraping model that actively connects to HTTP endpoints to collect time-series metrics. It supports multiple service discovery mechanisms (Kubernetes, Consul, EC2, Docker, DNS, file-based SD) and provides powerful relabeling for dynamic label manipulation. This generator produces syntactically correct prometheus.yml files with all components fully configured.
How to Use This Tool
1. Configure Global Settings: Set scrape_interval (how often to scrape targets), evaluation_interval (how often to evaluate rules), scrape_timeout, and external_labels for all scrape jobs.
2. Define Scrape Jobs: Create scrape_configs entries for each target type — static endpoints, Kubernetes pods/nodes/services, Consul services, EC2 instances, Docker containers, DNS records, or file-based service discovery.
3. Add Relabeling: Use relabel_configs to dynamically modify labels before scraping (filter targets, extract instance names, add metadata). Use metric_relabel_configs to modify labels on scraped metrics.
4. Configure Rules: Define alerting_rules for conditions that trigger alerts (sent to Alertmanager) and recording_rules for precomputing expensive PromQL expressions.
5. Enable Remote Storage: Configure remote_write to send samples to long-term storage (Thanos, Cortex, Mimir) and remote_read to query historical data from external backends.
Best Practices
- Set scrape_interval to 15s for most production workloads; use 5-10s only for critical high-resolution metrics.
- Always set evaluation_interval to a value greater than or equal to scrape_interval for reliable alerting.
- Use recording rules for frequently evaluated expensive PromQL expressions to reduce query-time load.
- Configure scrape_timeout to be less than scrape_interval to prevent overlapping scrapes.
- Use relabel_configs with keep/drop actions to filter targets and reduce cardinality.
- Set external_labels on all Prometheus instances in HA setups for proper deduplication in Thanos/Cortex.
- Use metric_relabel_configs to drop high-cardinality labels and reduce storage costs.
- Always set rule_files paths to valid locations accessible by the Prometheus process.
Common Mistakes
- Setting scrape_interval below 10s without justification, causing high storage and network overhead.
- Forgetting to configure rule_files, which prevents alerting and recording rules from being evaluated.
- Using relabel_configs and metric_relabel_configs interchangeably — relabel_configs apply before scrape, metric_relabel_configs after.
- Not setting scrape_timeout, causing Prometheus to use the default 10s which may be too short for slow endpoints.
- Configuring remote_write without proper queue_config, leading to data loss under high load.
- Missing external_labels in HA setups, causing deduplication failures in Thanos or Cortex.
Security Notes
- Enable TLS on the Prometheus web endpoint (web.config.file) for encrypted access to the UI and API.
- Use basic_auth or bearer_token on scrape endpoints that expose sensitive metrics.
- Restrict network access to port 9090 using firewalls or security groups.
- Run Prometheus as a non-root user with minimal filesystem permissions.
- Use relabel_configs with drop action to exclude sensitive targets from scraping.
- Avoid exposing Prometheus directly to the internet — use a reverse proxy with authentication.
Production Tips
- Deploy Prometheus with persistent storage (PVC in Kubernetes) to survive restarts without data loss.
- Use the Thanos sidecar pattern for long-term storage and global query view across multiple Prometheus instances.
- Monitor Prometheus itself using the prometheus_target_interval_length_seconds and up metrics.
- Configure Alertmanager in a cluster with --cluster.peers for high availability and deduplication.
- Use kube-prometheus-stack Helm chart for a production-ready Kubernetes monitoring setup with pre-built dashboards.
- Set retention flags (--storage.tsdb.retention.time, --storage.tsdb.retention.size) to manage disk usage.
- Use file_sd_configs for dynamic target management in non-Kubernetes environments.
Frequently Asked Questions
What is Prometheus and how does it work?
What is the scrape model in Prometheus?
How does service discovery work in Prometheus?
What are relabel_configs in Prometheus?
What are recording rules in Prometheus?
What are alerting rules in Prometheus?
What is remote write and remote read in Prometheus?
How do I achieve high availability with Prometheus?
What is the recommended scrape interval for Prometheus?
How do I secure Prometheus in production?
How do I troubleshoot Prometheus scrape failures?
Can I use Prometheus to monitor Kubernetes?
How We Keep Your Configs Safe & Valid
Built-in Error Checking
Every file is checked against official rules. We catch missing fields and bad syntax. YAML indentation errors are flagged right away. Kubernetes, Terraform, and Docker specs are all covered. API versions and labels are verified too. You get valid output every time you generate.
100% Private & Local
All tools run in your browser only. Your API keys never leave your machine. We do not use any tracking scripts. No data is sent to any server. Passwords and secrets stay on your device. Crypto operations use the Web Crypto API. Your privacy is fully protected at all times.
Secure Settings by Default
Configs use safe defaults out of the box. Containers run as non-root users. Root filesystems are set to read-only. Dangerous Linux capabilities are dropped. Network policies limit pod-to-pod traffic. TLS 1.3 is enabled for web servers. Security headers are added where needed.
Ready for CI/CD & Git
Output files are ready for your Git repo. Use them with ArgoCD, Flux, or GitHub Actions. Files use clear formatting and comments. Code review is easy for your team. Indentation and key order are consistent. Test in staging before going to production. Every file is clean and well-structured.
Infrastructure as Code
Store configs in Git alongside your code. Terraform modules include typed variables. Backend configs support remote state locking. Outputs work across multiple modules. Ansible playbooks use clear task steps. Chef and Puppet configs are also supported. Every file works with version control tools.
Monitoring & Tracing
Set up Prometheus with auto-discovery rules. Create Grafana dashboards with template variables. Add alerting rules with severity labels. Use OpenTelemetry for trace collection. Forward logs to Loki or Elasticsearch. Connect to Jaeger or Tempo for tracing. Monitor metrics, logs, and traces together.
Container & Docker Safety
Dockerfiles use multi-stage builds for small images. Base images are pinned to exact versions. Dev files are excluded from final images. Health checks are added for orchestrator use. Containers switch to non-root users. Docker Compose uses named volumes and networks. Resource limits are set in deploy configs.
Multiple Output Formats
Export as YAML, JSON, HCL, or TOML. Kubernetes uses YAML with proper separators. Terraform uses HCL with correct escaping. JSON output has consistent indentation. Copy to clipboard with one click. Preview output with syntax highlighting. Line numbers help you review quickly.
Related Tools
Quick Summary
prometheus.yml file that tells the Prometheus monitoring server exactly which target IPs to scrape for metrics and how often to do so.What is this tool?
A Prometheus Config Generator is a visual DevOps tool used to build the central configuration file for the Prometheus monitoring system. Instead of manually writing error-prone YAML arrays to define scrape jobs, configuring static IP targets, or setting up complex Alertmanager routing, you can use a guided interface.
The generator outputs a robust, production-ready prometheus.yml file that dictates how Prometheus collects time-series metrics from your microservices, databases, and Linux nodes, ensuring your infrastructure is fully observable.
How to Use This Tool
- Set Global Settings — Define the default scrape_interval (e.g., 15s) and evaluation_interval for alert rules.
- Add Scrape Jobs — Create logical jobs for different service types (e.g., 'node-exporter', 'api-backend', 'postgres').
- Define Targets — List the static IP addresses and ports where Prometheus can find the HTTP /metrics endpoint for each job.
- Configure Alertmanager — Link your Prometheus instance to an Alertmanager server to route triggered alerts to Slack or PagerDuty.
- Export Configuration — Download the prometheus.yml file and mount it to your Prometheus Docker container or Linux server.
What This Tool Generates
prometheus.yml— The primary configuration file used by the Prometheus server to discover targets, scrape metrics, evaluate alerting rules, and communicate with Alertmanager.
Example Output Explanation
This snippet configures Prometheus to scrape itself, two Linux nodes via Node Exporter, and send alerts to a local Alertmanager:
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: ['localhost:9093']
rule_files:
- "rules.yml"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['10.0.0.5:9100', '10.0.0.6:9100']Best Practices
- Keep the global 'scrape_interval' around 15s to 30s. Scraping too fast (e.g., 1s) will rapidly consume disk space and overload your backend services with HTTP requests.
- Use 'relabel_configs' within your scrape jobs to drop sensitive metrics or standardize label names before they are stored in the time-series database (TSDB).
- For highly dynamic environments (like AWS Auto Scaling groups or Kubernetes), use Service Discovery instead of hardcoding static IPs that will quickly become stale.
Common Mistakes
- Forgetting that Prometheus is a pull-based system. Your target applications must actively expose an HTTP server (usually on '/metrics') for Prometheus to connect to; they do not push data to Prometheus.
- Indentation errors. Like all YAML files, prometheus.yml relies on strict space indentation. Using tabs will cause the Prometheus server to crash immediately on startup.
- Setting the 'evaluation_interval' lower than the 'scrape_interval'. Alert rules cannot logically be evaluated faster than the underlying data is actually collected.
Security Notes
- Prometheus does not encrypt traffic or authenticate targets by default. If you are scraping targets across the public internet, you MUST configure TLS (tls_config) and Basic Auth (basic_auth).
- Never expose your Prometheus web UI (port 9090) directly to the public internet without putting it behind a secure reverse proxy (like Nginx) with strict authentication.
Testing Instructions
- Save the generated file exactly as 'prometheus.yml' on your machine.
- Run Prometheus locally using Docker: 'docker run -p 9090:9090 -v /absolute/path/to/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus'.
- Open 'http://localhost:9090/targets' in your web browser to verify that all your configured endpoints are actively showing a state of 'UP'.
Frequently Asked Questions
What is a Node Exporter?
How does this integrate with Grafana?
Why are my targets showing as 'DOWN' in Prometheus?
Should I use static_configs or Service Discovery?
How We Keep Your Configs Safe & Valid
Built-in Error Checking
Every file is checked against official rules. We catch missing fields and bad syntax. YAML indentation errors are flagged right away. Kubernetes, Terraform, and Docker specs are all covered. API versions and labels are verified too. You get valid output every time you generate.
100% Private & Local
All tools run in your browser only. Your API keys never leave your machine. We do not use any tracking scripts. No data is sent to any server. Passwords and secrets stay on your device. Crypto operations use the Web Crypto API. Your privacy is fully protected at all times.
Secure Settings by Default
Configs use safe defaults out of the box. Containers run as non-root users. Root filesystems are set to read-only. Dangerous Linux capabilities are dropped. Network policies limit pod-to-pod traffic. TLS 1.3 is enabled for web servers. Security headers are added where needed.
Ready for CI/CD & Git
Output files are ready for your Git repo. Use them with ArgoCD, Flux, or GitHub Actions. Files use clear formatting and comments. Code review is easy for your team. Indentation and key order are consistent. Test in staging before going to production. Every file is clean and well-structured.
Infrastructure as Code
Store configs in Git alongside your code. Terraform modules include typed variables. Backend configs support remote state locking. Outputs work across multiple modules. Ansible playbooks use clear task steps. Chef and Puppet configs are also supported. Every file works with version control tools.
Monitoring & Tracing
Set up Prometheus with auto-discovery rules. Create Grafana dashboards with template variables. Add alerting rules with severity labels. Use OpenTelemetry for trace collection. Forward logs to Loki or Elasticsearch. Connect to Jaeger or Tempo for tracing. Monitor metrics, logs, and traces together.
Container & Docker Safety
Dockerfiles use multi-stage builds for small images. Base images are pinned to exact versions. Dev files are excluded from final images. Health checks are added for orchestrator use. Containers switch to non-root users. Docker Compose uses named volumes and networks. Resource limits are set in deploy configs.
Multiple Output Formats
Export as YAML, JSON, HCL, or TOML. Kubernetes uses YAML with proper separators. Terraform uses HCL with correct escaping. JSON output has consistent indentation. Copy to clipboard with one click. Preview output with syntax highlighting. Line numbers help you review quickly.