
我有一個 FreeBSD,帶有運行 3 個硬碟的 RAID。我面臨的挑戰是監控其 RAID - 如果硬碟故障或出現一些我需要知道的問題。
所以,我現在要做的第一件事就是嘗試了解 SmartCTL 的工作原理......到目前為止我使用的命令是:
smartctl --scan -j - To scan my devices and generated a JSON Structured list.
smartctl -i /dev/device_name - To list informations about a single device
smartctl -a /dev/your-device - More information like errors and etc (I think i can use this in some way to grep only errors sections...)
SmartCTL 是否還有其他參數可以檢查磁碟是否可寫入、是否處於活動狀態以及其健康狀態是否正常?
這種理解的主要目的是主要使用 SmartCTL 產生數據,這些數據將用於 Zabbix 監控軟體的 pfSense RAID 監控模板和低級別發現...
任何幫助都是感激不盡。
答案1
好的,所以回答 -smartctl --isDiskOK /dev/sda
據我所知,您無法採取任何方法。
最接近的 smartctl 可以帶您到這是重新分配的扇區計數的報告。我不會詳細解釋,但本質上,當磁碟開始出現故障時,難以讀取/寫入的磁區將被重新定位到備用磁區。如果發生更多的重新分配,則表示驅動器更接近完全失效。
- Zabbix 可以利用以下使用者參數:
$ sudo cat /etc/zabbix/zabbix_agent2.d/userparameter_hdd.reallocated.sectors.conf
# get current HDD reallocated sectors count && needs sudoers
UserParameter=hdd.reallocated.sectors[*],sudo smartctl -a /dev/$1|grep Reallocated_Sector_Ct|awk '{print $$10}'
$ sudo grep zabbix /etc/sudoers.d/*
/etc/sudoers.d/zabbix:zabbix ALL=NOPASSWD:/usr/sbin/hddtemp, /usr/sbin/smartctl, /usr/bin/fping
將範本指派給受監控的主機 + 重新啟動 zabbix_agent 以載入配置 - 您的專案應填入重新指派的磁區數
利潤.. :)
無論如何,zabbix 模板也可以在我的 GitHub 上找到https://github.com/RipperSK/zabbix-user-params/blob/master/hdd.reallocated.sectors/userparameter_hdd.reallocated.sectors.conf
享受。