Project

General

Profile

Download (339 Bytes) Statistics
| Branch: | Revision:
96ba0c24 Marc Dequènes (Duck)
#!/bin/sh

DEV=${1:-noexistent}
ATTR=${2:-noexistent}

opts=$(grep "^$1:" /etc/zabbix/smart_phydev_ata | cut -d: -s -f 2)

CACHE_FILE=/tmp/zbx-smart_ata_${DEV}
test -z `/usr/bin/find ${CACHE_FILE} -mmin -5 2>/dev/null` && \
smartctl -A $opts >"${CACHE_FILE}"

cat "${CACHE_FILE}" | awk -vval="${ATTR}" '{ if ($2 == val) { print $10 } }'