Docker-安装Prometheus、grafana
2023-09-11 14:14:34 时间
1.拉取镜像包
docker pull prom/node-exporter docker pull prom/prometheus docker pull grafana/grafana
2.启动node-exporter[方便测试Prometheus]
docker run -d -p 9100:9100 \ -v "/home/fz/docker/node-exporter/proc:/host/proc:ro" \ -v "/home/fz/docker/node-exporter/sys:/host/sys:ro" \ -v "/home/fz/docker/node-exporter/:/rootfs:ro" \ --net="host" \ prom/node-exporter
http://localhost:9100/metrics
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles. # TYPE go_gc_duration_seconds summary go_gc_duration_seconds{quantile="0"} 0 go_gc_duration_seconds{quantile="0.25"} 0 go_gc_duration_seconds{quantile="0.5"} 0 go_gc_duration_seconds{quantile="0.75"} 0 go_gc_duration_seconds{quantile="1"} 0 go_gc_duration_seconds_sum 0 go_gc_duration_seconds_count 0 # HELP go_goroutines Number of goroutines that currently exist. # TYPE go_goroutines gauge go_goroutines 8 # HELP go_info Information about the Go environment. # TYPE go_info gauge go_info{version="go1.16.7"} 1 # HELP go_memstats_alloc_bytes Number of bytes allocated and still in use. # TYPE go_memstats_alloc_bytes gauge go_memstats_alloc_bytes 1.346552e+06 # HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed. # TYPE go_memstats_alloc_bytes_total counter go_memstats_alloc_bytes_total 1.346552e+06 # HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. # TYPE go_memstats_buck_hash_sys_bytes gauge go_memstats_buck_hash_sys_bytes 1.445106e+06 # HELP go_memstats_frees_total Total number of frees. # TYPE go_memstats_frees_total counter go_memstats_frees_total 730 # HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started. # TYPE go_memstats_gc_cpu_fraction gauge go_memstats_gc_cpu_fraction 0
3.启动prometheus
mkdir /home/fz/docker/prometheus
cd /home/fz/docker/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: ['localhost:9100'] labels: instance: localhost - job_name: clickhouse-1 static_configs: - targets: ['xx1:9363','xx2:9363','xx3:9363'] labels: instance: localhost
此处配置了一个clickhouse集群,如有没有直接删掉相关配置即可。
启动
docker run -d -p 9090:9090 -v /home/fz/docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
http://localhost:9090/graph
![](https://img2022.cnblogs.com/blog/1109757/202205/1109757-20220510225707136-1198439782.png)
4.启动grafana
创建映射的数据卷
mkdir /home/fz/docker/grafana-storage chmod 777 -R /home/fz/docker/grafana-storage
启动
docker run -d -p 3000:3000 --name=grafana -v /home/fz/docker/grafana-storage:/var/lib/grafana grafana/grafana
http://localhost:3000/login
默认用户名密码:admin/admin
![](https://img2022.cnblogs.com/blog/1109757/202205/1109757-20220510225543911-212603071.png)
相关文章
- Docker 系列(八):Docker API使用
- Docker 系列(一):Docker 概念 | 安装 | 基本使用
- 使用docker安装centos7并挂载主机目录
- Docker打包错误:Failed to execute goal com.spotify:docker-maven-plugin:1.2.0:build (default-cli) on project security
- Ubuntu安装Docker引擎和支持HTTPS的docker-registry服务
- 【网址收藏】WSL安装docker(不折腾版)
- 【网址收藏】win10环境下安装Docker、Windows安装docker
- Windows 10下安装Docker Desktop
- 【docker】Docker快速入门总结笔记(命令大全)
- Docker 安装 Redis
- Docker 安装 MySQL 5.7
- y71.第四章 Prometheus大厂监控体系及实战 -- prometheus server安装(二)
- docker-compose安装yapi接口文档工具——筑梦之路
- docker-php安装amqp扩展
- Centos7 下载|安装|配置|卸载 Docker
- 【Docker系列】2.Linux 安装docker+docker-compose
- 【Docker系列】6.使用docker-compose安装nginx
- 完成docker安装centos7操作系统实战
- ubuntu 完全干净的卸载docker
- Ubuntu20.04 在线安装docker
- docker 使用 GPU 安装Nvidia Docker