Add SMART check and discovery scripts

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 11 years ago
parent f9d3f81616
commit b3f251e937
  1. 7
      conf/smart.conf
  2. 2
      scripts/check_smart_sudo
  3. 12
      scripts/disco_smart_sudo

@ -0,0 +1,7 @@
# Discover S.M.A.R.T. capable hard drives
# The only macro returned is {#SMARTDRIVE} and value is like /dev/sda
UserParameter=hardward.disk.smart.discovery,/usr/bin/sudo /var/lib/zabbix/bin/disco_smart_sudo
# Takes two args: the drives to check, and the value to get
# eg: hardward.disk.smart[/dev/sda,Reallocated_Sector_Ct]
UserParameter=hardward.disk.smart[*],/usr/bin/sudo /var/lib/zabbix/bin/check_smart_sudo $1 $2

@ -0,0 +1,2 @@
#!/bin/sh
/usr/sbin/smartctl -A $1 | grep $2 | tail -1| cut -c 88- | cut -f1 -d' '

@ -0,0 +1,12 @@
#!/bin/bash
echo -e "{\n\t\"data\":[\n\n"
for DISK in $(smartctl --scan-open | cut -d' ' -f1); do
smartctl -A $DISK >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "\t{\n"
echo -e "\t\t\"{#SMARTDRIVE}\":\"$DISK\""
echo -e "\t}"
fi
done
echo -e "\n\t]\n}\n"
Loading…
Cancel
Save