Skip to content

Commit

Permalink
contrib/exec-smartctl: Use the environment variables by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
octo committed Jul 5, 2010
1 parent 065e7a1 commit 3ecbbe9
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions contrib/exec-smartctl
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,29 @@
# smart ALL = (root) NOPASSWD: SMARTCTL
# -- >8 --

HOST="huhu"
INTERVAL=60
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
INTERVAL="${COLLECTD_INTERVAL:-60}"

while true
while sleep "$INTERVAL"
do
TEMP=$((sudo smartctl -d 3ware,0 -A /dev/twe0 | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
if [ $? -ne 0 ]
then
TEMP="U"
fi
echo "PUTVAL $HOST/exec-smart/temperature-3ware_0 interval=$INTERVAL N:$TEMP"
echo "PUTVAL $HOSTNAME/exec-smart/temperature-3ware_0 interval=$INTERVAL N:$TEMP"
TEMP=$((sudo smartctl -d 3ware,1 -A /dev/twe0 | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
if [ $? -ne 0 ]
then
TEMP="U"
fi
echo "PUTVAL $HOST/exec-smart/temperature-3ware_1 interval=$INTERVAL N:$TEMP"
echo "PUTVAL $HOSTNAME/exec-smart/temperature-3ware_1 interval=$INTERVAL N:$TEMP"
TEMP=$((sudo smartctl -d ata -A /dev/sda | grep Temperature_Celsius | awk '{ print $10; }') 2>/dev/null);
if [ $? -ne 0 ]
then
TEMP="U"
fi
echo "PUTVAL $HOST/exec-smart/temperature-sata_0 interval=$INTERVAL N:$TEMP"
sleep $INTERVAL
echo "PUTVAL $HOSTNAME/exec-smart/temperature-sata_0 interval=$INTERVAL N:$TEMP"
done

0 comments on commit 3ecbbe9

Please sign in to comment.