Skip to content

patagonaa/prometheus-mndp-autodiscovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prometheus-mndp-autodiscovery

Prometheus autodiscovery for Mikrotik devices

Example using docker:

docker-compose.yml

version: "3"

services:
  prometheus:
    image: prom/prometheus
    volumes:
      - "./prometheus.yml:/etc/prometheus/prometheus.yml"
      - "mikrotik-discovery:/etc/prometheus/mikrotik-discovery"
      - "prometheus-data:/prometheus"
    # [...]

  mndp-autodiscovery:
    image: prometheus-mndp-autodiscovery
    build: ./prometheus-mndp-autodiscovery # path of git repo
    volumes:
      - "mikrotik-discovery:/file_sd/"
    network_mode: host # required for receiving UDP broadcasts

volumes:
  prometheus-data:
  mikrotik-discovery:

prometheus.yml

global:
  # [...]

scrape_configs:
  - job_name: 'snmp'
    metrics_path: /snmp
    file_sd_configs:
    - files:
      - 'mikrotik-discovery/targets.json'
    relabel_configs:
      - source_labels: [__address__]
        target_label: instance
        regex: '(^[^-]*-[^.]*).*'
        replacement: '$1'
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__address__]
        target_label: target
      - target_label: __address__
        replacement: '[ip or host where snmp-exporter is running]:9116'