diff --git a/docker-compose.yml b/docker-compose.yml index 1d784a0..7ae558c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,12 @@ version: "3.9" +volumes: + prometheus_data: {} + + services: + # Mikrotik Exporter + # https://github.com/nshttpd/mikrotik-exporter mikrotik_exporter: image: nshttpd/mikrotik-exporter-linux-arm64:1.0.12-DEVEL # Change this depending on your version and/or if you built the image locally volumes: @@ -8,4 +14,25 @@ services: env_file: .env ports: - 9436:9436 - restart: unless-stopped \ No newline at end of file + networks: + - default + restart: unless-stopped + + # Prometheus + # https://github.com/stefanprodan/dockprom + prometheus: + image: prom/prometheus:v2.28.1 + container_name: prometheus + volumes: + - ./prometheus:/etc/prometheus + - prometheus_data:/prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + restart: unless-stopped + ports: + - 9090:9090 + networks: + - default + labels: + org.label-schema.group: "monitoring" diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml index e69de29..8f8f77c 100644 --- a/prometheus/prometheus.yml +++ b/prometheus/prometheus.yml @@ -0,0 +1,31 @@ +# my global config +global: + scrape_interval: 120s # By default, scrape targets every 15 seconds. + evaluation_interval: 120s # By default, scrape targets every 15 seconds. + # scrape_timeout is set to the global default (10s). + + # Attach these labels to any time series or alerts when communicating with + # external systems (federation, remote storage, Alertmanager). + external_labels: + monitor: 'my-project' + +# Load and evaluate rules in this file every 'evaluation_interval' seconds. +rule_files: + # - "alert.rules" + # - "first.rules" + # - "second.rules" + +# 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 + + # metrics_path defaults to '/metrics' + # scheme defaults to 'http'. + + static_configs: + - targets: ['mikrotik_exporter:9436'] \ No newline at end of file