2016-07-29 13:23:20 +02:00
|
|
|
#!/usr/bin/env bash
|
2015-05-18 10:57:45 +00:00
|
|
|
|
2016-05-05 10:27:30 +02:00
|
|
|
# LibreNMS agent to read HDD/SDD temperature using hddtemp
|
|
|
|
#
|
|
|
|
# Copyright (c) 2016 Exa-Omicron <http://exa.nl>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License as published by the
|
|
|
|
# Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
# option) any later version. Please see LICENSE.txt at the top level of
|
|
|
|
# the source code distribution for details.
|
|
|
|
#
|
|
|
|
# requires which, awk and sed
|
|
|
|
|
|
|
|
# If disks are missing, they can be added here:
|
|
|
|
disks="/dev/hd? /dev/sd?"
|
|
|
|
|
|
|
|
hddtemp=`which hddtemp 2>/dev/null`
|
|
|
|
|
|
|
|
if [ "${hddtemp}" != "" ]; then
|
|
|
|
if [ -x "${hddtemp}" ]; then
|
2016-09-09 02:16:28 -04:00
|
|
|
content=`${hddtemp} -w -q ${disks} 2>/dev/null | awk -F": " 'BEGIN{ ORS="" }{ print "|"$1"|"$2"|"$3"|";} ' | sed 's/°/\|/g';`
|
2016-05-05 10:27:30 +02:00
|
|
|
if [ "${content}" != "" ]; then
|
|
|
|
echo '<<<hddtemp>>>'
|
|
|
|
echo ${content}
|
|
|
|
echo
|
|
|
|
else
|
|
|
|
echo "no hddtemp compatible disks found" >&2
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "hddtemp not executable" >&2
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "hddtemp not installed" >&2
|
|
|
|
fi
|