I'm experimenting with Prometheus to monitor and visualize the performance of several Java services. Works great and with Grafana the visual overview is very impressive.
But I don't seem to find how you can configure Prometheus itself to prevent its web interface to be publicly available. Grafana does this out of the box...
If I want to run everything on a cloud server, it would be great if I could check the /graph and /targets URL for instance, to check if everything is working OK before creating dashboards in Grafana.
Anyone who can point me to the right documentation? I went through this page, but didn't find exactly what I was looking for: https://prometheus.io/docs/prometheus/latest/configuration/configuration/
For info, this is my docker compose:
prometheus:
image: prom/prometheus:v2.21.0
container_name: prometheus
ports:
- 9090:9090
volumes:
- ./prometheus/alerts.yml:/etc/prometheus/alerts.yml
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- /var/app/prometheus-data:/prometheus
command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
restart: unless-stopped
grafana:
image: grafana/grafana:latest
container_name: grafana
depends_on:
- prometheus
ports:
- 3000:3000
volumes:
- ./grafana/grafana.ini:/etc/grafana/grafana.ini
- /var/app/grafana/data:/var/lib/grafana
- /var/app/grafana/provisioning:/etc/grafana/provisioning
environment:
- GF_INSTALL_PLUGINS=grafana-clock-panel
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=changeme
restart: unless-stopped
And my prometheus.yml file:
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
- "/etc/prometheus/alerts.yml"
# Scrape configurations
scrape_configs:
# The job name is added as a label `job=<job_name>` to any time series scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: [ '127.0.0.1:9090' ]
- job_name: 'java-service-1'
...