群晖-使用docker套件部署Prometheus+Grafana
2022/9/8 23:53:20
本文主要是介绍群晖-使用docker套件部署Prometheus+Grafana,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Docker 部署 Prometheus 说明:
先在群辉管理界面安装好docker套件,修改一下镜像源(更快一点)
所需容器如下
Prometheus Server(普罗米修斯监控主服务器 ) Node Exporter (收集Host硬件和操作系统信息) cAdvisor (负责收集Host上运行的容器信息) Grafana (展示普罗米修斯监控界面)
1.安装Node Exporter
docker run -d -p 9100:9100 \ -v "/proc:/host/proc" \ -v "/sys:/host/sys" \ -v "/:/rootfs" \ -v "/etc/localtime:/etc/localtime" \ prom/node-exporter \ --path.procfs /host/proc \ --path.sysfs /host/sys \ --collector.filesystem.ignored-mount-points "^/(sys|proc|dev|host|etc)($|/)"
部署后执行docker ps -a
查看容器状态
root@Synology:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d49e898538ed prom/node-exporter "/bin/node_exporter …" 2 days ago Up 2 days 0.0.0.0:9100->9100/tcp agitated_hoover
2.安装cAdvisor
docker run -d -v "/etc/localtime:/etc/localtime" \ --volume=/:/rootfs:ro \ --volume=/volume1/homes/docker_conf:/var/run:rw \ --volume=/sys:/sys:ro \ --volume=/volume1/homes/docker_conf/var/lib/docker/:/var/lib/docker:ro \ --publish=18104:8080 \ --detach=true \ --name=cadvisor \ --privileged=true \ google/cadvisor:latest
部署后执行docker ps -a
查看容器状态
root@Synology:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 8f457d3ad48f google/cadvisor:latest "/usr/bin/cadvisor -…" 2 days ago Up 2 days 0.0.0.0:18104->8080/tcp cadvisor
3.安装 Prometheus Server
1>编辑配置文件
此处我将docker映射的相关东西都放在了/volume1/homes/docker_conf
可用参考
root@Synology:/volume1/homes/docker_conf# cat 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). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # 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: ['192.168.10.200:9090','192.168.10.200:18104','192.168.10.200:9100']
2>启动命令
docker run -d \ -v /volume1/homes/docker_conf/prometheus.yml:/etc/prometheus/prometheus.yml \ -v "/etc/localtime:/etc/localtime" \ --name prometheus \ --publish=9090:9090 \ prom/prometheus:latest
部署后执行docker ps -a
查看容器状态
root@Synology:~# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 01ea6fe3ff19 prom/prometheus:latest "/bin/prometheus --c…" 2 days ago Up 2 days 0.0.0.0:9090->9090/tcp prometheus
4.创建运行Grafana
docker run -d -i -p 3000:3000 \ -v "/etc/localtime:/etc/localtime" \ -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \ -e "GF_SECURITY_ADMIN_PASSWORD=admin8888" \ --net=host \ grafana/grafana
部署后执行docker ps -a
查看容器状态
root@Synology:~# docker ps -a 7c2e4f420ebe grafana/grafana "/run.sh" 2 days ago Up 2 days gallant_spence
5.访问群晖Grafana
浏览器访问群晖IP:3000 按照网上步骤添加Prometheus数据源,添加面板
推荐好用的面板:https://grafana.com/grafana/dashboards/8919
这篇关于群晖-使用docker套件部署Prometheus+Grafana的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-14Docker端口:你真的公开了哪些东西?
- 2024-11-14用DOCKER在家里的实验室里搞些酷炫的玩意儿
- 2024-11-05掌握Docker:高效安全的十大最佳实践
- 2024-11-05在 Docker Compose 中怎么设置端口映射-icode9专业技术文章分享
- 2024-11-05在 Docker Compose 中怎么设置环境变量-icode9专业技术文章分享
- 2024-11-04Docker环境部署项目实战:新手入门教程
- 2024-11-04Docker环境部署资料:新手入门教程
- 2024-11-01Docker环境部署教程:新手入门指南
- 2024-11-01超越Docker:苹果芯片上的模拟、编排和虚拟化方案讲解
- 2024-11-01Docker环境部署:新手入门教程