Setup the Prometheus server for collecting metrics Grafana for visualization and Node Exporter for monitoring the Ubuntu

0 votes
I need to setup the Prometheus server for collecting metrics, Grafana for visualization and Node Exporter for monitoring the Ubuntu 16.04 Linux host system. How do I achieve this?
Oct 23, 2019 in Docker by Hannah
• 18,520 points
2,651 views

1 answer to this question.

0 votes

You can use a docker-compose file similar to one the one I have added bellow. Have a look at it:

version: '3'
networks:
  monitor-net:
    driver: bridge
volumes:
    prometheus_data: {}
    grafana_data: {}
services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    volumes:
      - ./prometheus/:/etc/prometheus/
      - prometheus_data:/prometheus
    command:
      - '--config.file=/etc/prometheus/prometheus.yml'
      - '--storage.tsdb.path=/prometheus'
      - '--web.console.libraries=/etc/prometheus/console_libraries'
      - '--web.console.templates=/etc/prometheus/consoles'
      - '--storage.tsdb.retention=200h'
      - '--web.enable-lifecycle'
    # restart: unless-stopped
    expose:
      - 9090
    ports:
      - "9090:9090"
    networks:
      - monitor-net
  nodeexporter:
    image: prom/node-exporter:latest
    container_name: nodeexporter
    user: root
    privileged: true
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/rootfs:ro
    command:
      - '--path.procfs=/host/proc'
      - '--path.sysfs=/host/sys'
      - '--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|host|etc)($|/)'
    restart: unless-stopped
    expose:
      - 9100
    networks:
      - monitor-net
  grafana:
   image: grafana/grafana:latest
   container_name: grafana
   volumes:
     - grafana_data:/var/lib/grafana
     - ./grafana/datasources:/etc/grafana/datasources
     - ./grafana/dashboards:/etc/grafana/dashboards
     - ./grafana/setup.sh:/setup.sh
   entrypoint: /setup.sh
   environment:
     - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin}
     - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin}
     - GF_USERS_ALLOW_SIGN_UP=false
   restart: unless-stopped
   expose:
     - 3000
   ports:
     - 3000:3000
   networks:
     - monitor-net
answered Oct 23, 2019 by Eric

Related Questions In Docker

0 votes
1 answer
0 votes
1 answer
0 votes
4 answers

what is network namespace and how we can access network namespace for the container?

Hey @Ali, I'll just combine @Eric, @Jackie ...READ MORE

answered Dec 20, 2018 in Docker by Kalgi
• 52,350 points
5,861 views
0 votes
1 answer

What is the process for stopping and restarting a docker container?

If you want to stop a docker ...READ MORE

answered Jul 3, 2019 in Docker by Sirajul
• 59,230 points
9,342 views
+2 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
3,931 views
0 votes
1 answer

Docker compose to bring up a Prometheus server

I think this docker-compose should be helpful. ...READ MORE

answered Oct 23, 2019 in Docker by Eric
6,367 views
0 votes
1 answer

Docker error "ERROR: for nginx Cannot start service nginx: oci runtime error"

I had faced a similar issue and ...READ MORE

answered Sep 24, 2019 in Docker by anonymous
• 52,350 points
6,582 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP