RRD: статистика температуры дисков через hddtemp
Материал из Linux Wiki
Версия от 20:21, 3 декабря 2008; Rain (обсуждение | вклад) (Новая: <source lang=bash> #!/bin/bash dbfile="$1" if [ -z "${1}" ]; then echo -e " \e[32mUsage: \e[31m$0 \e[33mRRDBFILE \e[36mDrive1 Drive2 \e[32mExample: \e[31m$0 \e[33m/home/$USER/myups....)
#!/bin/bash
dbfile="$1"
if [ -z "${1}" ]; then
echo -e "
\e[32mUsage: \e[31m$0 \e[33mRRDBFILE \e[36mDrive1 Drive2
\e[32mExample: \e[31m$0 \e[33m/home/$USER/myups.rrd \e[36m/dev/hda /dev/hdb /dev/hdc /dev/sda
\e[0m"
exit 2
fi
if [ ! -e "${dbfile}" ]; then
echo -e "\e[31mError: Database \e[33m\"${dbfile}\" \e[31mnot exist\e[0m"
exit 1
fi
if [ ! -e /usr/sbin/hddtemp ]; then
echo -e "\e[31mError: \e[35m/usr/sbin/hddtemp:\e[31m no such file\e[0m"
exit 3
fi
shift
rrdtool update "${dbfile}" $(date +%s):$(/usr/sbin/hddtemp -n "${@}" | tr '\n' ':' | sed 's/:$//g')