Prometheus monitor RabbitMQ

Install docker-compose

wget https://studygolang.com/dl/golang/go1.12.1.linux-amd64.tar.gz
tar -C /usr/local/ -zxf go1.12.1.linux-amd64.tar.gz
vim /etc/profile.d/go.sh
source /etc/profile.d/go.sh

  

Prometheus

docker-compose

version: '3.2'

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    restart: unless-stopped
    ports:
      - '9090:9090'
    user: '0'
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus/data'
      - '--storage.tsdb.retention=90d'
      - '--web.enable-lifecycle'
    volumes:
      - ./etc/prometheus:/etc/prometheus
      - ./data/prometheus/data:/prometheus/data
      - /etc/localtime:/etc/localtime
    depends_on:
      - cadvisor

  cadvisor:
    image: google/cadvisor:latest
    container_name: cadvisor
    restart: unless-stopped
    ports:
      - '8080:8080'
    volumes:
      - /:/rootfs:ro
      - /var/run:/var/run:rw
      - /sys:/sys:ro
      - /var/lib/docker/:/var/lib/docker:ro

  node-exporter:
    image: prom/node-exporter:latest
    container_name: node-exporter
    restart: unless-stopped
    ports:
      - '9100:9100'
    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($$|/)'
      - '--collector.textfile.directory=/node_exporter/prom'
    volumes:
      - /proc:/host/proc
      - /sys:/host/sys
      - /:/rootfs
      - ./etc/node_exporter/prom:/node_exporter/prom

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    restart: unless-stopped
    ports:
      - '3000:3000'
    user: '0'
    volumes:
      - ./data/grafana:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_USERS_ALLOW_SIGN_UP=false

vim ./etc/prometheus/prometheus.yml

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.24:9090']
  - job_name: 'node'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.24:9100']
  - job_name: 'cadvisor'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.24:8080']
  - job_name: 'RabbitMQ'
    scrape_interval: 5s
    static_configs:
      - targets: ['192.168.1.24:9099']

  

start

docker-compose up -d

Rabbit Cluster

docker-compose

rabbit1:
  image: bijukunjummen/rabbitmq-server:3.7.0
  hostname: rabbit1
  ports:
    - "5672:5672"
    - "15672:15672"
  environment:
    - RABBITMQ_DEFAULT_USER=admin
    - RABBITMQ_DEFAULT_PASS=123456
  volumes:
       - /etc/timezone:/etc/timezone
       - /etc/localtime:/etc/localtime
rabbit2:
  image: bijukunjummen/rabbitmq-server:3.7.0
  hostname: rabbit2
  links:
    - rabbit1
  environment:
   - CLUSTERED=true
   - CLUSTER_WITH=rabbit1
   - RAM_NODE=true
  ports:
      - "5673:5672"
      - "15673:15672"
  volumes:
       - /etc/timezone:/etc/timezone
       - /etc/localtime:/etc/localtime
rabbit3:
  image: bijukunjummen/rabbitmq-server:3.7.0
  hostname: rabbit3
  links:
    - rabbit1
    - rabbit2
  environment:
   - CLUSTERED=true
   - CLUSTER_WITH=rabbit1
  ports:
        - "5674:5672"
  volumes:
       - /etc/timezone:/etc/timezone
       - /etc/localtime:/etc/localtime

start

docker-compose up -d

rabbitmq_exporter

https://github.com/kbudde/rabbitmq_exporter/releases

wget https://github.com/kbudde/rabbitmq_exporter/releases/download/v1.0.0-RC4/rabbitmq_exporter-1.0.0-RC4.linux-amd64.tar.gz
tar zxf rabbitmq_exporter-1.0.0-RC4.linux-amd64.tar.gz

  

start

RABBIT_USER=admin RABBIT_PASSWORD=123456 OUTPUT_FORMAT=JSON PUBLISH_PORT=9099 RABBIT_URL=http://192.168.1.24:15672 nohup ./rabbitmq_exporter &

grafana import Json File

https://grafana.com/dashboards/2121

猜你喜欢

转载自www.cnblogs.com/blogscc/p/10611380.html