1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Plugin-Gallery: Get better 2nd level headings

sensors, weather, snmp
This commit is contained in:
dipohl 2017-02-24 17:30:35 +01:00
parent 37d658526b
commit 95de964ec9
24 changed files with 10 additions and 10 deletions

View file

@ -1,346 +0,0 @@
#!/bin/bash
#==============================================================================#
# #
# check status of sensor of HW Group Poseidon 3268. For more info refer to: #
# http://www.hw-group.com/products/poseidon/poseidon_3268_en.html #
# 2012 by Florian Lechner #
# #
#==============================================================================#
# #
# 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 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
#==============================================================================#
# Munin autoconf and snmpautoconf magic
#%# family=auto snmpauto contrib
#%# capabilities=snmpconf
E_OK="0" # everything went allright
E_UNKNOWN="1" # "catch all" for otherwise unhandled errors
E_ARG="81" # invalid argument
E_USAGE="82" # wrong program name or arguments
E_SNMPGET="83" # error while executing the 'snmpget' utility
E_COMMANDNOTFOUND="127" # unable to locate binary
#==============================================================================#
# SNMP OIDs from the Poseidon MIB #
#==============================================================================#
SYS_LOC_OID=".1.3.6.1.2.1.1.6.0" # SNMP-location
SYS_NAME_OID=".1.3.6.1.2.1.1.5.0" # device name (string)
SYS_DESCR_OID=".1.3.6.1.2.1.1.1" # text describing the device
SYS_UPTIME_OID=".1.3.6.1.2.1.1.3.0" # time(in tens of milliseconds
#+ since the last reboot
IN_NAME_OID=".1.3.6.1.4.1.21796.3.3.1.1.3." # binary input name (string)
IN_STATE_OID=".1.3.6.1.4.1.21796.3.3.1.1.2." # binary input states(integer)
IN_ALARM_OID=".1.3.6.1.4.1.21796.3.3.1.1.4." # alarm for the binary input,
#+ generated by the device
#+ under defined conditions
#+ 0=Invalid, 1=Normal,
#+ 2=AlarmState, 3=Alarm
SENS_NAME_OID=".1.3.6.1.4.1.21796.3.3.3.1.2." # sensor name (string)
SENS_STATE_OID=".1.3.6.1.4.1.21796.3.3.3.1.4." # binary input states(integer)
SENS_VALUE_OID=".1.3.6.1.4.1.21796.3.3.3.1.6." # integer (decimal * 10)
SENS_ID_OID=".1.3.6.1.4.1.21796.3.3.99.1.2.1.4." # unique sensor ID (integer)
#+ representation of the
#+ temperature (integer)
SENS_UNIT_OID=".1.3.6.1.4.1.21796.3.3.3.1.9." # 0=°C,1=°F,2=°K,3=%,4=V,5=mA,
RTS_OUTPUT_OID=".1.3.6.1.4.1.21796.3.3.2.1.2." # binary input state (integer)
#+ 6=unknown, 7=pulse, 8=switch
# define some Poseidon specific stuff:
STATE_OK="1"
STATE_WARN="2"
STATE_CRIT="3"
UNITS=("C" "F" "K" "%" "V" "mA" "unknown" "pulse" "switch")
TYPES=("Temp" "Temp" "Temp" "Hum" "Volt" "Curr" "Unkn" "Pulse" "Switch")
declare -A sensorsOfType
IFS="
"
#==============================================================================#
# printMuninConfig ()
# print output for munin auto configuration
printMuninConfig () {
if [ ! $hostAddr = 'localhost' ]; then
cat <<- EOT
host_name $hostAddr
EOT
fi
for ((_sensorType=0; _sensorType<=${#UNITS[*]};_sensorType++)); do
# skip graphs without sensors
if [ -z "${sensorsOfType[$_sensorType]}" ]; then
continue
fi
_firstSensor="1"
# print specific config for each sensor
for _sensorNr in ${sensorsOfType[$_sensorType]}; do
getSensorData $_sensorNr
getSystemInfo
if [ $_firstSensor = "1" ]; then
# graph headers
cat <<- EOT
multigraph $sensorType
graph_title $sensorLocation - $sensorType [$sensorUnit]
graph_args --base 1000 -l 0
graph_vlabel $sensorUnit
graph_category sensors
graph_info This graph shows $sensorType history.
EOT
fi
_firstSensor="0"
cat <<- EOT
$sensorType$_sensorNr.label $sensorName
$sensorType$_sensorNr.info This graph shows $sensorType$_sensorNr history.
$sensorType$_sensorNr.draw LINE2
EOT
done
done
}
# printMuninSnmpConfig ()
# print output for munin snmp auto configuration
printMuninSnmpConfig () {
cat <<- EOT
require $SENS_VALUE_OID$sensorNumber [0-9]
require $SENS_STATE_OID$sensorNumber
EOT
return 0;
}
# printMuninStatus ()
# print status output for munin
printMuninStatus () {
for ((_sensorType=0; _sensorType<=${#UNITS[*]};_sensorType++)); do
# skip graphs without sensors
if [ -z "${sensorsOfType[$_sensorType]}" ]; then
continue
fi
_firstSensor="1"
# print config section
for _sensorNr in ${sensorsOfType[$_sensorType]}; do
getSensorData $_sensorNr
if [ $_firstSensor = "1" ]; then
# graph headers
cat <<- EOT
multigraph $sensorType
EOT
fi
_firstSensor="0"
# print graph details
cat <<- EOT
$sensorType$_sensorNr.value $(( $sensorValue / 10 ))
EOT
done
echo ""
done
}
# getSensorData(sensorNr)
# fetch state, value, name unit and sensor type for the sensor
#+ with the number "sensorNr"
getSensorData() {
_sensorNr=$1
sensorState=`snmpGet $hostAddr $SENS_STATE_OID$_sensorNr || err \
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
sensorValue=`snmpGet $hostAddr $SENS_VALUE_OID$_sensorNr || err \
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
sensorName=`snmpGet $hostAddr $SENS_NAME_OID$_sensorNr || err \
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
sensorUnit=`getSensorUnitString $_sensorNr`
sensorType=`getSensorType $_sensorNr`
}
# getSystemInfo()
# fetch general information about the system
getSystemInfo() {
sensorLocation="`snmpGet $hostAddr $SYS_LOC_OID`"
}
# snmpGet (hostAddr, OID)
# use snmpget to fetch a given OID, using above configuration
snmpGet () {
_oid="$2"
_host="$1"
_exit="0"
# fetch the requested OID
_longValue="`snmpget -O v\
-m $MIBS\
-v $SNMPVERSION\
-c $SNMPCOMMUNITY\
$_host $_oid 2>/dev/null`"
_exitStatus="$?"
echo ${_longValue#*:} # remove the type from the answer
return $_exitStatus
}
# get unit (string)
#+ find out the unit of the output of a given sensor. possible units are:
#+ "C" "F" "K" "%" "V" "mA" "unknown" "pulse" "switch"
getSensorUnitString () {
_sensorNr=$1
_sensorUnit=`snmpGet $hostAddr $SENS_UNIT_OID$_sensorNr || err \
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
echo ${UNITS[$_sensorUnit]}
}
# get type (string)
#+ find out what type of sensor we are dealing with. possible types are:
#+ "Temp" "Hum" "Volt" "Curr" "Unkn" "Pulse" "Switch"
getSensorType () {
_sensorNr=$1
_sensorUnit=`snmpGet $hostAddr $SENS_UNIT_OID$_sensorNr || err \
"Fatal: snmpget failed with code \"$?\"! Exiting..." $E_SNMPGET`
echo ${TYPES[$_sensorUnit]}
}
# getAvailableSensorsByType ()
# check what sensors are available and store them
#+ in the array for the respective unit
getAvailableSensorsByType () {
_thisSensorNr="1"
# initial fetch
_snmpget=`snmpGet $hostAddr $SENS_UNIT_OID$_thisSensorNr`
_nextSensorExits=$?
_unit=`echo "$_snmpget" | tr -d " "`
# add next sensor if it exists
while [ true ]; do
# add sensors of the same type to a list
sensorsOfType[$_unit]="${sensorsOfType[$_unit]} $_thisSensorNr"
# fetch next sensor
_thisSensorNr=$(($_thisSensorNr+1))
_snmpget=`snmpGet $hostAddr $SENS_UNIT_OID$_thisSensorNr`
_nextSensorExits=$?
# are we done?
if [ $_nextSensorExits -ne 0 ]; then
break
fi
_unit=`echo "$_snmpget" |cut -d" " -f 4`
done
}
# sanitize (<string>)
# use bash builtin substitutions to sanitize string
#+ allowed chars are: a-z,A-Z,0-9 and "."
#+ if chars have been removed return 1, else return 0
sanitize () {
input="$1"
sanitizedInput="${1//[^a-zA-Z0-9.]/}"
echo "$sanitizedInput"
if [ "$input" = "$sanitizedInput" ]; then
return 0
else
return 1
fi
}
# usage ()
# print usage
usage () {
echo "usage: snmp_<host>_poseidon-sensors [config|snmpconf]" 1>&2
exit $E_USAGE
}
# err (ErrorMsg, Exitcode)
# basic error handling
err () {
if [ $# -eq 2 -a "$2" -lt 256 ]; then
_errorMsg="$1"
_exitCode="$2"
else
_errorMsg="Fatal: An unknown error occurred! Exiting..."
_exitCode="$E_UNKNOWN"
fi
# print error message to STDERR ...
echo "$_errorMsg" >&2
# ... and exit with error code.
exit $_exitCode
}
#==============================================================================#
# SNMP Config
MIBS=":" # we don't use any configured MIBs so we don't
#+ have to deal with errors in the MIBs
if [ -z $SNMPVERSION ]; then
SNMPVERSION="1" # as of firmware 3.1.5 only SNMPv1 is supported
fi
if [ -z $SNMPCOMMUNITY ]; then
SNMPCOMMUNITY="public" # SNMP community string to read from the device
fi
# handle -h option
while getopts ":h" opt; do
case $opt in
h) usage
;;
\?) echo "Invalid option: -$OPTARG" >&2
usage
;;
esac
done
# check for snmpget binary
if [ ! -x `which snmpget` ]; then
err "Fatal: unable to locate \'snmpget\'! Exiting..." $E_COMMANDNOTFOUND
fi
# extract pluginname ...
myName="`basename "$0" | cut -d "_" -f 1,3`"
# ...and hostname
hostAddr="`basename "$0" | cut -d "_" -f 2`"
if [ "$myName" = "snmp_poseidon-sensors" ]; then
hostAddr=`sanitize $hostAddr || err \
"Fatal: Invalid argument \"$hostAddr\"! Exiting..." $E_ARG`
if [ -z "$hostAddr" ]; then
usage munin
fi
getAvailableSensorsByType
if [ "$1" = "config" ]; then
printMuninConfig
exit $E_OK
elif [ "$1" = "snmpconfig" ]; then
printMuninSnmpConfig
exit $E_OK
else
printMuninStatus
exit $E_OK
fi
else
usage
fi

View file

@ -1,240 +0,0 @@
#!/usr/bin/perl -w
=head1 NAME
Munin plugin snmp__sentry is written to monitor the Sentry line of Power Distribution Units (PDU) offered by Server Technology.
This plugin currently assumes a 3-phase PDU.
=head1 AUTHOR
Danny Howard <dannyman@toldme.com>
This plugin was created on the behalf of Quantifind, Inc. http://www.quantifind.com
=head1 LICENSE
BSD
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 EXAMPLE MIB
$ wget ftp://ftp.servertech.com/pub/SNMP/sentry3/Sentry3.mib
$ snmpwalk -c public -v 2c -M +. -m +Sentry3-MIB 192.168.whatevs .1.3.6.1.4.1.1718.3.2.2
Sentry3-MIB::infeedID.1.1 = STRING: AA
Sentry3-MIB::infeedID.1.2 = STRING: AB
Sentry3-MIB::infeedID.1.3 = STRING: AC
Sentry3-MIB::infeedName.1.1 = STRING: Master_X
Sentry3-MIB::infeedName.1.2 = STRING: Master_Y
Sentry3-MIB::infeedName.1.3 = STRING: Master_Z
Sentry3-MIB::infeedCapabilities.1.1 = BITS: C6 00 onSense(0) loadSense(1) voltageSense(5) powerSense(6)
Sentry3-MIB::infeedCapabilities.1.2 = BITS: C6 00 onSense(0) loadSense(1) voltageSense(5) powerSense(6)
Sentry3-MIB::infeedCapabilities.1.3 = BITS: C6 00 onSense(0) loadSense(1) voltageSense(5) powerSense(6)
Sentry3-MIB::infeedStatus.1.1 = INTEGER: on(1)
Sentry3-MIB::infeedStatus.1.2 = INTEGER: on(1)
Sentry3-MIB::infeedStatus.1.3 = INTEGER: on(1)
Sentry3-MIB::infeedLoadStatus.1.1 = INTEGER: normal(0)
Sentry3-MIB::infeedLoadStatus.1.2 = INTEGER: normal(0)
Sentry3-MIB::infeedLoadStatus.1.3 = INTEGER: normal(0)
Sentry3-MIB::infeedLoadValue.1.1 = INTEGER: 717 hundredth Amps
Sentry3-MIB::infeedLoadValue.1.2 = INTEGER: 708 hundredth Amps
Sentry3-MIB::infeedLoadValue.1.3 = INTEGER: 787 hundredth Amps
Sentry3-MIB::infeedLoadHighThresh.1.1 = INTEGER: 16 Amps
Sentry3-MIB::infeedLoadHighThresh.1.2 = INTEGER: 16 Amps
Sentry3-MIB::infeedLoadHighThresh.1.3 = INTEGER: 16 Amps
Sentry3-MIB::infeedOutletCount.1.1 = INTEGER: 10
Sentry3-MIB::infeedOutletCount.1.2 = INTEGER: 10
Sentry3-MIB::infeedOutletCount.1.3 = INTEGER: 10
Sentry3-MIB::infeedCapacity.1.1 = INTEGER: 20 Amps
Sentry3-MIB::infeedCapacity.1.2 = INTEGER: 20 Amps
Sentry3-MIB::infeedCapacity.1.3 = INTEGER: 20 Amps
Sentry3-MIB::infeedVoltage.1.1 = INTEGER: 2055 tenth Volts
Sentry3-MIB::infeedVoltage.1.2 = INTEGER: 2034 tenth Volts
Sentry3-MIB::infeedVoltage.1.3 = INTEGER: 2052 tenth Volts
Sentry3-MIB::infeedPower.1.1 = INTEGER: 726 Watts
Sentry3-MIB::infeedPower.1.2 = INTEGER: 809 Watts
Sentry3-MIB::infeedPower.1.3 = INTEGER: 874 Watts
Sentry3-MIB::infeedApparentPower.1.1 = INTEGER: 793 Volt-Amps
Sentry3-MIB::infeedApparentPower.1.2 = INTEGER: 876 Volt-Amps
Sentry3-MIB::infeedApparentPower.1.3 = INTEGER: 941 Volt-Amps
Sentry3-MIB::infeedPowerFactor.1.1 = INTEGER: 92 hundredths
Sentry3-MIB::infeedPowerFactor.1.2 = INTEGER: 92 hundredths
Sentry3-MIB::infeedPowerFactor.1.3 = INTEGER: 93 hundredths
Sentry3-MIB::infeedCrestFactor.1.1 = INTEGER: 18 tenths
Sentry3-MIB::infeedCrestFactor.1.2 = INTEGER: 17 tenths
Sentry3-MIB::infeedCrestFactor.1.3 = INTEGER: 17 tenths
Sentry3-MIB::infeedEnergy.1.1 = INTEGER: 762 tenth Kilowatt-Hours
Sentry3-MIB::infeedEnergy.1.2 = INTEGER: 913 tenth Kilowatt-Hours
Sentry3-MIB::infeedEnergy.1.3 = INTEGER: 928 tenth Kilowatt-Hours
Sentry3-MIB::infeedReactance.1.1 = INTEGER: capacitive(1)
Sentry3-MIB::infeedReactance.1.2 = INTEGER: capacitive(1)
Sentry3-MIB::infeedReactance.1.3 = INTEGER: capacitive(1)
Sentry3-MIB::infeedPhaseVoltage.1.1 = INTEGER: 2055 tenth Volts
Sentry3-MIB::infeedPhaseVoltage.1.2 = INTEGER: 2034 tenth Volts
Sentry3-MIB::infeedPhaseVoltage.1.3 = INTEGER: 2052 tenth Volts
Sentry3-MIB::infeedPhaseCurrent.1.1 = INTEGER: 386 hundredth Amps
Sentry3-MIB::infeedPhaseCurrent.1.2 = INTEGER: 431 hundredth Amps
Sentry3-MIB::infeedPhaseCurrent.1.3 = INTEGER: 459 hundredth Amps
Sentry3-MIB::infeedCapacityUsed.1.1 = INTEGER: 358 tenth percentage
Sentry3-MIB::infeedCapacityUsed.1.2 = INTEGER: 354 tenth percentage
Sentry3-MIB::infeedCapacityUsed.1.3 = INTEGER: 393 tenth percentage
Sentry3-MIB::infeedLineID.1.1 = STRING: A:X
Sentry3-MIB::infeedLineID.1.2 = STRING: A:Y
Sentry3-MIB::infeedLineID.1.3 = STRING: A:Z
Sentry3-MIB::infeedLineToLineID.1.1 = STRING: A:X-Y
Sentry3-MIB::infeedLineToLineID.1.2 = STRING: A:Y-Z
Sentry3-MIB::infeedLineToLineID.1.3 = STRING: A:Z-X
Sentry3-MIB::infeedPhaseID.1.1 = STRING: A:X-Y
Sentry3-MIB::infeedPhaseID.1.2 = STRING: A:Y-Z
Sentry3-MIB::infeedPhaseID.1.3 = STRING: A:Z-X
=cut
use strict;
use Munin::Plugin::SNMP;
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
print "require 1.3.6.1.4.1.1718.3.2.2.1\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session(-translate =>
[ -timeticks => 0x0 ]);
my $sentry_h = $session->get_hash (
-baseoid => ".1.3.6.1.4.1.1718.3.2.2.1",
-cols => {
# maxcols 16 I guess
# 2 => 'infeedID',
3 => 'infeedName',
# 4 => 'infeedCapabilities',
# 5 => 'infeedStatus',
# 6 => 'infeedLoadStatus',
7 => 'infeedLoadValue',
8 => 'infeedLoadHighThresh',
# 9 => 'infeedOutletCount',
10 => 'infeedCapacity',
# 11 => 'infeedVoltage',
# 12 => 'infeedPower',
# 13 => 'infeedApparentPower',
14 => 'infeedPowerFactor',
15 => 'infeedCrestFactor',
# 16 => 'infeedEnergy',
# 17 => 'infeedReactance',
# 18 => 'infeedPhaseVoltage',
# 19 => 'infeedPhaseCurrent',
# 20 => 'infeedCapacityUsed',
# 21 => 'infeedLineID',
# 22 => 'infeedLineToLineID',
# 23 => 'infeedPhaseID',
}
);
if (defined $ARGV[0] and $ARGV[0] eq "config") {
my ($host) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "
multigraph power_amps_drawn
graph_title Power Draw in Amps
graph_args --lower-limit 0
graph_vlabel Amps
graph_category sensors
graph_scale no
graph_info This shows the amperage drawn on your PDU. Per NEC, a PDU should not sustain 80% of its maximum circuit capacity for more than three hours.
";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
my $critical = ($sentry_h->{$k}->{'infeedCapacity'})*.9; # 90% of capacity
my $warning = $sentry_h->{$k}->{'infeedLoadHighThresh'}; # 80% of capacity
print "$infeedName.critical $critical\n";
print "$infeedName.draw LINE1\n";
print "$infeedName.label $infeedName\n";
print "$infeedName.min 0\n";
print "$infeedName.type GAUGE\n";
print "$infeedName.warning $warning\n";
}
print "
multigraph power_power_factor
graph_title Power Factor
graph_args --lower-limit 0
graph_vlabel Power Factor
graph_category sensors
graph_scale no
graph_info Power factor represents the efficiency of the components connected to the circuit. Power factor declines as components age, increasing the overall load on the circuit.
";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
print "$infeedName.draw LINE1\n";
print "$infeedName.label $infeedName\n";
print "$infeedName.type GAUGE\n";
}
print "
multigraph power_crest_factor
graph_title Crest Factor
graph_args --lower-limit 0
graph_vlabel Crest Factor
graph_category sensors
graph_scale no
graph_info Crest factor relates the peak value of a signal to its root mean square value. For three-phase AC, a crest factor of 1.732 is expected. Low crest factor may indicate UPS overclipping and crest factors over 5 degrade monitoring accuracy.
";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
print "$infeedName.draw LINE1\n";
print "$infeedName.label $infeedName\n";
print "$infeedName.type GAUGE\n";
}
exit 0;
}
print "multigraph power_amps_drawn\n";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
my $amps = $sentry_h->{$k}->{'infeedLoadValue'};
if ( $amps ) {
$amps = $amps * .01;
} else {
$amps = 'U';
}
print "$infeedName.value $amps\n";
}
print "multigraph power_power_factor\n";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
my $pf = $sentry_h->{$k}->{'infeedPowerFactor'};
if ( $pf ) {
$pf = $pf * .01;
} else {
$pf = 'U';
}
print "$infeedName.value $pf\n";
}
print "multigraph power_crest_factor\n";
foreach my $k ( keys %{$sentry_h} ) {
my $infeedName = $sentry_h->{$k}->{'infeedName'};
my $crest = $sentry_h->{$k}->{'infeedCrestFactor'};
if ( $crest ) {
$crest = $crest * .1;
} else {
$crest = 'U';
}
print "$infeedName.value $crest\n";
}

View file

@ -1,112 +0,0 @@
#!/usr/bin/perl
# -*- perl -*-
#
# snmp__sfsnmp_fan - Munin plugin for measuring fan on a windowssystem running SpeedFan and sfsnmp
# Copyright (C) 2010 Nils Henrik Tvetene
#
# Author: Nils Henrik Tvetene <nils@tvetene.net>
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
snmp__sfsnmp_fan - Munin plugin for measuring fanspeed on a windowssystem running SpeedFan and sfsnmp
=head1 APPLICABLE SYSTEMS
Windows-system running SpeedFan and the sfsnmp extension
=head1 CONFIGURATION
Example config:
[snmp_twinspark_sfsnmp_*]
env.fan1 CPU
env.fan7.ignore true
Plugin is linked using hostname of monitored system:
ln -s /usr/share/munin/plugins/snmp__sfsnmp_fan /etc/munin/plugins/snmp_<hostname>_sfsnmp_fan
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 AUTHOR
Nils Henrik Tvetene <nils@tvetene.net>
=head1 LICENSE
GPLv2
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
# OIDs used
# 1.3.6.1.4.1.30503.1.1.2 number of fans
# 1.3.6.1.4.1.30503.1.3.x where x is 1 => above number
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
print "number 1.3.6.1.4.1.30503.1.1.2\n";
print "index 1.3.6.1.4.1.30503.1.3.\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
my ($idx, $numFans, @fan, @label);
$numFans = $session->get_single('1.3.6.1.4.1.30503.1.1.2');
if (defined $ARGV[0] and $ARGV[0] eq "config") {
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host fan\n";
print "graph_args --base 1000 --lower-limit 1000\n";
print "graph_scale no\n";
print "graph_printf %3.0lf\n";
print "graph_vlabel fan RPM\n";
print "graph_category sensors\n";
print "graph_info This graph shows the fans on host $host\n";
foreach $idx ( 0..$numFans-1 ) {
$label[$idx] = exists $ENV{"fan".($idx+1)} ? $ENV{"fan".($idx+1)} : "fan".($idx+1);
print "fan".($idx+1).".info ".$label[$idx]." fan in RPM's.\n";
print "fan".($idx+1).".graph no\n" if exists $ENV{"fan".($idx+1).".ignore"};
print "fan".($idx+1).".type GAUGE\n";
print "fan".($idx+1).".label $label[$idx]\n";
print "fan".($idx+1).".min 1000\n";
}
exit 0;
}
foreach $idx ( 0..$numFans-1 ) {
$fan[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.3.'.($idx+1));
print "fan".($idx+1).".value $fan[$idx]\n";
}
exit 0;
__END__

View file

@ -1,111 +0,0 @@
#!/usr/bin/perl
# -*- perl -*-
#
# snmp__sfsnmp_temp - Munin plugin for measuring temperatures on a windowssystem running SpeedFan and sfsnmp
# Copyright (C) 2010 Nils Henrik Tvetene
#
# Author: Nils Henrik Tvetene <nils@tvetene.net>
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
snmp__sfsnmp_temp - Munin plugin for measuring temperatures on a windowssystem running SpeedFan and sfsnmp
=head1 APPLICABLE SYSTEMS
Windows-system running SpeedFan and the sfsnmp extension
=head1 CONFIGURATION
Example config:
[snmp_twinspark_sfsnmp_temp]
env.temp1 System
env.temp7.ignore true
Plugin is linked using hostname of monitored system:
ln -s /usr/share/munin/plugins/snmp__sfsnmp_temp /etc/munin/plugins/snmp_<hostname>_sfsnmp_temp
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 AUTHOR
Nils Henrik Tvetene <nils@tvetene.net>
=head1 LICENSE
GPLv2
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
# OIDs used
# 1.3.6.1.4.1.30503.1.1.1 number of temperatures
# 1.3.6.1.4.1.30503.1.2.x where x is 1 => above number
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
print "number 1.3.6.1.4.1.30503.1.1.1\n";
print "index 1.3.6.1.4.1.30503.1.2.\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
my ($idx, $numTemps, @temp, @label);
$numTemps = $session->get_single('1.3.6.1.4.1.30503.1.1.1');
if (defined $ARGV[0] and $ARGV[0] eq "config") {
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host temperatures\n";
print "graph_args --base 1000 --lower-limit 30\n";
print "graph_vlabel degrees Celsius\n";
print "graph_category sensors\n";
print "graph_info This graph shows the temperatures on host $host\n";
foreach $idx ( 0..$numTemps-1 ) {
$label[$idx] = exists $ENV{"temp".($idx+1)} ? $ENV{"temp".($idx+1)} : "temp".($idx+1);
print "temp".($idx+1).".info ".$label[$idx]." temperature in Celsius.\n";
print "temp".($idx+1).".graph no\n" if exists $ENV{"temp".($idx+1).".ignore"};
print "temp".($idx+1).".type GAUGE\n";
print "temp".($idx+1).".label $label[$idx]\n";
print "temp".($idx+1).".cdef temp".($idx+1).",100,/\n";
print "temp".($idx+1).".min 30\n";
}
exit 0;
}
foreach $idx ( 0..$numTemps-1 ) {
$temp[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.2.'.($idx+1));
print "temp".($idx+1).".value $temp[$idx]\n";
}
exit 0;
__END__

View file

@ -1,112 +0,0 @@
#!/usr/bin/perl
# -*- perl -*-
#
# snmp__sfsnmp_volt - Munin plugin for measuring volt on a windowssystem running SpeedFan and sfsnmp
# Copyright (C) 2010 Nils Henrik Tvetene
#
# Author: Nils Henrik Tvetene <nils@tvetene.net>
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
snmp__sfsnmp_volt - Munin plugin for measuring volts on a windowssystem running SpeedFan and sfsnmp
=head1 APPLICABLE SYSTEMS
Windows-system running SpeedFan and the sfsnmp extension
=head1 CONFIGURATION
Example config:
[snmp_twinspark_sfsnmp_*]
env.volt1 Vcore
env.volt3.ignore true
Plugin is linked using hostname of monitored system:
ln -s /usr/share/munin/plugins/snmp__sfsnmp_volt /etc/munin/plugins/snmp_<hostname>_sfsnmp_volt
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 AUTHOR
Nils Henrik Tvetene <nils@tvetene.net>
=head1 LICENSE
GPLv2
=cut
use strict;
use warnings;
use Munin::Plugin::SNMP;
use vars qw($DEBUG);
$DEBUG = $ENV{'MUNIN_DEBUG'};
# OIDs used
# 1.3.6.1.4.1.30503.1.1.3 number of voltages
# 1.3.6.1.4.1.30503.1.4.x where x is 1 => above number
if (defined $ARGV[0] and $ARGV[0] eq 'snmpconf') {
print "number 1.3.6.1.4.1.30503.1.1.3\n";
print "index 1.3.6.1.4.1.30503.1.4.\n";
exit 0;
}
my $session = Munin::Plugin::SNMP->session();
my ($host, undef, undef, undef) = Munin::Plugin::SNMP->config_session();
my ($idx, $numVolts, @volt, @label);
$numVolts = $session->get_single('1.3.6.1.4.1.30503.1.1.3');
if (defined $ARGV[0] and $ARGV[0] eq "config") {
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title $host volt\n";
print "graph_args --base 1000 --lower-limit 0 --upper-limit 13\n";
print "graph_scale no\n";
print "graph_vlabel Volt\n";
print "graph_category sensors\n";
print "graph_info This graph shows the volt on host $host\n";
foreach $idx ( 0..$numVolts-1 ) {
$label[$idx] = exists $ENV{"volt".($idx+1)} ? $ENV{"volt".($idx+1)} : "volt".($idx+1);
print "volt".($idx+1).".info ".$label[$idx]." volt in Celsius.\n";
print "volt".($idx+1).".graph no\n" if exists $ENV{"volt".($idx+1).".ignore"};
print "volt".($idx+1).".type GAUGE\n";
print "volt".($idx+1).".label $label[$idx]\n";
print "volt".($idx+1).".cdef volt".($idx+1).",100,/\n";
print "volt".($idx+1).".min 30\n";
}
exit 0;
}
foreach $idx ( 0..$numVolts-1 ) {
$volt[$idx] = $session->get_single('1.3.6.1.4.1.30503.1.4.'.($idx+1));
print "volt".($idx+1).".value $volt[$idx]\n";
}
exit 0;
__END__