sh 在Docker中安装Prometheus和Grafana

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 在Docker中安装Prometheus和Grafana相关的知识,希望对你有一定的参考价值。

# docker-compose.yml
version: '2'
services:
    prometheus:
        image: prom/prometheus:0.18.0
        volumes:
            - ./prometheus.yml:/etc/prometheus/prometheus.yml
            - prometheus_data:/prometheus
        command:
            - '-config.file=/etc/prometheus/prometheus.yml'
        ports:
            - '9090:9090'
    node-exporter:
        image: prom/node-exporter
        ports:
            - '9100:9100'
    grafana:
            image: grafana/grafana
            environment:
                - GF_SECURITY_ADMIN_PASSWORD=pass
            depends_on:
                - prometheus
            ports:
                - "3000:3000"
volumes:
        prometheus_data: {}
# prometheus.yml
global:
    scrape_interval: 5s
    external_labels:
        monitor: 'my-monitor'
scrape_configs:
    - job_name: 'prometheus'
      target_groups:
          - targets: ['localhost:9090']
    - job_name: 'node-exporter'
      target_groups:
          - targets: ['192.168.10.166:9100']
#!/bin/bash

docker-compose up -d

以上是关于sh 在Docker中安装Prometheus和Grafana的主要内容,如果未能解决你的问题,请参考以下文章

sh Debian - 在Debian Jessie中安装docker

sh 在Ubuntu 18 LTS中安装Docker Engine和Docker Compose - wget -O - https://bit.ly/2B3eXLc |庆典

sh 如何在Ubuntu 16.04 LTS - Docker中安装Python 3.6。*

centos7.4中安装docker

在k8s集群中安装prometheus

如何在 ubuntu 中安装最新版本的 prometheus/promtool?