f03621ea64
a couple of his OpenBSD-specific plugins. Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface. Its emphasis is on plug and play capabilities. After completing an installation a high number of monitoring plugins will be playing with no more effort. Using Munin you can easily monitor the performance of your computers, networks, SANs, applications, weather measurements and whatever comes to mind. It makes it easy to determine "what's different today" when a performance problem crops up. It makes it easy to see how you're doing capacity-wise on any resources.
86 lines
1.7 KiB
Bash
Executable File
86 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $OpenBSD: sensors_,v 1.1.1.1 2009/11/17 11:11:21 sthen Exp $
|
|
#
|
|
# Script to monitor OpenBSD sensors
|
|
# (c) 2007 Michael Knudsen <mk@openbsd.org>
|
|
#
|
|
# Invoke as "volt", "temp" or "fan" based on what is being monitored.
|
|
|
|
# Parameters understood:
|
|
#
|
|
# config (required)
|
|
# autoconf (optional - used by munin-config)
|
|
|
|
# Magic markers (optional - used by munin-config and installation
|
|
# scripts):
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf suggest
|
|
|
|
mode=$(basename $0 | sed 's/sensors_//')
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if [ "$(uname -s)" = "OpenBSD" ]; then
|
|
echo yes
|
|
exit 0
|
|
else
|
|
echo no
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ "$1" = "suggest" ]; then
|
|
sysctl hw.sensors | awk '
|
|
/.temp/ { temp=1; }
|
|
/.fan/ { fan=1; }
|
|
/.volt/ { volt=1; }
|
|
END {
|
|
if (temp) {
|
|
print "temp";
|
|
}
|
|
if (fan) {
|
|
print "fan";
|
|
}
|
|
if (volt) {
|
|
print "volt";
|
|
}
|
|
}'
|
|
exit 0
|
|
fi
|
|
|
|
if [ "$mode" != "volt" -a "$mode" != "temp" -a "$mode" != "fan" ]; then
|
|
# error: invoke as "temp" "volt" or "fan"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_args --base 1000'
|
|
|
|
if [ "$mode" = "temp" ]; then
|
|
echo 'graph_title Temperature sensor values'
|
|
echo 'graph_vlabel degC'
|
|
elif [ "$mode" = "volt" ]; then
|
|
echo 'graph_title Voltage sensor values'
|
|
echo 'graph_vlabel V'
|
|
elif [ "$mode" = "fan" ]; then
|
|
echo 'graph_title Fan speed sensor values'
|
|
echo 'graph_vlabel RPM'
|
|
fi
|
|
echo 'graph_category system'
|
|
|
|
sysctl hw.sensors | cut -b 12- | fgrep $mode | while read s; do
|
|
name=$(echo $s | cut -d= -f1 | sed 's/\./_/g')
|
|
echo "$name.label $name"
|
|
done
|
|
exit 0
|
|
fi
|
|
|
|
sysctl hw.sensors | cut -b 12- | fgrep $mode | while read s; do
|
|
name=$(echo $s | cut -d= -f1 | sed 's/\./_/g')
|
|
value=$(echo $s | cut -d= -f2 | cut -d' ' -f1)
|
|
echo "$name.value $value"
|
|
done
|
|
|