一、拉取镜像

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. Linux:阿里云设置安全组开放对应端口过程

    手动添加后 保存就可以了.

  2. Linux:VMware配置NAT网络IP

    设置虚拟机网络配置 在目标虚拟机下右键, 选择"设置", 打开"虚拟机设置"对话框, 再选择"网络适配器"使用NAT模式的, 如下图所示: ...

  3. Linux date 获取时间

    获取当前日期: ubuser@ubuser-OptiPlex-7010:~$ date +%Y_%m_%d2020_12_16 获取当前时间: ubuser@ubuser-OptiPlex-7010: ...

  4. 创建者模式 -- 单例模式(反射&序列化)

    看的视频:https://www.bilibili.com/video/av43896218/?p=286 实现方式:(构造器私有,提供一个外部可以访问的方法(可以提供实例)) 1.饿汉式:线程安全, ...

  5. php-高级计算器

    HTML代码: <!doctype html><html lang="en"><head> <meta charset="UTF ...

  6. Ambiguous mapping found. Cannot map 'competeController' bean method

    报错: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMapp ...

  7. javax.naming.NoInitialContextException:Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial

    小弟初次用JNDI,使用数据源连接数据库,配置完相关的xml文件后,激动的我赶紧测试了一下,结果悲剧了,报出了错误: javax.naming.NoInitialContextException:Ne ...

  8. QT从入门到入土(二)——对象模型(对象树)和窗口坐标体系

    摘要 我们使用的标准 C++,其设计的对象模型虽然已经提供了非常高效的 RTTI 支持,但是在某些方面还是不够灵活.比如在 GUI 编程方面,既需要高效的运行效率也需要强大的灵活性,诸如删除某窗口时可 ...

  9. 「BZOJ 2956」模积和

    「BZOJ 2956」模积和 令 \(l=\min(n,m)\).这个 \(i\neq j\) 非常不优雅,所以我们考虑分开计算,即: \[\begin{aligned} &\sum_{i=1 ...

  10. Python使用笔记001

    一.Pycharm小技巧 1.pycharm创建项目时,选择Python环境,不使用默认的虚拟环境 2.如何在pycharm中查看python版本 Files--Settings--Project I ...