Zabbix で S.M.A.R.T を監視するスクリプト
こういうのシェルスクリプトでもできるんだろうなぁ... 分からねえなあ...
Zabbix で S.M.A.R.T の値は見れてもそれが異常か判断か判別するスクリプトです。
多くの HDD にはあるであろう Reallocated_Event_Count , Current_Pending_Sector を見て
Worst or Value > Threshold となっていれば異常と判断するようにしてます。
- PHP => 5.0.0
- smartmontools
- $1 = 0 or 1
- 0 = 値を1つ取得する
- 1 = 総合的に判断して異常か判断する
- $2 = ex) sda
- $3 = Temp, Current_Pending_Sector etc...(smartctlで取得できるものが使えます)
$1 = 1 のとき出力された数字が
0 = 正常
-1 = 異常
となります。
+UserParameter=hdd.smart[*],/usr/bin/php /path/to/smart.php $1 $2 $3
+AllowRoot=1
$ zabbix_get -s <ip> -k hdd.smart[0,sda,Temp]
$ 44
$ zabbix_get -s <ip> -k hdd.smart[1,sda]
$ 0