Monitorix 部署(docker-compose方式) linux 轻量化监控工具
1. 准备配置文件
Monitorix 的核心配置在 monitorix.conf 文件中。您可以先创建一个目录用于存放配置和监控数据,并下载官方默认配置文件:
# 创建宿主机目录
mkdir -p /opt/monitorix/conf
mkdir -p /opt/monitorix/db
# 下载官方默认配置文件
wget -O /opt/monitorix/conf/monitorix.conf https://raw.githubusercontent.com/mikaku/Monitorix/master/monitorix.conf
2. 编写 docker-compose.yml
version: '3'
services:
monitorix:
image: monitorix/monitorix:latest
container_name: monitorix
restart: always
ports:
- "8080:8080"
volumes:
# 挂载配置文件
- /opt/monitorix/conf/monitorix.conf:/etc/monitorix/monitorix.conf:ro
# 挂载数据库目录,防止容器重启后历史监控数据丢失
- /opt/monitorix/db:/var/lib/monitorix
# 【关键】挂载宿主机系统目录,使容器能读取真实硬件状态
- /proc:/host/proc:ro
- /sys:/host/sys:ro
欢迎来撩 : 汇总all
