407 字
2 分钟
Proxmox VE 环境下使用 Scrutiny 进行硬盘健康监控
前言
在之前的一篇文章里介绍了 Docker 部署 Scrutiny 监控你的硬盘,现在将进一步完善部署流程。
为什么选择 Scrutiny
Scrutiny 是一个基于 Docker 的硬盘健康监控工具,它通过 SMART(Self-Monitoring, Analysis and Reporting Technology) 数据采集硬盘信息,并通过 Web 界面展示趋势、告警等数据。
优势包括:
- 支持多硬盘类型(HDD、SSD、NVMe)
- 数据可视化,趋势图展示温度、健康状态、读写错误等指标
- 支持 InfluxDB 做时序存储,方便做长期监控
- 可通过 API 与其他系统集成
部署
Install Scrutiny
mkdir -p /opt/scrutiny/{influxdb,config} && cd /opt/scrutinynano docker-compose.yml
version: '2.4'
services: scrutiny-influxdb: image: influxdb:2.2 container_name: scrutiny-influxdb ports: - 8086:8086 restart: unless-stopped volumes: - ./influxdb:/var/lib/influxdb2 environment: TZ: Asia/Kolkata # CHANGE THIS healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8086/health"] interval: 5s timeout: 10s retries: 20
scrutiny-web: image: 'ghcr.io/analogj/scrutiny:master-web' container_name: scrutiny-web ports: - 8080:8080 restart: unless-stopped volumes: - ./config:/opt/scrutiny/config environment: SCRUTINY_WEB_INFLUXDB_HOST: scrutiny-influxdb TZ: Asia/Kolkata # CHANGE THIS depends_on: scrutiny-influxdb: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"] interval: 5s timeout: 10s retries: 20 start_period: 10s
启动Scrutiny
docker-compose up -d
- Scrutiny Web 服务默认运行在 8080 端口
- InfluxDB 默认运行在 8086 端口
- 可以通过浏览器访问
http://你的服务器IP:8080
查看 Scrutiny Web 界面
PVE 采集
在 PVE 节点上运行
cd /opt/scrutinynano scrutiny-collector-install.sh
将 API_ENDPOINT 替换为您的 Scrutiny 容器的 IP 地址。
#!/bin/bash
API_ENDPOINT="http://192.168.XX.XX:8080"
apt install smartmontools -y
INSTALL_DIR="/opt/scrutiny"BIN_DIR="$INSTALL_DIR/bin"LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "browser_download_url.*scrutiny-collector-metrics-linux-amd64" | cut -d '"' -f 4)
mkdir -p $BIN_DIRcurl -L $LATEST_RELEASE_URL -o $BIN_DIR/scrutiny-collector-metrics-linux-amd64chmod +x $BIN_DIR/scrutiny-collector-metrics-linux-amd64
mkdir -p /root/scrutinycat << EOF > /root/scrutiny/scrutiny.sh#!/bin/bash/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "$API_ENDPOINT" 2>&1 | tee /var/log/scrutiny.logEOFchmod +x /root/scrutiny/scrutiny.sh
cat << 'EOF' > /etc/systemd/system/scrutiny.service[Unit]Description=Scrutiny CollectorRequires=scrutiny.timer
[Service]Type=simpleExecStart=/root/scrutiny/scrutiny.shUser=rootEOF
cat << 'EOF' > /etc/systemd/system/scrutiny.timer[Unit]Description=Timer for the scrutiny.service
[Timer]Unit=scrutiny.serviceOnBootSec=5minOnUnitActiveSec=60min
[Install]WantedBy=timers.targetEOF
systemctl enable scrutiny.timersystemctl start scrutiny.timersystemctl status scrutiny.timer
运行脚本
chmod +x scrutiny-collector-install.sh./scrutiny-collector-install.sh
Proxmox VE 环境下使用 Scrutiny 进行硬盘健康监控
https://catcat.blog/how-to-install-scrunity-on-proxmox.html