一、拉取镜像

docker pull prom/prometheus

二、配置

sudo mkdir /etc/prometheus/
sudo vim /etc/prometheus/prometheus.yml

添加监控节点

# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# 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: 'codelab-monitor' # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "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=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus' # metrics_path defaults to '/metrics'
# scheme defaults to 'http'. static_configs:
- targets: ['172.17.0.1:9090'] - job_name: 'mysql'
static_configs:
- targets: ['172.17.0.1:9104']
labels:
instance: mysql - job_name: 'monitor'
static_configs:
metrics_path: '/actuator/prometheus'
- targets: ['172.17.0.1:9100']
labels:
instance: monitor

启动prometheus

# 因为目录/data用户组和用户是jtserver,docker执行命令是root用户,先将/data/lib/prometheus给其他组权限才能执行
sudo mkdir /data/lib/prometheus
sudo chmod 767 /data/lib/prometheus docker run -d \
-p 9090:9090 \
--restart=always \
--name prometheus \
-v /data/lib/prometheus:/data/lib/prometheus \
-v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/data/lib/prometheus

三、拉取node-exporter

docker pull prom/node-exporter

启动

docker run -d \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
--restart=always \
prom/node-exporter \
--path.procfs /host/proc \
--path.sysfs /host/sys \
--collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"

四、grafana

sudo apt-get install -y adduser libfontconfig1
wget https://dl.grafana.com/oss/release/grafana_6.7.2_amd64.deb
sudo dpkg -i grafana_6.7.2_amd64.deb sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
# echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo add-apt-repository "deb https://packages.grafana.com/oss/deb stable main" sudo apt-get update
sudo apt-get install grafana
sudo update-rc.d grafana-server defaults

docker 安装prometheus和grafna的更多相关文章

  1. docker 安装prometheus

    使用到的命令: [root@lgswork ~]# docker search prometheus NAME DESCRIPTION STARS OFFICIAL AUTOMATED prom/pr ...

  2. Docker安装prometheus

    # 拉取镜像 docker pull prom/prometheus:v2.22.0 # 创建配置文件 mkdir -p /opt/prometheus/ cd /opt/prometheus vim ...

  3. Prometheus介绍及docker安装方式

    一.介绍 Prometheus是主要基于Go编写,最初在SoundCloud上构建的开源系统监视和警报工具包,它启发于 Google 的 borgmon 监控系统,由工作在 SoundCloud 的 ...

  4. 基于docker 搭建Prometheus+Grafana

    一.介绍Prometheus Prometheus(普罗米修斯)是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的.随着发展,越来越多公司和组织接受采 ...

  5. ubuntu 18 docker 搭建Prometheus+Grafana

    Prometheus(普罗米修斯)是一套开源的监控&报警&时间序列数据库的组合,起始是由SoundCloud公司开发的.随着发展,越来越多公司和组织接受采用Prometheus,社会也 ...

  6. [转帖]基于docker 搭建Prometheus+Grafana

    基于docker 搭建Prometheus+Grafana https://www.cnblogs.com/xiao987334176/p/9930517.html need good study 一 ...

  7. Docker安装ElasticSearch 版本7.1.1

    一.Docker 部署 ElasticSearch 1.从仓库中查找所有ElasticSearch的镜像 [root@iZwz99dhxbd6xwly17tb3bZ app]# docker sear ...

  8. k8s 安装 prometheus 过程记录

    开始以为只要安装 prometheus-operator 就行了. git clone https://github.com/coreos/prometheus-operator.git cd pro ...

  9. Docker搭建Prometheus+grafana监控系统

    一.Prometheus简介 1.简介 Prometheus是由SoundCloud开发的开源监控报警系统和时序列数据库(TSDB). Prometheus使用Go语言开发,是Google BorgM ...

随机推荐

  1. 触宝科技基于Apache Hudi的流批一体架构实践

    1. 前言 当前公司的大数据实时链路如下图,数据源是MySQL数据库,然后通过Binlog Query的方式消费或者直接客户端采集到Kafka,最终通过基于Spark/Flink实现的批流一体计算引擎 ...

  2. CentOS-自定义SFTP用户及目录

    ftp功能说明:通过SSH启动CentOS的sftp功能 创建用户组及用户(sftp可变) $ groupadd sftp $ useradd -g sftp -s /sbin/nologin -d ...

  3. SpringBoot | 1.1 SpringBoot简介

    前言 本博客仅为记录与总结SpringBoot的学习笔记,资料来源: 书籍<深入浅出SpringBoot>第三版 B站尚硅谷<雷丰阳2021版SpringBoot2零基础入门> ...

  4. 在Intellij IDEA中新建Web项目

    1.点击左上角 文件(F) ,--> new  --> 项目 2.勾选下面的复选框,下一步就是给项目起名字和存放项目的位置 2.在Web文件下新建 clsses 和 lib文件夹:http ...

  5. python链接postgresql

    #需要安装的库 sudo apt-get install build-dep python-psycopg2 pip install psycopg2 #!/usr/bin/python # -*- ...

  6. 网页如何嵌套网页__HTML框架

    通过使用html框架,可以在一个浏览器窗口中展示多个页面.也就是一个html文件中可以引入多个html文件.在网页中框架使用比较少,但我们还是需要了解下. 方式1:iframe 使用iframe标签来 ...

  7. 【012】JavaSE面试题(十二):多线程(2)

    第一期:Java面试 - 100题,梳理各大网站优秀面试题.大家可以跟着我一起来刷刷Java理论知识 [012] - JavaSE面试题(十二):多线程(2) 第1问:多线程的创建方式? 方式一:继承 ...

  8. 【转载】Java学习笔记

    转载:博主主页 博主的其他笔记汇总 : 学习数据结构与算法,学习笔记会持续更新: <恋上数据结构与算法> 学习Java虚拟机,学习笔记会持续更新: <Java虚拟机> 学习Ja ...

  9. 查看JVM默认参数及微调JVM启动参数

    目录 查看某个JVM进程堆内存信息 微调JVM启动参数 查看JVM的一些默认参数 参考廖雪峰老师的这篇 JVM调优的正确姿势: https://www.liaoxuefeng.com/article/ ...

  10. spring-3-spring整合mybatis

    版本和依赖 MyBatis-Spring 需要以下版本: maven依赖 <dependency> <groupId>org.mybatis</groupId> & ...