薇尔薇

Back

在PVE中安装了FNOS后,PVE中无法获取到硬盘温度数据,本文主要解决PVE中获取FNOS温度数据

FNOS温度数据导出#

FNOS中通过prometheus-community/smartctl_exporter ↗导出硬盘温度数据

services:
  smartctl-exporter:
    image: prometheuscommunity/smartctl-exporter
    privileged: true
    user: root
    ports:
      - "9633:9633"
yaml

PVE中获取、解析、写入数据#

新建文件/usr/local/bin/get_max_hdd_temp.sh用于通过API获取温度数据 此处获取所有硬盘温度数据后,取最大值

将数据写入文件 创建文件/usr/local/bin/write_hdd_temp.sh将获取到的温度数据写入/var/lib/hdd_temp/max_hdd_temp.txt

定时执行#

使用systemctl定制执行以上脚本,15秒更新一次温度数据

创建文件/etc/systemd/system/write-hdd-temp.service

[Unit]
Description=Write HDD temperature to file

[Service]
Type=oneshot
ExecStart=/usr/local/bin/write_hdd_temp.sh
txt

创建文件/etc/systemd/system/write-hdd-temp.timer

[Unit]
Description=Run virtual-temp-sensor service every 15 seconds

[Timer]
OnBootSec=15sec
OnUnitActiveSec=15sec
AccuracySec=1sec

[Install]
WantedBy=timers.target
txt

启动定时任务

sudo systemctl daemon-reload
sudo systemctl enable write-hdd-temp.timer
sudo systemctl start write-hdd-temp.timer
bash

配置fancontrol#

硬盘风扇为7,CPU风扇为2和6

PVE + FNOS直通硬盘后,硬盘仓风扇PWM调速
https://vio.vin/blog/pve-fnos-zhi-tong-ying-pan-hou-ying-pan-cang-feng-shan-pwm-tiao-su
Author violet
Published at 2025年5月25日