首页 > 其他分享 >Docker部署inluxdb,grafana,prometheus环境

Docker部署inluxdb,grafana,prometheus环境

时间:2022-12-08 16:14:55浏览次数:43  
标签:Pull complete grafana prometheus inluxdb docker root

创建网络
  1. 查看现有网络:docker network ls

[root@zhulang home]# docker network ls
NETWORK ID NAME DRIVER SCOPE
874979f64b45 bridge bridge local
3eaf2e5dea55 host host local
962e1d6cfa34 none null local

  1. 创建网络:docker network create mynet,mynet为网络名

[root@zhulang home]# docker network create mynet
f73d04c62fd7ecd4313d6702a4f4bb2293c652bafecb12c7cabd8f441a876e5c

  1. 查看创建的网络:docker network inspect mynet

[root@zhulang home]# docker network inspect mynet
[
{
"Name": "mynet",
"Id": "f73d04c62fd7ecd4313d6702a4f4bb2293c652bafecb12c7cabd8f441a876e5c",
"Created": "2021-01-17T14:43:15.085120773+08:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": {},
"Config": [
{
"Subnet": "172.21.0.0/16",
"Gateway": "172.21.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {},
"Options": {},
"Labels": {}
}
]

Docker部署influxdb
  1. 获取镜像:docker pull influxdb

[root@zhulang home]# docker pull influxdb
Using default tag: latest
latest: Pulling from library/influxdb
2587235a7635: Pull complete
953fe5c215cb: Pull complete
d4d3f270c7de: Pull complete
d81696497404: Pull complete
febe82b40114: Pull complete
9a89692c7853: Pull complete
5b833af9a4dc: Pull complete
69d297038fc8: Pull complete
Digest: sha256:fe53382e9fa49dd1ac079143ac5b26bfb4fb0ba32ac9b4b61c859a16943b1bff
Status: Downloaded newer image for influxdb:latest
docker.io/library/influxdb:latest

  1. 启动influxdb容器并命名为jmeterdb:docker run -d -p 8086:8086 --name jmeterdb --net mynet influxdb

[root@zhulang home]# docker run -d -p 8086:8086 --name jmeterdb --net mynet influxdb
2771fd54e2ae8576b67a52ecbfe20423e3cfab374c558161d2698926f6ae448d

  1. 进入该容器:docker exec -it jmeterdb /bin/bash

[root@zhulang home]# docker exec -it jmeterdb /bin/bash
root@2771fd54e2ae:/#

  1. 进入建数据库:influx

root@2771fd54e2ae:/# influx
Connected to http://localhost:8086 version 1.8.3
InfluxDB shell version: 1.8.3

  1. 创建数据库并查看是否创建成功

create database jmeterdb;
show databases;
name: databases
name


_internal
jmeterdb

  1. 通过jmeter测试influxdb数据库是否创建成功

    设置jmeter参数,启动jmeter

在这里插入图片描述

进入容器内的数据库查看是否有数据,有数据代表启动成功

在这里插入图片描述

Docker部署grafana
  1. 获取镜像:docker pull gafana/grafana

[root@zhulang home]# docker pull grafana/grafana
Using default tag: latest
latest: Pulling from grafana/grafana
801bfaa63ef2: Pull complete
efdb3434c59e: Pull complete
8cbdb3f56d34: Pull complete
34f82d4bd2ec: Pull complete
af445b3382af: Pull complete
4f4fb700ef54: Pull complete
8aab09bbec8e: Pull complete
9e81c23e3db5: Pull complete
Digest: sha256:5f19b6c385e8bfb8e5c9ecc7cdd123a453af3cf01e7c20d20059e770f656286d
Status: Downloaded newer image for grafana/grafana:latest
docker.io/grafana/grafana:latest

  1. 在创建的网络下启动grafana:docker run -d -p 3000:3000 --name mygrafana --net mynet grafana/grafana

[root@zhulang home]# docker run -d -p 3000:3000 --name mygrafana --net mynet grafana/grafana
b924a47732ebcb3801def47a72cffeacd5119ace28e2e4bae25df009166029e3

  1. 打开浏览器查看是否启动成功,用户名和密码均为admin
    在这里插入图片描述
grafana中设置influxdb
添加数据源

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TbxYcQdG-1612768905669)(C:\Users\fsy\AppData\Roaming\Typora\typora-user-images\image-20210117153813365.png)]

  1. 导入模板,模板选择id是4026或者5496即可

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-gXMW3jzb-1612768905672)(C:\Users\fsy\AppData\Roaming\Typora\typora-user-images\image-20210117161502532.png)]

Docker部署prometheus
  1. 拉取镜像:docker pull prom/prometheus

[root@zhulang home]# docker pull prom/prometheus
Using default tag: latest
latest: Pulling from prom/prometheus
ea97eb0eb3ec: Pull complete
ec0e9aba71a6: Pull complete
2c56484238c4: Pull complete
e04e22d751fb: Pull complete
725acffe426c: Pull complete
1aa9fa0253f1: Pull complete
d7fc56cae204: Pull complete
0697b0ac3503: Pull complete
1b03755e0f17: Pull complete
2c3149ca37ae: Pull complete
27dc64abca70: Pull complete
7ed50cc292d7: Pull complete
Digest: sha256:943c7c57115a449353e0158dcba4eaab2e56de07b7d552b5145cb6c0d1cbab19
Status: Downloaded newer image for prom/prometheus:latest
docker.io/prom/prometheus:latest

  1. 新建目录,生成prometheus.yaml

[root@zhulang home]# mkdir /home/prometheus
[root@zhulang home]# cd prometheus
[root@zhulang 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: linux
    static_configs:

    • targets: ['47.106.86.188:9100']
      labels:
      instance: localhost

~

  1. 启动prometheus

[root@zhulang prometheus]# docker run -d -p 9090:9090 -v /home/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml --net mynet prom/prometheus
4556160bec678aba8b6ebeaca4e34ea534d7306d2cbbec85a091ac95522cbd65

  1. 访问prometheus

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-K4e1klvz-1612768905673)(C:\Users\fsy\AppData\Roaming\Typora\typora-user-images\image-20210117212803356.png)]

  1. 安装node-exporter,拉取镜像,启动服务

[root@zhulang prometheus]# docker pull prom/node-exporter
Using default tag: latest
latest: Pulling from prom/node-exporter
86fa074c6765: Pull complete
ed1cd1c6cd7a: Pull complete
ff1bb132ce7b: Pull complete
Digest: sha256:cf66a6bbd573fd819ea09c72e21b528e9252d58d01ae13564a29749de1e48e0f
Status: Downloaded newer image for prom/node-exporter:latest
docker.io/prom/node-exporter:latest
[root@zhulang prometheus]# docker run -d -p 9100:9100 --name mynode-exporter --net mynet prom/node-exporter
994c5c645ed32479eb86bf18256869b011b82487dff40860c02d11d66431e94d

访问如下,表示安装成功

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xG8ja1hC-1612768905675)(C:\Users\fsy\AppData\Roaming\Typora\typora-user-images\image-20210117213544432.png)]

  1. 在grafana中安装监控主机的看板,id:9276,如图配置成功

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-V5RoRY7f-1612768905677)(C:\Users\fsy\AppData\Roaming\Typora\typora-user-images\image-20210117214124090.png)]

标签:Pull,complete,grafana,prometheus,inluxdb,docker,root
From: https://www.cnblogs.com/faith007/p/16966376.html

相关文章

  • Kubernetes(K8S) 监控 Prometheus + Grafana
    监控指标集群监控节点资源利用率节点数运行PodsPod监控容器指标应用程序Prometheus开源的监控、报警、数据库以HTTP协议周期性抓取被监控组件状态不需要......
  • 使用 Grafana 统一监控展示-对接 Zabbix
    概述在某些情况下,Metrics监控的2大顶流:Zabbix:用于非容器的虚拟机环境Prometheus:用于容器的云原生环境是共存的。但是在这种情况下,统一监控展示就不太方便,本文......
  • prometheus安装
    1、下载安装包https://prometheus.io/download/2、解压安装包tar-xvfprometheus-2.37.4.linux-amd64.tar.gz3、做软连接,指定自己的解压的目录ln-sv/root/prometheus/pr......
  • prometheus-部署
    1.prometheus-部署部署方式二进制部署https://prometheus.io/docs/prometheus/latest/getting_started/Docker部署https://prometheus.io/docs/prometheus/lat......
  • prometheus-主配置文件详解
    1.prometheus-主配置文件详解主机配置文件详解[root@iZj6cbgktk3zjpge312vq2Zprometheus]#catprometheus.yml#myglobalconfig#全局配置global:scrape_in......
  • Grafana是什么?
    1.1Grafana简介1.1.1Grafana是什么?一个类似Kibana的东西,也是对后端的数据进行实时展示,那么Grafana和Kibana有什么区别?在我看来区别不大,不过在大家的日常使用中Kibana是......
  • 【2022-12-04】Prometheus+Grafana监控平台部署文档
    一、环境准备1.准备两台虚拟机\或者购买云服务器2.虚拟机硬件要求2.1内存不得少于4G,否则项目启动会有报错2.2CPU2核2G2.3硬盘至少20G3.系统镜像 ......
  • prometheus
    prometheusServiceMonitor......
  • 使用Prometheus+Grafana搭建服务器监控系统
    安装$wgethttps://github.com/prometheus/prometheus/releases/download/v2.7.2/prometheus-2.7.2.linux-amd64.tar.gz$tarxvfzprometheus-2.7.2.linux-amd64.tar.gz$......
  • 三大实例带你搞定 Prometheus API 使用
    作为一位优秀的技术人员,往往能通过对数据的最大化利用来产生更多价值。而Prometheus的监控数据则是可以为我们所用的重要数据,它并不只能用于日常的监控和告警使用,也可以用......