mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Initial version
This commit is contained in:
parent
e45a0c4948
commit
92d5eff633
1 changed files with 114 additions and 0 deletions
114
plugins/other/hddtemp
Executable file
114
plugins/other/hddtemp
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/bin/sh
|
||||
|
||||
# ^--- Ubuntu-Users may have to change this to /bin/bash or create a symlink...
|
||||
|
||||
# Plugin: hddtemp
|
||||
# Author: Philipp Giebel (spam@stimpyrama.org)
|
||||
# Version: 0.2
|
||||
#
|
||||
# Munin (http://munin.projects.linpro.no/) Plugin for checking HDD
|
||||
# Temperatures using hddtemp (https://savannah.nongnu.org/projects/hddtemp/)
|
||||
#
|
||||
# Requirements: * HDDTemp (https://savannah.nongnu.org/projects/hddtemp/)
|
||||
# * NetCat (http://netcat.sourceforge.net/)
|
||||
#
|
||||
#
|
||||
# Changelog: v0.1 - initial release
|
||||
# v0.2 - . added "autoconf"
|
||||
# . added warning- and critical-levels
|
||||
# . added config-check
|
||||
# . replaced backticks with "$()"
|
||||
# . fixed parser-bug (added "g" to sed)
|
||||
|
||||
##### CONFIGURATION START #####################################################
|
||||
|
||||
HOST="127.0.0.1" # ip or hostname of host running hddtempd (e.g: 127.0.0.1)
|
||||
PORT=7634 # port of hddtempd
|
||||
NC=$(which nc) # full path to netcat (e.g: /bin/nc)
|
||||
SED=$(which sed) # full path to sed (e.g: /usr/bin/sed)
|
||||
WARN=50 # warning temperature
|
||||
CRIT=60 # critical temperature
|
||||
|
||||
##### CONFIGURATION END #######################################################
|
||||
|
||||
if [ -x "$NC" ]
|
||||
then
|
||||
if [ -x "$SED" ]
|
||||
then
|
||||
output=$($NC $HOST $PORT | $SED 's/||/|^|/g')
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$output" ]
|
||||
then
|
||||
echo "hddtemp: Configuration needed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" == "config" ]
|
||||
then
|
||||
part=$(echo $output | cut -d"^" -f1)
|
||||
unit=$(echo $part |cut -d"|" -f5)
|
||||
echo "graph_title HDD Temperatures"
|
||||
echo "graph_category Disk"
|
||||
echo "graph_vlabel ° $unit"
|
||||
echo "graph_hlabel ° $unit"
|
||||
echo "graph_args --base 1000 -l 0"
|
||||
echo "graph_scale no"
|
||||
|
||||
part="start"
|
||||
count=0
|
||||
|
||||
while [ -n "$part" ]
|
||||
do
|
||||
count=$((count+1))
|
||||
part=$(echo $output | cut -d"^" -f$count)
|
||||
if [ -n "$part" ]
|
||||
then
|
||||
dev=$(echo $part | cut -d"|" -f2 |cut -d"/" -f3)
|
||||
desc=$(echo $part |cut -d"|" -f3)
|
||||
order="$order $dev"
|
||||
echo "$dev.info $dev temperature ($desc)"
|
||||
echo "$dev.label $dev"
|
||||
echo "$dev.warning $WARN"
|
||||
echo "$dev.critical $CRIT"
|
||||
fi
|
||||
done
|
||||
echo "graph_order$order"
|
||||
echo "graph_info Harddisk Temperatures"
|
||||
elif [ "$1" == "autoconf" ]
|
||||
then
|
||||
if [ -x "$NC" ]
|
||||
then
|
||||
if [ -x "$SED" ]
|
||||
then
|
||||
check=$($NC $HOST $PORT | $SED 's/||/|^|/g')
|
||||
if [ -n "$check" ]
|
||||
then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
else
|
||||
echo "no"
|
||||
fi
|
||||
else
|
||||
part="start"
|
||||
count=0
|
||||
|
||||
while [ -n "$part" ]
|
||||
do
|
||||
count=$((count+1))
|
||||
part=$(echo $output | cut -d"^" -f$count)
|
||||
if [ -n "$part" ]
|
||||
then
|
||||
dev=$(echo $part | cut -d"|" -f2 |cut -d"/" -f3)
|
||||
temp=$(echo $part |cut -d"|" -f4)
|
||||
echo "$dev.value $temp"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue