[Howto] monitor ZFS and S.M.A.R.T. with Zabbix and FreeBSD

posted in: computer | 0

You have to create user parameters (see the zabbix documentation for explanations/examples).

#zabbix_agentd.conf
UserParameter = zpool.health[*], zpool list -H -p -o health $1
UserParameter = zpool.size[*], zpool list -H -p -o size $1
UserParameter = zpool.capacity[*], zpool list -H -p -o capacity $1

UserParameter = smart.family[*], smartctl -i /dev/$1 | grep -i 'Model Family' | awk '{print $$3,$$4,$$5,$$6}'
UserParameter = smart.model[*], smartctl -i /dev/$1 | grep -i 'Device Model' | awk '{print $$3,$$4,$$5,$$6}'
UserParameter = smart.capacity[*], smartctl -i /dev/$1 | grep -i 'User Capacity' | awk '{print $$5 $$6}'
UserParameter = smart.serial[*], smartctl -i /dev/$1 | grep -i 'Serial Number' | awk '{print $$3}'
UserParameter = smart.hours[*], smartctl -A /dev/$1 | grep -i 'Power_On_Hours' | awk '{print $$10}'
UserParameter = smart.temp[*], smartctl -A /dev/$1 | grep -i 'Temperature' | awk '{print $$10}'
UserParameter = smart.read_err[*], smartctl -A /dev/$1 | grep -i 'Raw_Read_Error_Rate' | awk '{print $$10}'
UserParameter = smart.seek_err[*], smartctl -A /dev/$1 | grep -i 'Seek_Error_Rate' | awk '{print $$10}'
UserParameter = smart.realloc_sec[*], smartctl -A /dev/$1 | grep -i 'Reallocated_Sector_Ct' | awk '{print $$10}'
UserParameter = smart.uncorr_err[*], smartctl -A /dev/$1 | grep -i 'Uncorrectable' | awk '{print $$10}'
UserParameter = smart.multi_err[*], smartctl -A /dev/$1 | grep -i 'Multi_Zone_Error_Rate' | awk '{print $$10}'
UserParameter = smart.crc_err[*], smartctl -A /dev/$1 | grep -i 'UDMA_CRC_Error_Count' | awk '{print $$10}'
UserParameter = smart.progr_fail[*], smartctl -A /dev/$1 | grep -i 'Program_Fail_Cnt_Total' | awk '{print $$10}'
UserParameter = smart.erase_fail[*], smartctl -A /dev/$1 | grep -i 'Erase_Fail_Count_Total' | awk '{print $$10}'
UserParameter = smart.badblock[*], smartctl -A /dev/$1 | grep -i 'Runtime_Bad_Block' | awk '{print $$10}'

Afterwards you can use the user-defined parameters as item keys for monitoring.

 


If you want to test the user parameters, you can manually request the value with the command:

zabbix_get -s <IP-address> -k "smart.temp[<device>]"

e.g.   zabbix_get -s 192.168.0.100 -k “smart.temp[da0]”