前提条件

  • 已部署docker
  • 已部署grafana
  • 需要开放 3000 9100 和 9090 端口

启动node-exporter

docker run --name node-exporter -d  \
--restart=always \
-p 9100:9100 \
-v "/proc:/host/proc:ro" \
-v "/sys:/host/sys:ro" \
-v "/:/rootfs:ro" \
--net="host" \
prom/node-exporter

启动prometheus

新建目录prometheus,编辑配置文件prometheus.yml

mkdir /opt/prometheus
cd /opt/prometheus/
vim prometheus.yml

内容如下:

global:
scrape_interval: 60s
evaluation_interval: 60s scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: prometheus - job_name: Host monitoring
static_configs:
- targets: ['192.168.3.101:9100']
labels:
instance: localhost

注意:修改IP地址,这里的192.168.3.101就是本机地址

启动prometheus

docker run  --name prometheus -d  \
--restart=always \
-p 9090:9090 \
-v /opt/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
prom/prometheus

访问prometheus web页面

浏览器输入 http://192.168.91.132:9090 ;点击 Status-->Targets 访问Targets效果如下:

如果状态没有UP起来,请等待2分钟左右。

添加数据源

访问grafana web界面,添加数据源

点击Data Source, 选择Add data source

选择Prometheus,在URL中填写Prometheus的访问地址,点击Save & Test,出现绿色提示,则添加成功

导入Dashboard

Json下载地址/或copy id:https://grafana.com/grafana/dashboards/8919

将该json文件上传至grafana,点击import即可

监控页面

Docker环境中部署Prometheus及node-exporter监控主机资源的更多相关文章

  1. Docker环境中部署OwnCloud 9.0

    整体思路: 1.官方获取mysql.php+apache镜像: 2.基于php+apache,创建OwnCloud镜像: 3.启动mysql镜像: 4.启动OwnCloud镜像,链接mysql镜像,访 ...

  2. Docker环境中部署DzzOffice 1.2.5.2

    整体思路: 1.官方获取mysql.php+apache镜像: 2.基于php+apache,创建DzzOffice镜像: 3.启动mysql镜像: 4.启动DzzOffice镜像,链接mysql镜像 ...

  3. k8s集群中部署prometheus server

    1.概述 本文档主要介绍如何在k8s集群中部署prometheus server用来作为监控的数据采集服务器,这样做可以很方便的对k8s集群中的指标.pod的.节点的指标进行采集和监控. 2.下载镜像 ...

  4. macOS 下 PHPStorm + Xdebug 调试 Docker 环境中的代码

    0x00 描述 宿主机是 mac mini,构建的项目在 docker 中,所以需要在 PHPStorm 上配置 Xdebug 进行远程代码调试. 0x01 环境 宿主机:macOS High Sie ...

  5. 如何在多机架(rack)配置环境中部署cassandra节点

    cassandra节点上数据的分布和存储是由系统自动完成的.除了我们要设计好partition key之外,在多机架(rack)配置环境中部署cassandra节点,也需要考虑cassandra分布数 ...

  6. Docker环境安装部署Java应用(含安装Tomcat和JDK)

    1.部署思路 两台docker机(centos 7系统),Docker 版本:18.09.6, build 481bc77156 Docker host IP:192.168.102.135 Dock ...

  7. Nginx系列(8)- Nginx安装 | Docker环境下部署

    Docker环境下部署Nginx https://www.cnblogs.com/gltou/p/15186971.html

  8. 关于 CDH 环境中部署 Dolphinscheduler 出现 hive-jdbc 包冲突的解决办法

    目前社区小伙伴经常反映在 cdh 环境中部署 Dolphinscheduler 出现 hive 包冲突的问题,报错日志信息如下: [WARN] 2020-04-29 09:55:30.815 org. ...

  9. Prometheus 集成 Node Exporter

    文章首发于公众号<程序员果果> 地址:https://mp.weixin.qq.com/s/40ULB9UWbXVA21MxqnjBxw 简介 Prometheus 官方和一些第三方,已经 ...

随机推荐

  1. 使用Egg改造订单系统展示效果,方便快速浏览

    素材准备: 1.Egg.js Born to build better enterprise frameworks and apps with Node.js & Koa 为企业级框架和应用而 ...

  2. 解决boa网页操作出现502 Bad Gateway The CGI was not CGI/1.1 compliant的一种可能

    最近在把一套网页操作的接口从原来Android5.0上移植到Android7.0上. 客户端连接验证的时候主页显示异常 502 Bad Gateway The CGI was not CGI/1.1 ...

  3. hdu 1083 Courses(二分图最大匹配)

    题意: P门课,N个学生.     (1<=P<=100    1<=N<=300) 每门课有若干个学生可以成为这门课的代表(即候选人). 又规定每个学生最多只能成为一门课的代 ...

  4. linux基本命令二

    组管理与权限管理  文件/目录所有者  修改文件所有者 chown 用户名 文件名 创建文件所在组  groupadd 修改文件所在组 chgrp  组名  文件名 其他组:除文件的所有者和所在组的用 ...

  5. Win10自动备份oracle数据库

    1.环境 操作系统:win10 数据库: 2.创建backup.bat文件 [ @echo offset name=%date:~0,4%%date:~5,2%%date:~8,2%set backu ...

  6. Jetbrains 系 IDE 编辑器的代码提示功能

    著名的 Jetbrains 可谓编程界的一大福音,众多有名代码编辑器比如 ItelliJ IDEA.PHPStorm.WebStorm.PyCharm 等,均出自这家公司麾下. 对于中国的Java开发 ...

  7. Part 16 ng include directive in AngularJS

    ng-include directive is used to embed an HTML page into another HTML page. This technique is extreme ...

  8. Part 1 to 10 Basic in C#

    Part 1 Introduction The struct of C# program: namespace , class and Main method what is namespace? t ...

  9. Part 61 to 63 Talking about partial class and partial method in C#

    部分类和部分方法 部分类是用partial声明的类,它允许我们把一个类分割成两个或多个类,当应用程序编译的完成的时候,多个部分类会结合成一个类,同时partial关键字也可以用于声明结构和接口. 那么 ...

  10. Linux基础四:软件包管理

    四.软件包管理器: 1.概念 红帽有两款软件包管理器,分别是rpm和yum. 1.rpm软件包管理器  ->  用来安装单个包  ->  .rpm文件 红帽的安装包文件,都放在Packag ...