Synology NAS 進階教學:如何將 S.M.A.R.T. 視覺化?學習佈署 Scrutiny。
由於DSM 7起,移除了 S.M.A.R.T. 詳細資訊,
因此若需要查看 S.M.A.R.T. 有幾種方式:
①SSH指令查看。
②指令碼匯出檔案查看。
③佈署Scrutiny視覺化介面。
這裏以『佈署Scrutiny視覺化介面』為例,
不過,使用前,必需是 Plus 等級以上機型,
因為需要使用 Docker(Container Manager)佈署,
因此若非 Plus 以上機型,請放棄此法!
非 Plus 以上之機型,只能使用①②法囉~
首先請先安裝 Container Manager,
接下來,請在 docker 目錄,建立以下目錄結構:
docker┼Scrutiny┐
├config──┬collector.yaml
│ └scrutiny.yaml
├influxdb
├run
└docker-compose.yml
檔名不能修改,如圖所示:
接下來編輯『docker-compose.yml』佈署安裝檔,
=====================================================
=====================================================
【修改後,放在容器目錄下!如前截圖。】
按我下載docker-compose.yml範例檔
請注意,不能照搬唷!這是筆者使用的設定檔!
並不代表你也可以使用,因此需要先SSH查詢正確的裝置位置!
SSH查詢指令:
smartctl --scan
若你不熟悉SSH指令,可將它直接加入『任務排程表』,
新增→排程任務→使用者定義指令碼,如圖所示:
【請注意,必需是管理員帳號!】
建立完成後,先執行它,接下來收信!
只要電郵是有效的,會得到以下類似的結果,
這就是您目前的裝置,請記下!
並且修改 docker-compose.yml 檔,
需修改成目前已搜尋到的裝置,
不存在的請勿輸入或『#』註解掉,
否則會佈署失敗!請留意!
以後若有增減裝置,則必需重新佈署唷!
以下,看圖說說故事,依序佈署之~~
佈署成功後,在網址列輸入:
NAS IP
ort
範例:
192.168.1.115:9090
即出現以下畫面,代表成功了!
若出現以下畫面,代表截取資料失敗!
此時需要額外設定『collector.yaml』
=====================================================
=====================================================
按我下載collector.yaml範例檔
請找到 devices: ,並修改正確的裝置,
例如:
- device: /dev/sda
type: 'sat'
這兩行為一組裝置參數,依此類推,
需與『docker-compose.yml』安裝佈署檔上的裝置一致,
設定完畢後,別急著啟動,請先至 config 目錄下,
找到 scrutiny.db 刪除,並重新佈署,即可正常刷新。
以上,只要修改設定檔,就必需刪除該容器,再重新佈署唷!
由於DSM 7起,移除了 S.M.A.R.T. 詳細資訊,
因此若需要查看 S.M.A.R.T. 有幾種方式:
①SSH指令查看。
②指令碼匯出檔案查看。
③佈署Scrutiny視覺化介面。
這裏以『佈署Scrutiny視覺化介面』為例,
不過,使用前,必需是 Plus 等級以上機型,
因為需要使用 Docker(Container Manager)佈署,
因此若非 Plus 以上機型,請放棄此法!
非 Plus 以上之機型,只能使用①②法囉~
首先請先安裝 Container Manager,
接下來,請在 docker 目錄,建立以下目錄結構:
docker┼Scrutiny┐
├config──┬collector.yaml
│ └scrutiny.yaml
├influxdb
├run
└docker-compose.yml
檔名不能修改,如圖所示:
=====================================================
代碼:
version: '3.5'
services:
scrutiny:
restart: unless-stopped
container_name: scrutiny
image: ghcr.io/analogj/scrutiny:master-omnibus
deploy:
resources:
limits:
# memory: 256M # 限制最多使用 256MB 記憶體(非必備)
cap_add:
- SYS_RAWIO
- SYS_ADMIN
ports:
- "8080:8080" # webapp【前面是本機Port,可自訂;後面是容器Port,不可改。】
- "8086:8086" # influxDB admin
volumes:
- /run/udev:/run/udev:ro
- /volume1/docker/Scrutiny/config:/opt/scrutiny/config
- /volume1/docker/Scrutiny/influxdb:/opt/scrutiny/influxdb
devices:
- /dev/sda:/dev/sda
- /dev/sdb:/dev/sdb
# - /dev/sdc:/dev/sdc
# - /dev/sdd:/dev/sdd
- /dev/sdi:/dev/sdi
- /dev/sdj:/dev/sdj
# - /dev/nvme0n1:/dev/nvme0n1
# - /dev/nvme1n1:/dev/nvme1n1
# - /dev/usb1:/dev/usb1
# - /dev/usb2:/dev/usb2
environment:
# - SCRUTINY_WEB_INFLUXDB_TOKEN= #任意長字串(非必要)
# - SCRUTINY_WEB_INFLUXDB_INIT_USERNAME= 用戶名(非必要)
# - SCRUTINY_WEB_INFLUXDB_INIT_PASSWORD=密碼 #至少8字元的密碼(非必要)
- TIMEZONE=Asia/Taipei
security_opt:
- no-new-privileges:true
【修改後,放在容器目錄下!如前截圖。】
按我下載docker-compose.yml範例檔
請注意,不能照搬唷!這是筆者使用的設定檔!
並不代表你也可以使用,因此需要先SSH查詢正確的裝置位置!
SSH查詢指令:
smartctl --scan
若你不熟悉SSH指令,可將它直接加入『任務排程表』,
新增→排程任務→使用者定義指令碼,如圖所示:
【請注意,必需是管理員帳號!】
建立完成後,先執行它,接下來收信!
只要電郵是有效的,會得到以下類似的結果,
這就是您目前的裝置,請記下!
並且修改 docker-compose.yml 檔,
需修改成目前已搜尋到的裝置,
不存在的請勿輸入或『#』註解掉,
否則會佈署失敗!請留意!
以後若有增減裝置,則必需重新佈署唷!
以下,看圖說說故事,依序佈署之~~
佈署成功後,在網址列輸入:
NAS IP
範例:
192.168.1.115:9090
即出現以下畫面,代表成功了!
若出現以下畫面,代表截取資料失敗!
此時需要額外設定『collector.yaml』
=====================================================
代碼:
# Commented Scrutiny Configuration File
#
# The default location for this file is /opt/scrutiny/config/collector.yaml.
# In some cases to improve clarity default values are specified,
# uncommented. Other example values are commented out.
#
# When this file is parsed by Scrutiny, all configuration file keys are
# lowercased automatically. As such, Configuration keys are case-insensitive,
# and should be lowercase in this file to be consistent with usage.
######################################################################
# Version
#
# version specifies the version of this configuration file schema, not
# the scrutiny binary. There is only 1 version available at the moment
version: 1
# The host id is a label used for identifying groups of disks running on the same host
# Primiarly used for hub/spoke deployments (can be left empty if using all-in-one image).
host:
id: ""
# This block allows you to override/customize the settings for devices detected by
# Scrutiny via `smartctl --scan`
# See the "--device=TYPE" section of https://linux.die.net/man/8/smartctl
# type can be a 'string' or a 'list'
devices:
- device: /dev/sda
type: 'sat'
- device: /dev/sdb
type: 'sat'
# - device: /dev/sdc
# type: 'sat'
# - device: /dev/sdd
# type: 'sat'
- device: /dev/sde
type: 'sat'
- device: /dev/sdf
type: 'sat'
# - device: /dev/nvme0n1
# type: 'nvme'
# - device: /dev/nvme1n1
# type: 'nvme'
# - device: /dev/usb1
# type: 'sat'
# - device: /dev/usb2
# type: 'sat'
# # example for forcing device type detection for a single disk
# - device: /dev/sda
# type: 'sat'
#
# # example for using `-d sat,auto`, notice the square brackets (workaround for #418)
# - device: /dev/sda
# type: ['sat,auto']
#
# # example to show how to ignore a specific disk/device.
# - device: /dev/sda
# ignore: true
#
# # examples showing how to force smartctl to detect disks inside a raid array/virtual disk
# - device: /dev/bus/0
# type:
# - megaraid,14
# - megaraid,15
# - megaraid,18
# - megaraid,19
# - megaraid,20
# - megaraid,21
#
# - device: /dev/twa0
# type:
# - 3ware,0
# - 3ware,1
# - 3ware,2
# - 3ware,3
# - 3ware,4
# - 3ware,5
#
# # example to show how to override the smartctl command args (per device), see below for how to override these globally.
# - device: /dev/sda
# commands:
# metrics_info_args: '--info --json -T permissive' # used to determine device unique ID & register device with Scrutiny
# metrics_smart_args: '--xall --json -T permissive' # used to retrieve smart data for each device.
#log:
# file: '' #absolute or relative paths allowed, eg. web.log
# level: INFO
#
#api:
# endpoint: 'http://localhost:8080'
# endpoint: 'http://localhost:8080/custombasepath'
# if you need to use a custom base path (for a reverse proxy), you can add a suffix to the endpoint.
# See docs/TROUBLESHOOTING_REVERSE_PROXY.md for more info,
# example to show how to override the smartctl command args globally
#commands:
# metrics_info_args: '--info --json -d ata'
# metrics_smart_args: '--xall --json -d ata'
# metrics_smartctl_bin: 'smartctl' # change to provide custom `smartctl` binary path, eg. `/usr/sbin/smartctl`
# metrics_scan_args: '--scan --json' # used to detect devices
# metrics_info_args: '--info --json' # used to determine device unique ID & register device with Scrutiny
# metrics_smart_args: '--xall --json' # used to retrieve smart data for each device.
# metrics_smartctl_wait: 0 # time to wait in seconds between each disk's check
########################################################################################################################
# FEATURES COMING SOON
#
# The following commented out sections are a preview of additional configuration options that will be available soon.
#
########################################################################################################################
#collect:
# long:
# enable: false
# command: ''
# short:
# enable: false
# command: ''
按我下載collector.yaml範例檔
請找到 devices: ,並修改正確的裝置,
例如:
- device: /dev/sda
type: 'sat'
這兩行為一組裝置參數,依此類推,
需與『docker-compose.yml』安裝佈署檔上的裝置一致,
設定完畢後,別急著啟動,請先至 config 目錄下,
找到 scrutiny.db 刪除,並重新佈署,即可正常刷新。
以上,只要修改設定檔,就必需刪除該容器,再重新佈署唷!