All pastes #951792 Raw Edit

Mine

public text v1 · immutable
·published 2008-03-21 17:39 UTC
rendered paste body
!/bin/bash

echo $(hostname):
echo -n "  { 'disk': ["
for i in {a..l} ; do
        smartctl -d ata -a /dev/sd$i | \
        awk -v HOST=$i '
                /Reallocated_Sector_Ct/ {
                        if ($10 > 0)
                                printf("{\"name\": \"/dev/sd%s\", \"Reallocated\": %d},", HOST, $10) }
                /Spin_Retry_Count/ {
                        if ($10 > 0)
                                printf("{\"name\": \"/dev/sd%s\", \"Spin_Retry\": %d},", HOST, $10) }
               /Current_Pending_Sector/ {
                        if ($10 > 0)
                                printf("{\"name\": \"/dev/sd%s\", \"Pending_Sector\": %d},", HOST, $10) }
              /Offline_Uncorrectable/ {
                        if ($10 > 0)
                                printf("{\"name\": \"/dev/sd%s\", \"Offline_Uncorrectable\": %d},", HOST, $10) }


'
done
echo "] }"