一、拉取镜像

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. Docker:Docker部署postgresql数据库

    环境 Centos-7  Postgresql-10 docker-19 yum加载Postgresql yum install https://download.postgresql.org/pub ...

  2. PHP7与php5

    php在2015年12月03日发布了7.0正式版,带来了许多新的特性,以下是不完全列表: 性能提升:PHP7比PHP5.6性能提升了两倍. Improved performance: PHP 7 is ...

  3. Doris开发手记3:利用CoreDump文件快速定位Doris的查询问题

    Apache Doris的BE部分是由C++编写,当出现一些内存越界,非法访问的问题时会导致BE进程的Crash.这部分的问题常常较难排查,同时也很难快速定位到对应的触发SQL,给使用者带来较大的困扰 ...

  4. C++ 标准模板库(STL)——算法(Algorithms)的用法及理解

    C++ STL中的算法(Algorithms)作用于容器.它们提供了执行各种操作的方式,包括对容器内容执行初始化.排序.搜索和转换等操作.按照对容器内容的操作可将STL 中的算法大致分为四类: (1) ...

  5. python twain

    self.SD.SetCapability(twain.CAP_DUPLEXENABLED, twain.TWTY_BOOL, 0) #单面扫描 self.SD.SetCapability(twain ...

  6. Ajax爬取动态数据和HTTPS自动默认证书

    Ajax数据爬取 在spider爬取数据的过程中,有些网页的数据是利用Ajax动态加载出来的,所以,在网页源代码中可能不会看到这一部分的数据,因此,我们需要使用另外的方式进行数据多爬取. 以豆瓣电影的 ...

  7. Spring总结之事务

    Spring事务 1)定义 事务是指多个操作单元组成的集合,多个操作单元是整体不可分割的,要么都成功,要么都不成功.必须遵守四个原则(ACID) ●原子性(Atomicity):即事务是不可分割的最小 ...

  8. Redis学习——数据结构下

    4.集合(集合(set)类型也是用来保存多个的字符串元素,但和列表类型不一样的是,集合中不允许有重复元素,并且集合中的元素是无序的,不能通过索引下标获取元素.) 1.命令 .集合内操作 1.添加元素 ...

  9. glibc库和glib库

    http://ftp.acc.umu.se/pub/GNOME/sources/ ubuntu16上glib的安装包的名是libglibXX  XX是版本号 ubuntu上查看glibc的方法 ldd ...

  10. 2019 Mac下安装运行Homestead环境

    为了能提高自己的价值,还是要坚持学习新东西才行.这不,从多学会一个PHP开发框架开始.在开始使用Laravel之前,很多"经验"告诉我要先安装Homestead,至于好处,大家可以 ...