|
#!/bin/sh
|
|
|
|
DEV=${1:-noexistent}
|
|
ATTR=${2:-noexistent}
|
|
|
|
opts=$(grep "^$1:" /etc/zabbix/smart_phydev_sas | cut -d: -s -f 2)
|
|
|
|
CACHE_FILE=/tmp/zbx-smart_sas_${DEV}
|
|
test -z `/usr/bin/find ${CACHE_FILE} -mmin -5 2>/dev/null` && \
|
|
smartctl -A $opts >"${CACHE_FILE}"
|
|
|
|
cat "${CACHE_FILE}" | perl -ne "print \$1 if m/^${ATTR}:\s+([\d.]+)/"
|
|
|