diff --git a/prometheus/data/etc/prometheus.yml b/prometheus/data/etc/prometheus.yml new file mode 100644 index 0000000..93c24da --- /dev/null +++ b/prometheus/data/etc/prometheus.yml @@ -0,0 +1,19 @@ +global: + scrape_interval: 15s # By default, scrape targets every 15 seconds. + + # Attach these labels to any time series or alerts when communicating with + # external systems (federation, remote storage, Alertmanager). + external_labels: + monitor: 'codelab-monitor' + +# A scrape configuration containing exactly one endpoint to scrape: +# Here it's Prometheus itself. +scrape_configs: + # The job name is added as a label `job=` to any timeseries scraped from this config. + - job_name: 'prometheus' + + # Override the global default and scrape targets from this job every 5 seconds. + scrape_interval: 5s + + static_configs: + - targets: ['localhost:9090'] diff --git a/prometheus/data/prometheus.yml b/prometheus/data/prometheus.yml deleted file mode 100644 index 1997f99..0000000 Binary files a/prometheus/data/prometheus.yml and /dev/null differ diff --git a/prometheus/data/var/.gitkeep b/prometheus/data/var/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/prometheus/docker-compose.yml b/prometheus/docker-compose.yml index 2b65090..b48024e 100644 --- a/prometheus/docker-compose.yml +++ b/prometheus/docker-compose.yml @@ -1,9 +1,15 @@ -version: "3.7" +version: "3.8" services: prometheus: - image: prom/prometheus + image: prom/prometheus:v2.31.1 + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/var/lib/prometheus' + - '--web.console.libraries=/usr/share/prometheus/console_libraries' + - '--web.console.templates=/usr/share/prometheus/consoles' ports: - "9090:9090" volumes: - - ./data:/etc/prometheus + - ./data/etc:/etc/prometheus + - ./data/var:/var/lib/prometheus restart: unless-stopped