mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
- have some dirs
This commit is contained in:
parent
0b089ea777
commit
08346aac58
687 changed files with 0 additions and 0 deletions
70
plugins/sensors/acpi-battery
Executable file
70
plugins/sensors/acpi-battery
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to graph battery capacity.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# acpi - Override path to acpi program
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.1 2007/03/14 19:52:10 anarcat
|
||||
# ACPI-Battery plugin, framework copied from acpi plugin
|
||||
#
|
||||
#
|
||||
# Expected content of /proc/acpi/battery/BAT0/info:
|
||||
# present: yes
|
||||
# design capacity: 47520 mWh
|
||||
# last full capacity: 37650 mWh
|
||||
# battery technology: rechargeable
|
||||
# design voltage: 10800 mV
|
||||
# design capacity warning: 2376 mWh
|
||||
# design capacity low: 475 mWh
|
||||
# capacity granularity 1: 1 mWh
|
||||
# capacity granularity 2: 1 mWh
|
||||
# model number: IBM-08K8039
|
||||
# serial number: 155
|
||||
# battery type: LION
|
||||
# OEM info: Panasonic
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if grep -q 'present.*yes' /proc/acpi/battery/*/info > /dev/null 2>&1; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (battery not detected)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
cd /proc/acpi/battery
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Battery power'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel power in' `awk '/remaining capacity:/ { print $NF }' /proc/acpi/battery/*/state`
|
||||
echo 'graph_category sensors'
|
||||
echo 'graph_info This graph shows battery power based on output from ACPI.'
|
||||
i=0
|
||||
for battery in *
|
||||
do
|
||||
echo $battery.label $battery
|
||||
echo $battery.info Battery $i
|
||||
i=$(($i+1))
|
||||
# design capacity warning: 2376 mWh
|
||||
# design capacity low: 475 mWh
|
||||
echo $battery.warning `awk '/design capacity warning:/ { print $4 }' $battery/info`
|
||||
echo $battery.critical `awk '/design capacity low:/ { print $4 }' $battery/info`
|
||||
|
||||
echo ${battery}_full.label $battery capacity
|
||||
echo ${battery}_full.info last full capacity \(design capacity: `awk '/design capacity:/ { print $3 " " $4 }' $battery/info`\)
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for battery in *
|
||||
do
|
||||
echo $battery.value `awk '/remaining capacity:/ { print $3 }' $battery/state`
|
||||
echo ${battery}_full.value `awk '/last full capacity:/ { print $4 }' $battery/info`
|
||||
done
|
42
plugins/sensors/cleware
Executable file
42
plugins/sensors/cleware
Executable file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Written by Lars Falk-Petersen, cleware@falk-petersen.no
|
||||
# Version 0.3. To be used with http://www.vanheusden.com/clewarecontrol/
|
||||
# Clewarecontrol device serial must be set in config file:
|
||||
|
||||
# #Put the following lines in /etc/munin/plugin-conf.d/cleware
|
||||
# [cleware*]
|
||||
# #device serial. find it by running: clewarecontrol -l
|
||||
# env.serial 7778
|
||||
# #path of clewarecontrol
|
||||
# env.bin /usr/bin/clewarecontrol
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_title Temperature And Humidity
|
||||
graph_vlabel C / %
|
||||
graph_category sensors
|
||||
temp.label Temperature
|
||||
hum.label Humidity
|
||||
graph_order temp hum
|
||||
graph_args --base 1000
|
||||
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
[ ! $bin ] && bin="clewarecontrol"
|
||||
if [ ! $serial ]; then
|
||||
echo "Serial not set! Hint: Read the top of this script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$bin -c 1 -ag > /dev/null 2>&1
|
||||
|
||||
echo -n "temp.value "
|
||||
$bin -d $serial -b -c 1 -rt
|
||||
|
||||
echo -n "hum.value "
|
||||
$bin -d $serial -b -c 1 -rh
|
||||
|
32
plugins/sensors/coretemp
Executable file
32
plugins/sensors/coretemp
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor cpu temperatures through FreeBSD's CORETEMP(4).
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#%# family=contrib
|
||||
|
||||
SYSCTL=/sbin/sysctl
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
${SYSCTL} dev.cpu.0.temperature 2>&1 >/dev/null
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title CPU temperature'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
${SYSCTL} dev.cpu | grep temperature | awk -F'.' '{ print "CPU"$3"TEMP.label CPUTEMP"$3}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
${SYSCTL} dev.cpu | grep temperature | sed 's/^dev\.cpu\.\([[:digit:]]\)\.temperature: \([[:digit:]]\)/CPU\1TEMP.value \2/'
|
53
plugins/sensors/cpu_tmp_sensors
Executable file
53
plugins/sensors/cpu_tmp_sensors
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the CPU temperature through lm-sensors.
|
||||
# v1.0 (2008-02-15) Oliver Ladner <oli@lugh.ch>
|
||||
#
|
||||
# Requirements:
|
||||
# - A configured lm-sensors installation
|
||||
# - Supported device (see http://www.lm-sensors.org/wiki/Devices)
|
||||
# - grep, sed and awk
|
||||
#
|
||||
# Todo:
|
||||
# - Ability to monitor multiple sensors like fan speeds, voltage etc.
|
||||
# - Better checks (availabilty of lm-sensors, sensors itself, path names)
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# capabilities=autoconf
|
||||
|
||||
DETECTED_SENSORS=`sensors -U -A | wc -l`
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
cat <<'EOM'
|
||||
graph_title CPU temperature
|
||||
graph_vlabel CPU temperature in °C
|
||||
graph_options light
|
||||
graph_info This graph shows CPU temperature in °C
|
||||
temp.label temp
|
||||
temp.draw LINE1
|
||||
graph_category sensors
|
||||
temp.warning 65
|
||||
temp.critical 80
|
||||
EOM
|
||||
exit 0;;
|
||||
esac
|
||||
|
||||
case $1 in
|
||||
autoconf)
|
||||
if [ "$DETECTED_SENSORS" -eq 0 ]; then
|
||||
echo "no"
|
||||
exit 1
|
||||
else
|
||||
echo "yes"
|
||||
exit 0
|
||||
fi
|
||||
esac
|
||||
|
||||
echo -n "temp.value "
|
||||
sensors | grep 'CPU Temp' | sed 's/[+|°|C]//g' | awk {'print $3'}
|
40
plugins/sensors/cputemp
Executable file
40
plugins/sensors/cputemp
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to graph temperatures based on info from /sys/devices/platform/coretemp.*
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -d /sys/devices/platform/coretemp.0 ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (/sys/devices/platform/coretemp.* not there)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title CPU temperature'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
echo 'graph_info This graph shows temperatures based on /sys/devices/platform/coretemp.*/.'
|
||||
echo cputemp.info CPU temperature.
|
||||
for c in /sys/devices/platform/coretemp.*; do
|
||||
core=${c#/sys/devices/platform/coretemp.}
|
||||
label=`cat $c/temp1_label`
|
||||
echo core${core}.label $label
|
||||
done
|
||||
fi
|
||||
|
||||
for c in /sys/devices/platform/coretemp.*; do
|
||||
core=${c#/sys/devices/platform/coretemp.}
|
||||
temp=$((`cat $c/temp1_input` / 1000))
|
||||
echo core${core}.value $temp
|
||||
done
|
163
plugins/sensors/esxi__sensors
Executable file
163
plugins/sensors/esxi__sensors
Executable file
|
@ -0,0 +1,163 @@
|
|||
#!/usr/bin/env python
|
||||
# coding=iso-8859-1
|
||||
|
||||
"""
|
||||
=head1 NAME
|
||||
|
||||
esxi__sensors - Munin plugin to monitor hardware sensors in a VMware ESXi
|
||||
installation.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
VMware ESX and ESXi systems. Might work with other systems that use CIM and
|
||||
CIM_NumericSensors, probably with changes to the namespace.
|
||||
|
||||
The host on which the plugin is run must have the pywbem Python library
|
||||
installed.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
The remote host name is taken from the plugin name as the SNMP plugins are;
|
||||
to monitor host 192.168.1.15, symlink the plugin to snmp_192.168.1.15_sensors .
|
||||
|
||||
The username and password for accessing the ESXi system must be set in a config
|
||||
file:
|
||||
|
||||
[esxi_192.168.1.15_*]
|
||||
env.user monitor
|
||||
env.pass passw0rd
|
||||
|
||||
In the event that not all sensor types are desired, the plugin can be limited
|
||||
to a subset of the types available:
|
||||
|
||||
env.sensors 2 3 5
|
||||
|
||||
Check the sensor_data dictionary at the top of the script to see what sensor
|
||||
types are available.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
This is a multigraph plugin that will generate separate graphs for each type
|
||||
of sensor. The names of the sensors are taken from the ESXi host.
|
||||
|
||||
If the host provides error thresholds for the sensor readings, those will be
|
||||
passed along to munin.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.0
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Phil Gold <phil_g@pobox.com>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
To the extent possible under law, the author(s) have dedicated all copyright and
|
||||
related and neighboring rights to this software to the public domain worldwide
|
||||
under a CC0 waiver. This software is distributed without any warranty.
|
||||
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
=cut
|
||||
"""
|
||||
|
||||
import os, sys
|
||||
import re, string
|
||||
import pywbem
|
||||
|
||||
NS = 'root/cimv2'
|
||||
|
||||
sensor_data = {
|
||||
2 : {'prefix':'temp', 'title':'Temperatures', 'unit':'°C'},
|
||||
3 : {'prefix':'volt', 'title':'Voltages', 'unit':'Volts'},
|
||||
4 : {'prefix':'amp', 'title':'Current', 'unit':'Amps'},
|
||||
5 : {'prefix':'fan', 'title':'Fans', 'unit':'RPM'}
|
||||
}
|
||||
|
||||
def munin_id(instance):
|
||||
return sensor_data[instance['SensorType']]['prefix'] + \
|
||||
re.sub('[^a-zA-Z0-9]', '_', instance['DeviceId'])
|
||||
|
||||
def inst_val(instance, field):
|
||||
return instance[field] * 10 ** instance['UnitModifier']
|
||||
|
||||
def munin_warning(instance):
|
||||
if not instance['EnabledThresholds']:
|
||||
return ':'
|
||||
|
||||
result = ''
|
||||
if 0 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'LowerThresholdNonCritical'))
|
||||
result += ':'
|
||||
if 1 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'UpperThresholdNonCritical'))
|
||||
return result
|
||||
|
||||
def munin_critical(instance):
|
||||
if not instance['EnabledThresholds']:
|
||||
return ':'
|
||||
|
||||
result = ''
|
||||
if 2 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'LowerThresholdCritical'))
|
||||
elif 4 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'LowerThresholdFatal'))
|
||||
result += ':'
|
||||
if 3 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'UpperThresholdCritical'))
|
||||
elif 5 in instance['EnabledThresholds']:
|
||||
result += str(inst_val(instance, 'UpperThresholdFatal'))
|
||||
return result
|
||||
|
||||
def print_sensors(sensor_type, instances, config):
|
||||
print 'multigraph esxi_' + sensor_data[sensor_type]['prefix'] + 's'
|
||||
|
||||
if config:
|
||||
print "graph_title ESXi " + sensor_data[sensor_type]['title']
|
||||
print "graph_args --base 1000 -l 0"
|
||||
print "graph_vlabel " + sensor_data[sensor_type]['unit']
|
||||
print "graph_category sensors"
|
||||
for i in instances:
|
||||
if i['SensorType'] == sensor_type:
|
||||
print '{0}.label {1}'.format(munin_id(i), i['Caption'])
|
||||
print '{0}.max {1}'.format(munin_id(i), inst_val(i, 'MaxReadable'))
|
||||
print '{0}.min {1}'.format(munin_id(i), inst_val(i, 'MinReadable'))
|
||||
if munin_warning(i) != ':':
|
||||
print '{0}.warning {1}'.format(munin_id(i), munin_warning(i))
|
||||
if munin_critical(i) != ':':
|
||||
print '{0}.critical {1}'.format(munin_id(i), munin_critical(i))
|
||||
|
||||
print ''
|
||||
return
|
||||
|
||||
for i in instances:
|
||||
if i['SensorType'] == sensor_type:
|
||||
print '{0}.value {1}'.format(munin_id(i), inst_val(i, 'CurrentReading'))
|
||||
print ''
|
||||
|
||||
plugin_name = list(os.path.split(sys.argv[0]))[1]
|
||||
host = plugin_name[string.index(plugin_name, '_')+1:string.rindex(plugin_name, '_')]
|
||||
if host == '':
|
||||
sys.stderr.write("No hostname found.\n")
|
||||
exit(1)
|
||||
try:
|
||||
username = os.environ['user']
|
||||
password = os.environ['pass']
|
||||
except KeyError:
|
||||
sys.stderr.write("Username and password must be specified.\n")
|
||||
exit(1)
|
||||
|
||||
try:
|
||||
sensors = map(int, re.split(',? +', os.environ['sensors']))
|
||||
except:
|
||||
sensors = [2, 3, 4, 5]
|
||||
|
||||
config = len(sys.argv) > 1 and sys.argv[1] == 'config'
|
||||
|
||||
wbemclient = pywbem.WBEMConnection('https://' + host, (username, password), NS)
|
||||
insts = sorted(wbemclient.EnumerateInstances('CIM_NumericSensor'))
|
||||
|
||||
print 'host_name ' + host
|
||||
for sensor_type in sensors:
|
||||
print_sensors(sensor_type, insts, config)
|
37
plugins/sensors/fbdimm_temp
Executable file
37
plugins/sensors/fbdimm_temp
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to graph temperatures based on i5k_amb-isa-0000 FB-DIMM sensor
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
SENSORS="/usr/bin/sensors"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# testing if the i5k FB-DIMM sensors are working. (0->working)
|
||||
RETVAL=`$SENSORS -A i5k_amb-isa-0000|grep -q DIMM; echo $?`
|
||||
if [ $RETVAL = 0 ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (i5k FB-DIMM sensors not working.)"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title FB-DIMM temperature'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
echo 'graph_info This graph shows FB-DIMM temperatures based on reports generated by intel 5000 series chipsets.'
|
||||
echo fbdimmtemp.info FB-DIMM temperature.
|
||||
$SENSORS -A i5k_amb-isa-0000|grep DIMM|tr -d ":+"|awk -F "." '{print $2}'|awk '{print "ch"$1"dimm"$3".label Channel "$1" DIMM "$3}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
$SENSORS -A i5k_amb-isa-0000|grep DIMM|tr -d ":+"|awk -F "." '{print $2}'|awk '{print "ch"$1"dimm"$3".value "$4}'
|
226
plugins/sensors/freeipmi_
Executable file
226
plugins/sensors/freeipmi_
Executable file
|
@ -0,0 +1,226 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (C) 2011 Andreas Thienemann <andreas@bawue.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 3 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/>.
|
||||
#
|
||||
|
||||
"""
|
||||
=head1 NAME
|
||||
|
||||
freeipmi_ - Munin plugin to retreive temperature and fan speed measurements
|
||||
from a local machine via IPMI.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
All machines with an IPMI capable baseboard management controller.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
On most supported systems this plugin works nearly out of the box as long as
|
||||
both Python and the freeipmi binaries in a semi-recent version are installed.
|
||||
|
||||
If the machine works out of the box can be tested by calling bmc-info.
|
||||
If there's text output, a bmc card was detected. If there's an entry for
|
||||
"Sensor Device" visible in the "Additional Device Support" entry you're good.
|
||||
|
||||
If you get a "ipmi_cmd_get_device_id: driver timeout" message you have most
|
||||
likely no bmc to query.
|
||||
|
||||
In certain cases however bmc-info will just seem to hang for quite some time.
|
||||
In this case, autodetection does not work because the smbios table has
|
||||
incorrect information. One system know to experience this problem is the
|
||||
HP Proliant Microserver.
|
||||
|
||||
Adding env.freeipmi_args "--no-probing --driver-type=KCS --driver-address=0xca2 --register-spacing=1"
|
||||
to the munin plugin configuration will make the plugin work.
|
||||
|
||||
Basic configuration for every system is that the plugin needs to be called as root.
|
||||
|
||||
Add the following to your /etc/munin/plugin-conf.d/freeipmi:
|
||||
|
||||
[freeipmi_*]
|
||||
user root
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin shows the temperature in Celsius or the fanspeed in rotations per minute.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
0.0.1
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
Only local support for now. Remote could be hacked in via freeipmi_args for now.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv3+
|
||||
|
||||
=cut
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import pprint
|
||||
|
||||
# Parse some environment variables
|
||||
if os.getenv("freeipmi_args") is not None:
|
||||
freeipmi_args = " %s" % (os.getenv("freeipmi_args"))
|
||||
else:
|
||||
freeipmi_args = ""
|
||||
|
||||
# We are a wildcard plugin, figure out whether we are called for temp or fan
|
||||
if sys.argv[0].split("_")[1] == "temp":
|
||||
mode = "Temperature"
|
||||
elif sys.argv[0].split("_")[1] == "fan":
|
||||
mode = "Fan"
|
||||
else:
|
||||
mode = None
|
||||
|
||||
def whereis(prog):
|
||||
"""Check if prog can be found in the path and if yes, return the full pathname"""
|
||||
prog = os.path.basename(prog)
|
||||
for dir in os.getenv("PATH").split(":"):
|
||||
for root, dirs, files in os.walk(dir):
|
||||
if prog in files:
|
||||
return os.path.join(dir, prog)
|
||||
return None
|
||||
|
||||
def normalize_sensor(name):
|
||||
name = name.lower().replace("-","M").replace("+","P")
|
||||
name = re.sub("[^a-z0-9A-Z]","_", name)
|
||||
return name
|
||||
|
||||
# Code sniplet from Philipp Keller
|
||||
# http://code.pui.ch/2007/02/19/set-timeout-for-a-shell-command-in-python/
|
||||
def timeout_command(command, timeout):
|
||||
"""call shell-command and either return its output or kill it
|
||||
if it doesn't normally exit within timeout seconds and return None"""
|
||||
import subprocess, datetime, os, time, signal
|
||||
start = datetime.datetime.now()
|
||||
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
while process.poll() is None:
|
||||
time.sleep(0.1)
|
||||
now = datetime.datetime.now()
|
||||
if (now - start).seconds> timeout:
|
||||
os.kill(process.pid, signal.SIGKILL)
|
||||
os.waitpid(-1, os.WNOHANG)
|
||||
return None
|
||||
return process.stdout.read()
|
||||
|
||||
def bmc_detect():
|
||||
"""Check whether there's a baseboard management controller we can query."""
|
||||
if whereis("bmc-info") is None:
|
||||
print "no (bmc-info not found in path. Please install FreeIPMI.)"
|
||||
sys.exit(0)
|
||||
else:
|
||||
out = timeout_command("bmc-info%s" % (freeipmi_args), 2)
|
||||
if out is not None and "[Sensor Device]" in out:
|
||||
print "yes"
|
||||
sys.exit(0)
|
||||
else:
|
||||
print "no (no supported bmc found)"
|
||||
sys.exit(0)
|
||||
|
||||
def read_sensors():
|
||||
"""Return all sensor data as a dict"""
|
||||
out = timeout_command("ipmi-sensors --verbose%s" % (freeipmi_args), 2)
|
||||
sensors = dict()
|
||||
sensor = dict()
|
||||
sensor_id = None
|
||||
for line in out.split("\n"):
|
||||
if ":" in line:
|
||||
k,v = line.split(": ")
|
||||
if k == "Record ID":
|
||||
sensor = dict()
|
||||
sensor_id = int(v)
|
||||
sensor[k] = v
|
||||
else:
|
||||
sensor[k] = v
|
||||
else:
|
||||
sensors[sensor_id] = sensor
|
||||
return sensors
|
||||
|
||||
def print_config():
|
||||
"""Return configuration arguments for munin"""
|
||||
print "graph_title FreeIPMI Sensors: %s" % (mode)
|
||||
if mode == "Fan":
|
||||
print "graph_vlabel RPM"
|
||||
print "graph_info This graph shows the RPMs of the fans as reported by IPMI"
|
||||
elif mode == "Temperature":
|
||||
print "graph_vlabel Degrees C"
|
||||
print "graph_info This graph shows the temperatures as reported by IPMI"
|
||||
print "graph_category sensors"
|
||||
sensors = read_sensors()
|
||||
|
||||
for id in sorted(sensors):
|
||||
if sensors[id]["Group Name"] == mode:
|
||||
label = normalize_sensor(sensors[id]["Sensor Name"])
|
||||
for n in ["Normal Max.", "Normal Min.", "Sensor Reading", "Lower Critical Threshold", "Upper Critical Threshold", "Lower Non-Critical Threshold", "Upper Non-Critical Threshold"]:
|
||||
sensors[id][n] = sensors[id][n].replace("NA","")
|
||||
sensors[id][n] = sensors[id][n].split('.')[0]
|
||||
|
||||
print "%s.label %s" % (label, label)
|
||||
print "%s.warning %s:%s" % (label, sensors[id]["Lower Non-Critical Threshold"], sensors[id]["Upper Non-Critical Threshold"])
|
||||
print "%s.critical %s:%s" % (label, sensors[id]["Lower Critical Threshold"], sensors[id]["Upper Critical Threshold"])
|
||||
print "%s.graph_args --base 1000 -l 0" % (label)
|
||||
print "%s.graph_scale no" % (label)
|
||||
# pprint.pprint(sensors[id])
|
||||
sys.exit(0)
|
||||
|
||||
def fetch():
|
||||
sensors = read_sensors()
|
||||
|
||||
for id in sorted(sensors):
|
||||
if sensors[id]["Group Name"] == mode:
|
||||
label = normalize_sensor(sensors[id]["Sensor Name"])
|
||||
print "%s.value %s" % (label, sensors[id]["Sensor Reading"].split(".")[0])
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if "config" in sys.argv[1:]:
|
||||
print_config()
|
||||
|
||||
elif "autoconf" in sys.argv[1:]:
|
||||
bmc_detect()
|
||||
|
||||
elif "suggest" in sys.argv[1:]:
|
||||
sensors = read_sensors()
|
||||
fan, temperature = [0, 0]
|
||||
for id in sensors:
|
||||
if sensors[id]["Group Name"] == "Fan":
|
||||
fan += 1
|
||||
elif sensors[id]["Group Name"] == "Temperature":
|
||||
temperature += 1
|
||||
if fan > 0:
|
||||
print "fan"
|
||||
if temperature > 0:
|
||||
print "temp"
|
||||
sys.exit(0)
|
||||
|
||||
else:
|
||||
fetch()
|
62
plugins/sensors/hddtemp
Executable file
62
plugins/sensors/hddtemp
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor harddrive temperatures through SMART.
|
||||
#
|
||||
# This plugin is an alternative to hddtemp_smartctl, which is
|
||||
# the preferred one.
|
||||
#
|
||||
# client-conf.d/-options:
|
||||
#
|
||||
# drives -- List drives to monitor. E.g. "hda hdc".
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.4.2.1 2005/01/25 21:00:01 jimmyo
|
||||
# Added plugin generic/hddtemp_smartctl, made by Lupe Christoph. Made it the default hddtemp plugin.
|
||||
#
|
||||
# Revision 1.4 2004/11/10 16:00:39 jimmyo
|
||||
# Applied patch from Nicolas Stransky to generic/hddtemp, to fetch temp more elegantly (SF#1052845).
|
||||
#
|
||||
# Revision 1.3 2004/05/20 19:02:36 jimmyo
|
||||
# Set categories on a bunch of plugins
|
||||
#
|
||||
# Revision 1.2 2004/01/29 19:39:00 jimmyo
|
||||
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.2 2003/12/18 19:16:00 jimmyo
|
||||
# Changes from Alexandre
|
||||
#
|
||||
# Revision 1.1 2003/12/18 19:04:37 jimmyo
|
||||
# New plugin: Alexandre Dupouy contributed "hddtemp".
|
||||
#
|
||||
#
|
||||
#%# family=contrib
|
||||
|
||||
hddtemp=${hddtemp:-/usr/sbin/hddtemp}
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x "$hddtemp" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title HDD temperature'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
for a in $drives ; do echo $a.label $a `$hddtemp -q /dev/$a | cut -d: -f 2` ; done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for a in $drives ; do printf "$a.value $($hddtemp -n -q /dev/$a)\n" ; done
|
249
plugins/sensors/hddtemp_smartctl
Executable file
249
plugins/sensors/hddtemp_smartctl
Executable file
|
@ -0,0 +1,249 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
hddtemp_smartctl - Plugin to monitor harddrive temperatures through
|
||||
SMART
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This plugin needs to run as root or some other user that has access to
|
||||
the harddrive devices.
|
||||
|
||||
The following environment variables are used
|
||||
|
||||
smartctl - path to smartctl executable
|
||||
drives - List drives to monitor. E.g. "env.drives hda hdc".
|
||||
type_$dev - device type for one drive, e.g. "env.type_sda 3ware,0"
|
||||
or more typically "env.type_sda ata" if sda is a SATA disk.
|
||||
args_$dev - additional arguments to smartctl for one drive,
|
||||
e.g. "env.args_hda -v 194,10xCelsius". Use this to make
|
||||
the plugin use the --all or -a option if your disk will
|
||||
not return its temperature when only the -A option is
|
||||
used.
|
||||
dev_$dev - monitoring device for one drive, e.g. twe0
|
||||
|
||||
If the "smartctl" enviroment variable is not set the plugin will
|
||||
search your $PATH, /usr/bin, /usr/sbin, /usr/local/bin and
|
||||
/usr/local/sbin for a file called "smartctl", and use that.
|
||||
|
||||
If the "drives" environment variable is not set, the plugin will
|
||||
attempt to search for drives to probe.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (c) 2005, Lutz Peter Christoph
|
||||
All rights reserved.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* The name and aliases of Lutz Peter Christoph ("Lupe Christoph",
|
||||
"Lutz Christoph") may not be used to endorse or promote products
|
||||
derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
Note for users of RAID controllers (smartmontools currently only
|
||||
supports 3ware): you can specify the drives attached to your RAID
|
||||
controller(s) as raiddev_num (e.g. sda_0). Then you must specify the
|
||||
type like this: type_sda_0 3ware,0.
|
||||
|
||||
Recent versions of the kernel driver use a separate major device
|
||||
number for monitoring purposes, like /dev/twe<n> or /dev/twa<n>. This
|
||||
can be put in the e.g. dev_sda environment variable, to allow the user
|
||||
to keep sda as the name of the disk.
|
||||
|
||||
To avoid spinning up sleeping disks smartctl will use the --nocheck
|
||||
parameter. If this parameter isn't supported by your version of
|
||||
smartctl then hdparm will be used. Note that hdparm isn't available
|
||||
on all platforms.
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
|
||||
my $DEBUG = $ENV{'MUNIN_DEBUG'} || 0;
|
||||
|
||||
my $smartctl = exists $ENV{smartctl} ? $ENV{smartctl} : '';
|
||||
|
||||
# If the envvar is not set, look for smartctl
|
||||
if (!$smartctl) {
|
||||
# Still not found? Check obvious places
|
||||
my @dirs = split(':',$ENV{PATH});
|
||||
push (@dirs, qw(/usr/bin /usr/sbin /usr/local/bin /usr/local/sbin) );
|
||||
|
||||
until ($smartctl or @dirs == 0) {
|
||||
my $dir = shift @dirs;
|
||||
my $path = $dir.'/smartctl';
|
||||
$smartctl = $path if -x $path;
|
||||
}
|
||||
} elsif (! -x $smartctl) {
|
||||
# If it is set, verify it
|
||||
warn "Predefined smartctl ($smartctl) is not a executable\n";
|
||||
undef $smartctl;
|
||||
}
|
||||
|
||||
# Check version of smartctl to determine --nocheck capabilities
|
||||
my $use_nocheck = 0;
|
||||
if ($smartctl and `$smartctl --version` =~ / version (\d+\.\d+) /i) {
|
||||
$use_nocheck = $1 >= 5.37;
|
||||
warn "[DEBUG] Smartctl supports --nocheck\n" if $DEBUG;
|
||||
}
|
||||
|
||||
# hdparm is used as a fallback
|
||||
my $hdparm = `which hdparm 2>/dev/null`;
|
||||
chomp $hdparm;
|
||||
|
||||
my @drives;
|
||||
|
||||
# Try to get a default set of drives
|
||||
if ($^O eq 'linux') {
|
||||
# On Linux, we know how to enumerate ide drives. SCSI is not as easy
|
||||
if (-d '/proc/ide') {
|
||||
opendir(IDE, '/proc/ide');
|
||||
@drives = grep /hd[a-z]/, readdir IDE;
|
||||
closedir(IDE);
|
||||
}
|
||||
# "SCSI disks" could be both SCSI or SATA - we can't know which
|
||||
# without probing them.
|
||||
} elsif ($^O eq 'freebsd') {
|
||||
opendir(DEV, '/dev');
|
||||
@drives = grep /^(a?da|ad)[0-9]+$/, readdir DEV;
|
||||
closedir(DEV);
|
||||
} elsif ($^O eq 'solaris') {
|
||||
@drives = map { s@.*/@@ ; $_ } glob '/dev/rdsk/c*t*d*s2';
|
||||
}
|
||||
|
||||
@drives = split ' ', $ENV{drives} if exists $ENV{drives};
|
||||
|
||||
# Sort list of drives
|
||||
@drives = sort @drives;
|
||||
|
||||
warn "[DEBUG] Drives: ",join(', ',@drives),"\n" if $DEBUG;
|
||||
|
||||
if (defined $ARGV[0]) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
if ($smartctl and -x $smartctl) {
|
||||
if (@drives) {
|
||||
my $cmd = command_for_drive_device($drives[0],
|
||||
device_for_drive($drives[0]));
|
||||
if (`$cmd` =~ /Temperature/) {
|
||||
print "yes\n";
|
||||
} else {
|
||||
print "no (first drive not supported, configure the plugin)\n";
|
||||
}
|
||||
exit 0;
|
||||
} else {
|
||||
print "no (no drives known)\n";
|
||||
exit 0;
|
||||
}
|
||||
} else {
|
||||
print "no (smartctl not found)\n";
|
||||
exit 0;
|
||||
}
|
||||
} elsif ($ARGV[0] eq 'config') {
|
||||
print "graph_title HDD temperature\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel temp in ╟C\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the temperature in degrees Celsius of the hard drives in the machine.\n";
|
||||
print "$_.label $_\n" foreach @drives;
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $drive (@drives) {
|
||||
warn "[DEBUG] Processing $drive\n" if $DEBUG;
|
||||
my $fulldev = device_for_drive($drive);
|
||||
|
||||
# Fall back to using hdparm for detecting disks in stand-by only if nocheck
|
||||
# isn't supported (hdparm isn't available on all platforms).
|
||||
if (!$use_nocheck && $hdparm && $fulldev =~ /\/dev\/[sh]d?/) {
|
||||
if (`$hdparm -C $fulldev 2>/dev/null` =~ /standby/) {
|
||||
warn "[DEBUG] Drive $fulldev is in standby mode, not checking\n"
|
||||
if $DEBUG;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd = command_for_drive_device($drive, $fulldev, $use_nocheck);
|
||||
warn "[DEBUG] Command for $drive is % $cmd %\n" if $DEBUG;
|
||||
|
||||
my $output = `$cmd`;
|
||||
if ($? ne 0) {
|
||||
print "$drive.value U\n";
|
||||
print "$drive.extinfo Command $cmd on drive $drive failed: $?. The plugin needs to have read permission on all monitored devices.\n";
|
||||
warn "[ERROR] Command $cmd on drive $drive failed: $?. The plugin needs to have read permission on all monitored devices.\n";
|
||||
next;
|
||||
}
|
||||
if ($output =~ /Current Drive Temperature:\s*(\d+)/) {
|
||||
print "$drive.value $1\n";
|
||||
} elsif ($output =~ /^(194 Temperature_Celsius.*)/m) {
|
||||
my @F = split /\s+/, $1;
|
||||
print "$drive.value $F[9]\n";
|
||||
} elsif ($output =~ /^(231 Temperature_Celsius.*)/m) {
|
||||
my @F = split ' ', $1;
|
||||
print "$drive.value $F[9]\n";
|
||||
} elsif ($output =~ /^(190 Airflow_Temperature_Cel.*)/m) {
|
||||
my @F = split ' ', $1;
|
||||
print "$drive.value $F[9]\n";
|
||||
} else {
|
||||
print "$drive.value U\n";
|
||||
print "$drive.extinfo Temperature not detected in smartctl output\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub device_for_drive {
|
||||
my ($drive) = @_;
|
||||
|
||||
my $dev = $drive =~ /(.*)(?:_\d+)/ ? $1 : $drive;
|
||||
|
||||
my $fulldev = '/dev/';
|
||||
$fulldev .= 'rdsk/' if $^O eq 'solaris';
|
||||
$fulldev .= exists $ENV{'dev_'.$drive} ? $ENV{'dev_'.$drive} : $dev;
|
||||
|
||||
return $fulldev;
|
||||
}
|
||||
|
||||
sub command_for_drive_device {
|
||||
my ($drive, $fulldev, $use_nocheck) = @_;
|
||||
|
||||
my $cmd = $smartctl.' -A ';
|
||||
$cmd .= '--nocheck=standby ' if $use_nocheck;
|
||||
$cmd .= $ENV{'args_'.$drive}.' ' if exists $ENV{'args_'.$drive};
|
||||
$cmd .= '-d '.$ENV{'type_'.$drive}.' ' if exists $ENV{'type_'.$drive};
|
||||
$cmd .= $fulldev;
|
||||
|
||||
}
|
165
plugins/sensors/hpasmcli2_
Executable file
165
plugins/sensors/hpasmcli2_
Executable file
|
@ -0,0 +1,165 @@
|
|||
#! /usr/local/bin/perl -w
|
||||
#
|
||||
# Plugin to monitor Proliant server health status using hpasmcli.
|
||||
#
|
||||
# Config variables:
|
||||
# user root -- requrired by hpasmcli
|
||||
# env.hpasmcli -- path to hpasmcli executable (optional)
|
||||
# env.degree -- Unit of temperatures (C or F / default value is C)
|
||||
#
|
||||
#
|
||||
# Author: Tsuyoshi Wada <mail@tuyo.jp>
|
||||
#
|
||||
# v1.0 2007/12/08 - First version
|
||||
#
|
||||
# Copyright (c) 2007 Tsuyoshi Wada
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Magic markers
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
use strict;
|
||||
|
||||
my $hpasmcli = exists $ENV{hpasmcli} ? $ENV{hpasmcli} : undef;
|
||||
$hpasmcli = `which hpasmcli` unless $hpasmcli;
|
||||
chomp $hpasmcli;
|
||||
$hpasmcli = undef unless -x $hpasmcli;
|
||||
my @dirs = qw(/usr/bin /usr/sbin /usr/local/bin /usr/local/sbin);
|
||||
until ($hpasmcli or @dirs == 0) {
|
||||
my $dir = shift @dirs;
|
||||
my $path = $dir.'/hpasmcli';
|
||||
$hpasmcli = $path if -x $path;
|
||||
}
|
||||
my $degree = exists $ENV{degree} ? $ENV{degree} : 'C';
|
||||
my $deg_name = $degree eq 'C' ? "Celsius": "Fahrenheit";
|
||||
|
||||
if (defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
if ($hpasmcli and -x $hpasmcli) {
|
||||
my @chk_result = `$hpasmcli -s \"help\"`;
|
||||
if ($? eq "0") {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
} else {
|
||||
my $reason = 'Unknown error';
|
||||
foreach my $line (@chk_result) {
|
||||
if ($line =~ /^ERROR/i) {
|
||||
chomp($line);
|
||||
$reason = $line;
|
||||
last;
|
||||
}
|
||||
}
|
||||
print "no ($reason)\n";
|
||||
exit 1;
|
||||
}
|
||||
} else {
|
||||
print "no (hpasmcli not found)\n";
|
||||
exit 1;
|
||||
}
|
||||
} elsif ($ARGV[0] eq 'suggest') {
|
||||
print "temp\nfans\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
$0 =~ /hpasmcli2_(.+)*$/;
|
||||
my $show_target = $1;
|
||||
my @show_result = `$hpasmcli -s \"show $show_target\"`;
|
||||
my %output;
|
||||
|
||||
if (defined($show_target) and $show_target eq 'temp') {
|
||||
foreach my $line (@show_result) {
|
||||
if ($line =~ /^#/) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/^\s//g;
|
||||
my ($sensor, $loc, $temp, $threshold) = split(/\s/, $line);
|
||||
next if ($temp eq "-");
|
||||
$loc =~ s/\/|#//g;
|
||||
$temp = $degree eq 'C' ? (split(/\//, $temp))[0] : (split(/\//, $temp))[1];
|
||||
$temp =~ s/C|F//g;
|
||||
$threshold = $degree eq 'C' ? (split(/\//, $threshold))[0] : (split(/\//, $threshold))[1];
|
||||
$threshold =~ s/C|F//g;
|
||||
$sensor =~s/#//g;
|
||||
$output{$sensor} = {
|
||||
'location' => lc($loc),
|
||||
'temp' => $temp,
|
||||
'threshold' => $threshold
|
||||
};
|
||||
}
|
||||
}
|
||||
if (defined($ARGV[0]) and $ARGV[0] eq 'config') {
|
||||
print "graph_title hpasm: Temperature\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Degrees in $deg_name\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the temperatures as reported by hpasmcli.\n";
|
||||
foreach my $key (sort keys %output) {
|
||||
print "temp$key.label $output{$key}->{'location'}\n";
|
||||
print "temp$key.warning " . ($output{$key}->{'threshold'} * 0.75) . "\n";
|
||||
print "temp$key.critical $output{$key}->{'threshold'}\n";
|
||||
}
|
||||
} else {
|
||||
foreach my $key (sort keys %output) {
|
||||
print "temp$key.value $output{$key}->{'temp'}\n";
|
||||
}
|
||||
}
|
||||
} elsif (defined($show_target) and $show_target eq 'fans') {
|
||||
foreach my $line (@show_result) {
|
||||
if ($line =~ /^#/) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/^\s//g;
|
||||
my ($fan, $loc, $present, $speed, $rate, $redundant, $partner, $pluggable) = split(/\s/, $line);
|
||||
next if ($present ne "Yes");
|
||||
$loc =~ s/\/|#//g;
|
||||
$rate =~ s/\%//g;
|
||||
my $threshold = '100';
|
||||
$fan =~s/#//g;
|
||||
$output{$fan} = {
|
||||
'location' => lc($loc),
|
||||
'rate' => $rate,
|
||||
'threshold' => $threshold
|
||||
};
|
||||
}
|
||||
}
|
||||
if (defined($ARGV[0]) and $ARGV[0] eq 'config') {
|
||||
print "graph_title hpasm: Fans\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel of max (%)\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows the info of fans as reported by hpasmcli.\n";
|
||||
foreach my $key (sort keys %output) {
|
||||
print "fan$key.label FAN$key $output{$key}->{'location'}\n";
|
||||
print "fan$key.warning " . ($output{$key}->{'threshold'} * 0.75) . "\n";
|
||||
print "fan$key.critical $output{$key}->{'threshold'}\n";
|
||||
}
|
||||
} else {
|
||||
foreach my $key (sort keys %output) {
|
||||
print "fan$key.value $output{$key}->{'rate'}\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die "Unknown target specified ($show_target)\n";
|
||||
}
|
||||
|
||||
exit 0;
|
72
plugins/sensors/humidity-sensor
Executable file
72
plugins/sensors/humidity-sensor
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) Viktoras Pecia 2010(Based on 2006 Lars Strand "temperatures" code)
|
||||
#
|
||||
# Plugin to fetch humidity from weather.noaa.gov
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
my @wcode = undef;
|
||||
if (defined($ENV{wcode})) {
|
||||
@wcode = split(' ', $ENV{wcode});
|
||||
} else {
|
||||
@wcode = ("EYSA","EYKA","EYPA","EYVI");
|
||||
}
|
||||
my $proxy = $ENV{proxy} || undef; # Example: "http://proxy.foo.bar:8080/"
|
||||
my $ret = undef;
|
||||
if (! eval "require LWP::UserAgent;")
|
||||
{
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||
if (defined $ret) {
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
my $datasource = "http://weather.noaa.gov/pub/data/observations/metar/decoded/";
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
$ua->agent('Munin');
|
||||
# Use proxy, if defined.
|
||||
if (defined($proxy)) {
|
||||
$ua->proxy(['http'], $proxy);
|
||||
}
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
print "graph_title Humidity\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows humidity fetched from weather.nooa.gov.\n";
|
||||
print "graph_vlabel humidity in %\n";
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
# New York City, Central Park, NY, United States (KNYC) 40-47-00N 073-58-00W 48M
|
||||
if ($response->content =~ /^((.*?),.*\)).*\n/) {
|
||||
print "$station.label $2\n";
|
||||
print "$station.info $1\n";
|
||||
} else {
|
||||
print "$station.label $station\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
if ($response->content =~ /Relative Humidity:\s*(\d+)\%.*/) {
|
||||
print "$station.value $1\n";
|
||||
} else {
|
||||
print "$station.value U\n";
|
||||
}
|
||||
}
|
68
plugins/sensors/ip_thermo_125
Executable file
68
plugins/sensors/ip_thermo_125
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2008 Yuriy Sabov
|
||||
# Version 0.1
|
||||
#
|
||||
# Plugin to fetch temperature from "IP Thermo 125" ethernet thermometer
|
||||
# available at http://www.procontrol.hu/GyartasFejlesztes/Termekeink/IPThermoSimple/IPThermo125_eng.htm
|
||||
# This version supports only one temperature sensor per server!
|
||||
#
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
|
||||
|
||||
my ($hostname, $port, $line, $telnet);
|
||||
|
||||
# "C" = Celsius, "F" = Fahrenheit
|
||||
my $unit = $ENV{unit} || "C";
|
||||
|
||||
$hostname = "10.10.10.10";
|
||||
$port = 23;
|
||||
|
||||
use Net::Telnet ();
|
||||
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq "autoconf")
|
||||
{
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config")
|
||||
{
|
||||
print "graph_title IP Thermo 125\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows temperature using IP Thermo 125 server.\n";
|
||||
|
||||
if ($unit =~ /F/)
|
||||
{
|
||||
print "graph_vlabel temp in °F\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "graph_vlabel temp in °C\n";
|
||||
}
|
||||
print "temperature.label temperature\n";
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
$telnet = new Net::Telnet (Telnetmode => 0);
|
||||
|
||||
# create telnet connection to temperature server
|
||||
$telnet->open(Host => $hostname, Port => $port);
|
||||
|
||||
# read line from server.
|
||||
$line = $telnet->getline;
|
||||
|
||||
# get measurement of first sensor from received data
|
||||
$value1 = substr(substr($line, 0, 20), -4, 4);
|
||||
print "temperature.value ";
|
||||
print "$value1\n";
|
||||
|
||||
|
114
plugins/sensors/ipmi_fans
Executable file
114
plugins/sensors/ipmi_fans
Executable file
|
@ -0,0 +1,114 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# This plugin will graph the chassis fan speed on a Dell PowerEdge Server
|
||||
# via the ipmi-sensors tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PE1850
|
||||
#
|
||||
# To enable:
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/ipmi-fans /etc/munin/plugins/ipmi-fans
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [ipmi_fans]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Alexx Roche <munin-ipmi-plugin@alexx.net>
|
||||
# Built on the work of Justin Shepherd <galstrom21@gmail.com>
|
||||
# Revision: 2.1 2011/01/10
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my $IPMI;
|
||||
if(-f "/usr/sbin/ipmi-sensors"){ $IPMI='/usr/sbin/ipmi-sensors'; }
|
||||
unless($IPMI){
|
||||
$IPMI = `which ipmi-sensors 2>/dev/null|sed 's/.*no ipmi-sensors//'`;
|
||||
#$IPMI = `echo -n \$(which ipmi-sensors)`;
|
||||
}
|
||||
chomp($IPMI);
|
||||
unless($IPMI){ exit 1; }
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf"){
|
||||
if (-f $IPMI){
|
||||
print "yes\n";
|
||||
}else{
|
||||
print "no ($IPMI does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
my $cmd = "$IPMI --verbose --sensors=\"\$(echo \$($IPMI |grep FAN|sed 's/:.*//'))\"";
|
||||
#if ($ARGV[0] eq 'cmd'){ print $cmd; exit;};
|
||||
my @result = `$cmd`;
|
||||
my (%val, $index);
|
||||
$index=0;
|
||||
my $count=0;
|
||||
#Four of these seem to be unlabled, I'm going to guess that they are the CPU(s) and HDD(s)
|
||||
my @unknown = ('HDD0','HDD1','CPU0','CPU1');
|
||||
foreach my $line (@result) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/\s$//g;
|
||||
if(!$line || $line eq ""){
|
||||
$index++;
|
||||
next;
|
||||
}
|
||||
my ($key, $val) = split(/\: /, $line);
|
||||
unless($key){
|
||||
# $index++;
|
||||
# next;
|
||||
}
|
||||
if($key eq 'Sensor Name'){
|
||||
if($val eq 'Temp'){
|
||||
$val = $unknown[$count];
|
||||
$count++;
|
||||
}
|
||||
#my @data = split / /, $val;
|
||||
#$data[2]=~s/^\(//;
|
||||
#$data[2]=~s/\)$//;
|
||||
#my($warn,$crit) = split/\//, $data[2];
|
||||
$val{$index}{'Probe Name'} = "$val";
|
||||
}elsif($key eq 'Upper Critical Threshold'){
|
||||
$val=~s/ .*$//;
|
||||
next unless $val=~m/^\d+\.\d+$/;
|
||||
$val{$index}{'Critical Threshold'} = "$val";
|
||||
}elsif($key eq 'Normal Max.'){
|
||||
$val=~s/ .*//;
|
||||
$val{$index}{'Warning Threshold'} = $val;
|
||||
}elsif($key eq 'Sensor Reading'){
|
||||
$val=~s/ .*//;
|
||||
$val{$index}{'Reading'} = $val;
|
||||
}elsif($key eq 'Sensor Max. Reading' && !$val{$index}{'Critical Threshold'}){
|
||||
$val=~s/ .*$//;
|
||||
$val{$index}{'Critical Threshold'} = "$val";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title IPMI - Fan Speeds\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Speed in RPM\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "probe_$j\.label $val{$j}{'Probe Name'}\n";
|
||||
print "probe_$j\.warning $val{$j}{'Warning Threshold'}\n";
|
||||
print "probe_$j\.critical $val{$j}{'Critical Threshold'}\n";
|
||||
}
|
||||
}else{
|
||||
foreach my $j (sort keys %val) {
|
||||
if($val{$j}{'Reading'}){
|
||||
print "probe_$j.value $val{$j}{'Reading'}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
|
103
plugins/sensors/ipmi_therm
Executable file
103
plugins/sensors/ipmi_therm
Executable file
|
@ -0,0 +1,103 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# This plugin will graph the chassis temp sensors on a Dell PowerEdge Server
|
||||
# via the ipmi-sensors tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PE1850
|
||||
#
|
||||
# To enable:
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/ipmi-therm /etc/munin/plugins/ipmi-therm
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [ipmi_therm]
|
||||
# user - User that has permissions to run ipmi-sensors
|
||||
# env.category sensors
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Alexx Roche <munin-ipmi-plugin@alexx.net>
|
||||
# Built on the work of Justin Shepherd <galstrom21@gmail.com>
|
||||
# Revision: 1.3 2011/01/10
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my $IPMI;
|
||||
if(-f "/usr/sbin/ipmi-sensors"){ $IPMI='/usr/sbin/ipmi-sensors'; }
|
||||
unless($IPMI){
|
||||
$IPMI = `which ipmi-sensors 2>/dev/null|sed 's/.*no ipmi-sensors//'`;
|
||||
#$IPMI = `echo -n \$(which ipmi-sensors)`;
|
||||
}
|
||||
chomp($IPMI);
|
||||
unless($IPMI){ exit 1; }
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf"){
|
||||
if (-f $IPMI){
|
||||
print "yes\n";
|
||||
}else{
|
||||
print "no ($IPMI does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
}else{
|
||||
my $cmd = "$IPMI|grep Temp";
|
||||
my @result = `$cmd`;
|
||||
my (%val, $index);
|
||||
$index=0;
|
||||
my $count=0;
|
||||
#Four of these seem to be unlabled, I'm going to guess that they are the CPU(s) and HDD(s)
|
||||
my @unknown = ('CPU0','CPU1','HDD0','HDD1');
|
||||
foreach my $line (@result) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/\s$//g;
|
||||
next if ($line eq "");
|
||||
my ($list, $field, $value, $state) = split(/\: /, $line);
|
||||
#print "L: $list F: $field V: $value S: $state\n";
|
||||
if($field=~m/^(Temp|Ambient|Planar|Riser)/) {
|
||||
my $f=$1;
|
||||
if($f eq 'Temp'){
|
||||
$f = $unknown[$count];
|
||||
$count++;
|
||||
}
|
||||
my @data = split / /, $value;
|
||||
$data[2]=~s/^\(//;
|
||||
$data[2]=~s/\)$//;
|
||||
if($f){
|
||||
my($warn,$crit) = split/\//, $data[2];
|
||||
unless($warn=~m/\d+/){ $warn = 0; }
|
||||
unless($crit=~m/\d+/){ $crit = 200; }
|
||||
$val{$index}{'Probe Name'} = "$f";
|
||||
$val{$index}{'Reading'} = "$data[0]";
|
||||
$val{$index}{'Warning Threshold'} = ($crit - $warn);
|
||||
$val{$index}{'Critical Threshold'} = "$crit";
|
||||
$index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title IPMI sensors - Temperature Probes\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Temperature in Celsius\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "probe_$j\.label $val{$j}{'Probe Name'}\n";
|
||||
print "probe_$j\.warning $val{$j}{'Warning Threshold'}\n";
|
||||
print "probe_$j\.critical $val{$j}{'Critical Threshold'}\n";
|
||||
}
|
||||
}else{
|
||||
foreach my $j (sort keys %val) {
|
||||
if($val{$j}{'Reading'}){
|
||||
print "probe_$j.value $val{$j}{'Reading'}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
|
865
plugins/sensors/ipmisens-v3
Executable file
865
plugins/sensors/ipmisens-v3
Executable file
|
@ -0,0 +1,865 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# ipmisens3
|
||||
# Munin plugin to read IPMI sensor data
|
||||
# Zoltan HERPAI (c) 2009 <wigyori@uid0.hu>
|
||||
#
|
||||
# Symlink this script into your /etc/munin/plugins directory in the
|
||||
# following way:
|
||||
#
|
||||
# ipmisens2_[machine]_[sensors]
|
||||
#
|
||||
# Supported machines:
|
||||
# - Asus K8N-LR: asmb2 (temp, volt, fan)
|
||||
# - Dell DCS-XS23: xs23 (temp, volt, fan)
|
||||
# - Dell M610 blade: m610 (temp)
|
||||
# - Dell PowerEdge 2650: pe2650 (temp, volt, fan)
|
||||
# - Fujitsu TX120: tx120 (temp, volt, fan)
|
||||
# - HP Proliant ML350G5: proliantg5 (temp)
|
||||
# - HP Proliant DL380G5: proliantg5 (temp)
|
||||
# - HP Proliant DL385G1: hpasmcli (temp, fan)
|
||||
# - IBM HS21/HS22/Dataplex DX360: ibmhsxx (volt)
|
||||
# - IBM LS20/LS21: ibmlsxx (temp, volt)
|
||||
# - IBM LS41: ibmls4x (temp, volt)
|
||||
# - IBM x3200/x3550: ibmx3xx0 (temp, volt, fan)
|
||||
# - IBM x346: x346 (temp, volt, fan)
|
||||
# - Intel SHG2 mainboard: shg2 (temp, volt, fan)
|
||||
# - Sun x2100/2100m2/2200/2200m2: x2100 (temp, volt, fan)
|
||||
# - Sun x2250: x2250 (temp, volt, fan)
|
||||
# - Sun x2270: x2270 (temp, volt, fan)
|
||||
# - Sun x4100/4100m2/4200/4200m2/4600: x4x00 (temp, volt, fan)
|
||||
# - Sun x4150: x4150 (temp, volt, fan)
|
||||
# - Sun V20z (V40z?): v20z (temp, volt, fan)
|
||||
# - Supermicro X7DB8/X7DCL: aocipmi20e (temp, volt, fan)
|
||||
# - Supermicro X8DT6/X8DTT-F: hermon (temp, volt, fan)
|
||||
# - Verari VB1205XM: vb1205 (temp, volt)
|
||||
#
|
||||
# Supported but not tested:
|
||||
# - HP DL145G2: asmb2 (temp, volt, fan)
|
||||
#
|
||||
# Notes:
|
||||
# - hpasmcli machtype requires HP's hpasmcli package, and the additional
|
||||
# hpasmcliget script.
|
||||
#
|
||||
# Outputs submitted by:
|
||||
# - Zoltan LAJBER <lajbi@lajli.gau.hu>
|
||||
# - Gergely MADARASZ <gorgo@broadband.hu>
|
||||
# - Louis van Belle <louis@van-belle.nl>
|
||||
# - Andras GOT <andrej@antiszoc.hu>
|
||||
# - Andras KORN <korn@chardonnay.math.bme.hu>
|
||||
# - Tamas TEVESZ <ice@extreme.hu>
|
||||
# - Gergely TOMKA <gergely@tomka.hu>
|
||||
# - Gabor SZOLLOSI <dev@localnet.hu>
|
||||
# - Reka KAROLYI <reka@karolyi.eu>
|
||||
# - Andras HORVATH <Andras.Horvath@cern.ch>
|
||||
#
|
||||
# CHANGELOG
|
||||
#
|
||||
# Revision 3.01 2010/09/23 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Add support for handling non-ipmitool-based machtypes
|
||||
# * Add support for HP Proliant DL385G1
|
||||
#
|
||||
# Revision 3.00 2010/05/25 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Add support for Supermicro X7DB8 via AOC IPMI20-E (aocipmi20e)
|
||||
# * Add support for Supermicro X7DCL via AOC IPMI20-E (aocipmi20e)
|
||||
# * Add support for Supermicro X8DT6 via Winbond Hermon BMC (hermon)
|
||||
# * Add support for Supermicro X8DTT-F via Winbond Hermon BMC (hermon)
|
||||
# * Add support for Dell M610 (m610)
|
||||
# * Add support for HP DL380G5 (proliantg5)
|
||||
# * Add support for HP ML350G5 (proliantg5)
|
||||
# * Re-add support for Asus K8N-LR via ASMB2 (asmb2)
|
||||
# * Add to-be-tested support for HP DL145G2 as per Paulo@muninexchange (asmb2)
|
||||
#
|
||||
# Revision 3.00early4 2010/01/09 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Add support for IBM HS22 (ibmhsxx)
|
||||
# * Add support for IBM iDataplex DX360 (ibmhsxx)
|
||||
# * Add support for Dell DCS XS23-sc (xs23)
|
||||
#
|
||||
# Revision 3.00early3 2009/12/30 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Support for easier debugging ($debug)
|
||||
# * Add support for IBM LS41 (ibmls4x)
|
||||
# * Add complete support for Sun x2270 (x2270)
|
||||
# * Add support for Sun x4500 (x4x00)
|
||||
# * Add support for Fujitsu-Siemens TX120 (tx120)
|
||||
#
|
||||
# Revision 3.00early2 2009/09/09 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Minor bugfix due to munin brain damage
|
||||
#
|
||||
# Revision 3.00early 2009/09/01 Zoltan HERPAI <wigyori@uid0.hu>
|
||||
# * Complete rewrite in perl.
|
||||
# * Sun x2100, x2100M2 and x2200 are now supported in 'x2100' machtype
|
||||
# * Bunch of new machtypes are supported
|
||||
#
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX;
|
||||
use FindBin qw($Script);
|
||||
|
||||
my $IPMITOOL = '/usr/bin/ipmitool';
|
||||
my $curtime = time();
|
||||
my $TEMPFILE = "/var/lib/munin/plugin-state/ipmisens3";
|
||||
# set the ipmidump expiration to 1 day
|
||||
my $TEMPREFRESH = 86400;
|
||||
my $debug = 0;
|
||||
my $devel = 0;
|
||||
|
||||
##############
|
||||
# You should not need to edit anything below here
|
||||
#
|
||||
$ENV{PATH} = '/bin:/usr/bin:/usr/sbin';
|
||||
$ENV{IFS} = "\n";
|
||||
|
||||
$0 =~ /.*_(.*)_(.*)/;
|
||||
my $machine = $1;
|
||||
my $sensor = $2;
|
||||
|
||||
# Test if ipmitool is available
|
||||
if ( !$devel )
|
||||
{
|
||||
if ( $machine ne 'hpasmcli' ) {
|
||||
`$IPMITOOL help 2> /dev/null`;
|
||||
if ($?)
|
||||
{
|
||||
print "no ($IPMITOOL not found)";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "Machine: $machine , sensor: $sensor\n" if ($debug);
|
||||
|
||||
# check expiration time of the dumpfile
|
||||
if ( !$devel )
|
||||
{
|
||||
if ( $machine ne 'hpasmcli' ) {
|
||||
if ( -f $TEMPFILE && $curtime - (stat($TEMPFILE))[9] >= $TEMPREFRESH )
|
||||
{
|
||||
print "Unlinking $TEMPFILE...\n" if ($debug);
|
||||
unlink ($TEMPFILE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$devel )
|
||||
{
|
||||
if ( $machine ne 'hpasmcli' ) {
|
||||
if ( ! -f $TEMPFILE )
|
||||
{
|
||||
print "Writing dumpfile $TEMPFILE...\n" if ($debug);
|
||||
`$IPMITOOL sdr dump $TEMPFILE` || die $!;
|
||||
if ($?)
|
||||
{
|
||||
print "no (retcode $?)\n";
|
||||
exit 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @ipmioutput;
|
||||
|
||||
# Read the sensors
|
||||
if ( $machine ne 'hpasmcli' ) {
|
||||
@ipmioutput = `$IPMITOOL sdr -S $TEMPFILE`;
|
||||
}
|
||||
else {
|
||||
@ipmioutput = `cat /tmp/ipmi-sensors`;
|
||||
}
|
||||
#my @ipmioutput = `cat ~wigyori/ipmisens2/outputs/hp_ml350g5`;
|
||||
|
||||
if ($?)
|
||||
{
|
||||
print "no (retcode $?)\n";
|
||||
exit 3;
|
||||
}
|
||||
|
||||
my $arg;
|
||||
if ( defined($ARGV[0]) && $ARGV[0] ne "" )
|
||||
{
|
||||
print "argv: ".$ARGV[0]."\n" if ($debug);
|
||||
if ( $ARGV[0] eq 'config' ) { $arg = 'config'; }
|
||||
if ( $ARGV[0] eq 'autoconf' ) { $arg = 'autoconf'; }
|
||||
|
||||
if ( $arg eq 'autoconf' ) { print "no\n"; exit 0; }
|
||||
|
||||
my %cnf;
|
||||
if ( $arg eq 'config' )
|
||||
{
|
||||
# Base sensor config
|
||||
if ( $sensor eq 'temp' )
|
||||
{
|
||||
%cnf = (
|
||||
'graph_title' => 'Temperature',
|
||||
'graph_vlabel' => 'C',
|
||||
'graph_category' => 'sensors',
|
||||
);
|
||||
}
|
||||
|
||||
if ( $sensor eq 'volt' )
|
||||
{
|
||||
%cnf = (
|
||||
'graph_title' => 'Voltages',
|
||||
'graph_vlabel' => 'Volts',
|
||||
'graph_category' => 'sensors',
|
||||
);
|
||||
}
|
||||
|
||||
if ( $sensor eq 'fan' )
|
||||
{
|
||||
if ( $machine ne 'hpasmcli' ) {
|
||||
%cnf = (
|
||||
'graph_title' => 'Fan speeds',
|
||||
'graph_vlabel' => 'RPM',
|
||||
'graph_category' => 'sensors',
|
||||
);
|
||||
}
|
||||
else {
|
||||
%cnf = (
|
||||
'graph_title' => 'Fan speeds',
|
||||
'graph_vlabel' => '%',
|
||||
'graph_category' => 'sensors',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Static descriptors
|
||||
my %base;
|
||||
|
||||
# Sun x4100
|
||||
$base{'x4x00'}->{'mbt_amb'} = 'Mainboard';
|
||||
$base{'x4x00'}->{'fpt_amb'} = 'FP';
|
||||
$base{'x4x00'}->{'pdbt_amb'} = 'PSU';
|
||||
$base{'x4x00'}->{'iot_amb'} = 'Disks';
|
||||
$base{'x4x00'}->{'p0t_core'} = 'CPU0';
|
||||
$base{'x4x00'}->{'p1t_core'} = 'CPU1';
|
||||
$base{'x4x00'}->{'ft0fm0f0'} = 'ft0.fm0.f0';
|
||||
$base{'x4x00'}->{'ft0fm1f0'} = 'ft0.fm1.f0';
|
||||
$base{'x4x00'}->{'ft0fm2f0'} = 'ft0.fm2.f0';
|
||||
$base{'x4x00'}->{'ft0fm0f1'} = 'ft0.fm0.f1';
|
||||
$base{'x4x00'}->{'ft0fm1f1'} = 'ft0.fm1.f1';
|
||||
$base{'x4x00'}->{'ft0fm2f1'} = 'ft0.fm2.f1';
|
||||
$base{'x4x00'}->{'ft1fm0f0'} = 'ft1.fm0.f0';
|
||||
$base{'x4x00'}->{'ft1fm1f0'} = 'ft1.fm1.f0';
|
||||
$base{'x4x00'}->{'ft1fm2f0'} = 'ft1.fm2.f0';
|
||||
$base{'x4x00'}->{'ft1fm0f1'} = 'ft1.fm0.f1';
|
||||
$base{'x4x00'}->{'ft1fm1f1'} = 'ft1.fm1.f1';
|
||||
$base{'x4x00'}->{'ft1fm2f1'} = 'ft1.fm2.f1';
|
||||
$base{'x4x00'}->{'mbv_bat'} = 'BAT';
|
||||
$base{'x4x00'}->{'mbv_3v3stby'} = '3.3VSTBY';
|
||||
$base{'x4x00'}->{'mbv_3v3'} = '3.3V';
|
||||
$base{'x4x00'}->{'mbv_5v'} = '5V';
|
||||
$base{'x4x00'}->{'mbv_12v'} = '+12V';
|
||||
$base{'x4x00'}->{'mbv_dash12v'} = '-12V';
|
||||
$base{'x4x00'}->{'mbv_2v5core'} = 'MB 2.5V';
|
||||
$base{'x4x00'}->{'mbv_1v8core'} = 'MB 1.8V';
|
||||
$base{'x4x00'}->{'mbv_1v2core'} = 'MB 1.2V';
|
||||
$base{'x4x00'}->{'p0v_1v5'} = 'CPU0 1.5V';
|
||||
$base{'x4x00'}->{'p0v_2v5core'} = 'CPU0 2.5V';
|
||||
$base{'x4x00'}->{'p0v_1v25core'} = 'CPU0 1.25V';
|
||||
$base{'x4x00'}->{'p1v_1v5'} = 'CPU1 1.5V';
|
||||
$base{'x4x00'}->{'p1v_2v5core'} = 'CPU1 2.5V';
|
||||
$base{'x4x00'}->{'p1v_1v25core'} = 'CPU1 1.25V';
|
||||
# Sun x4100m2 extents
|
||||
$base{'x4x00'}->{'mbv_1v5core'} = 'MB 1.5V';
|
||||
$base{'x4x00'}->{'p0v_vddio'} = 'CPU0 VDDIO';
|
||||
$base{'x4x00'}->{'p0v_vdd'} = 'CPU0 VDD';
|
||||
$base{'x4x00'}->{'p0v_vtt'} = 'CPU0 VTT';
|
||||
$base{'x4x00'}->{'p1v_vddio'} = 'CPU1 VDDIO';
|
||||
$base{'x4x00'}->{'p1v_vdd'} = 'CPU1 VDD';
|
||||
$base{'x4x00'}->{'p1v_vtt'} = 'CPU1 VTT';
|
||||
# Sun x4600 voltage extents
|
||||
$base{'x4x00'}->{'mbv_1v2'} = 'MB +1.2V';
|
||||
$base{'x4x00'}->{'mbv_1v5'} = 'MB +1.5V';
|
||||
$base{'x4x00'}->{'mbv_2v5'} = 'MB +2.5V';
|
||||
$base{'x4x00'}->{'mbv_3v3aux_r'} = 'MB +3.3VAUX';
|
||||
$base{'x4x00'}->{'p0v_12v'} = 'CPU0 module +12V';
|
||||
$base{'x4x00'}->{'p1v_12v'} = 'CPU1 module +12V';
|
||||
$base{'x4x00'}->{'p2v_12v'} = 'CPU2 module +12V';
|
||||
$base{'x4x00'}->{'p3v_12v'} = 'CPU3 module +12V';
|
||||
$base{'x4x00'}->{'p4v_12v'} = 'CPU4 module +12V';
|
||||
$base{'x4x00'}->{'p5v_12v'} = 'CPU5 module +12V';
|
||||
$base{'x4x00'}->{'p6v_12v'} = 'CPU6 module +12V';
|
||||
$base{'x4x00'}->{'p7v_12v'} = 'CPU7 module +12V';
|
||||
$base{'x4x00'}->{'p0v_2v5'} = 'CPU0 module +2.5V';
|
||||
$base{'x4x00'}->{'p1v_2v5'} = 'CPU1 module +2.5V';
|
||||
$base{'x4x00'}->{'p2v_2v5'} = 'CPU2 module +2.5V';
|
||||
$base{'x4x00'}->{'p3v_2v5'} = 'CPU3 module +2.5V';
|
||||
$base{'x4x00'}->{'p4v_2v5'} = 'CPU4 module +2.5V';
|
||||
$base{'x4x00'}->{'p5v_2v5'} = 'CPU5 module +2.5V';
|
||||
$base{'x4x00'}->{'p6v_2v5'} = 'CPU6 module +2.5V';
|
||||
$base{'x4x00'}->{'p7v_2v5'} = 'CPU7 module +2.5V';
|
||||
$base{'x4x00'}->{'p0v_1v2'} = 'CPU0 module +1.2V';
|
||||
$base{'x4x00'}->{'p1v_1v2'} = 'CPU1 module +1.2V';
|
||||
$base{'x4x00'}->{'p2v_1v2'} = 'CPU2 module +1.2V';
|
||||
$base{'x4x00'}->{'p3v_1v2'} = 'CPU3 module +1.2V';
|
||||
$base{'x4x00'}->{'p4v_1v2'} = 'CPU4 module +1.2V';
|
||||
$base{'x4x00'}->{'p5v_1v2'} = 'CPU5 module +1.2V';
|
||||
$base{'x4x00'}->{'p6v_1v2'} = 'CPU6 module +1.2V';
|
||||
$base{'x4x00'}->{'p7v_1v2'} = 'CPU7 module +1.2V';
|
||||
$base{'x4x00'}->{'p0v_3v3aux_r'} = 'CPU0 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p1v_3v3aux_r'} = 'CPU1 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p2v_3v3aux_r'} = 'CPU2 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p3v_3v3aux_r'} = 'CPU3 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p4v_3v3aux_r'} = 'CPU4 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p5v_3v3aux_r'} = 'CPU5 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p6v_3v3aux_r'} = 'CPU6 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p7v_3v3aux_r'} = 'CPU7 module +3.3VAUX';
|
||||
$base{'x4x00'}->{'p0v_3v3led'} = 'CPU0 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p1v_3v3led'} = 'CPU1 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p2v_3v3led'} = 'CPU2 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p3v_3v3led'} = 'CPU3 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p4v_3v3led'} = 'CPU4 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p5v_3v3led'} = 'CPU5 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p6v_3v3led'} = 'CPU6 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p7v_3v3led'} = 'CPU7 module +3.3V LED';
|
||||
$base{'x4x00'}->{'p2v_1v25core'} = 'CPU2 1.25V';
|
||||
$base{'x4x00'}->{'p3v_1v25core'} = 'CPU3 1.25V';
|
||||
$base{'x4x00'}->{'p4v_1v25core'} = 'CPU4 1.25V';
|
||||
$base{'x4x00'}->{'p5v_1v25core'} = 'CPU5 1.25V';
|
||||
$base{'x4x00'}->{'p6v_1v25core'} = 'CPU6 1.25V';
|
||||
$base{'x4x00'}->{'p7v_1v25core'} = 'CPU7 1.25V';
|
||||
$base{'x4x00'}->{'p0v_core'} = 'CPU0 Vcore';
|
||||
$base{'x4x00'}->{'p1v_core'} = 'CPU1 Vcore';
|
||||
$base{'x4x00'}->{'p2v_core'} = 'CPU2 Vcore';
|
||||
$base{'x4x00'}->{'p3v_core'} = 'CPU3 Vcore';
|
||||
$base{'x4x00'}->{'p4v_core'} = 'CPU4 Vcore';
|
||||
$base{'x4x00'}->{'p5v_core'} = 'CPU5 Vcore';
|
||||
$base{'x4x00'}->{'p6v_core'} = 'CPU6 Vcore';
|
||||
$base{'x4x00'}->{'p7v_core'} = 'CPU7 Vcore';
|
||||
# Sun x4600 temp extents
|
||||
$base{'x4x00'}->{'p2t_core'} = 'CPU2';
|
||||
$base{'x4x00'}->{'p3t_core'} = 'CPU3';
|
||||
$base{'x4x00'}->{'p4t_core'} = 'CPU4';
|
||||
$base{'x4x00'}->{'p5t_core'} = 'CPU5';
|
||||
$base{'x4x00'}->{'p6t_core'} = 'CPU6';
|
||||
$base{'x4x00'}->{'p7t_core'} = 'CPU7';
|
||||
$base{'x4x00'}->{'p0t_amb'} = 'CPU0 module';
|
||||
$base{'x4x00'}->{'p1t_amb'} = 'CPU1 module';
|
||||
$base{'x4x00'}->{'p2t_amb'} = 'CPU2 module';
|
||||
$base{'x4x00'}->{'p3t_amb'} = 'CPU3 module';
|
||||
$base{'x4x00'}->{'p4t_amb'} = 'CPU4 module';
|
||||
$base{'x4x00'}->{'p5t_amb'} = 'CPU5 module';
|
||||
$base{'x4x00'}->{'p6t_amb'} = 'CPU6 module';
|
||||
$base{'x4x00'}->{'p7t_amb'} = 'CPU7 module';
|
||||
$base{'x4x00'}->{'mbt_amb0'} = 'System board 0';
|
||||
$base{'x4x00'}->{'mbt_amb1'} = 'System board 1';
|
||||
$base{'x4x00'}->{'mbt_amb2'} = 'System board 2';
|
||||
# Sun x4500 voltage extents
|
||||
$base{'x4x00'}->{'procp0v_1v25'} = 'CPU0 1.25V';
|
||||
$base{'x4x00'}->{'procp1v_1v25'} = 'CPU1 1.25V';
|
||||
$base{'x4x00'}->{'procp0v_1v5'} = 'CPU0 1.5V';
|
||||
$base{'x4x00'}->{'procp1v_1v5'} = 'CPU1 1.5V';
|
||||
$base{'x4x00'}->{'procp0v_2v5'} = 'CPU0 2.5V';
|
||||
$base{'x4x00'}->{'procp1v_2v5'} = 'CPU1 2.5V';
|
||||
$base{'x4x00'}->{'procv_1v8'} = 'CPU 1.8V';
|
||||
$base{'x4x00'}->{'iov_1v5'} = 'IO 1.5V';
|
||||
$base{'x4x00'}->{'iov_2v5'} = 'IO 2.5V';
|
||||
$base{'x4x00'}->{'iov_5v_disk'} = 'IO 5V disk';
|
||||
$base{'x4x00'}->{'iov_dash12v'} = 'IO -12V';
|
||||
# Sun x4500 temp extents
|
||||
$base{'x4x00'}->{'iofrontt_amb'} = 'IO front';
|
||||
$base{'x4x00'}->{'ioreart_amb'} = 'IO rear';
|
||||
$base{'x4x00'}->{'procfrontt_amb'} = 'CPU front';
|
||||
$base{'x4x00'}->{'procreart_amb'} = 'CPU rear';
|
||||
$base{'x4x00'}->{'procp0t_core'} = 'CPU0 temp';
|
||||
$base{'x4x00'}->{'procp1t_core'} = 'CPU1 temp';
|
||||
$base{'x4x00'}->{'dbpt_amb'} = 'DBP';
|
||||
|
||||
# Sun V20z (V40z?)
|
||||
$base{'v20z'}->{'ambient'} = 'System';
|
||||
$base{'v20z'}->{'cpu0die'} = 'CPU0 die';
|
||||
$base{'v20z'}->{'cpu0mem'} = 'CPU0 mem';
|
||||
$base{'v20z'}->{'cpu1die'} = 'CPU1 die';
|
||||
$base{'v20z'}->{'cpu1mem'} = 'CPU1 mem';
|
||||
$base{'v20z'}->{'gbeth'} = 'GBNIC';
|
||||
$base{'v20z'}->{'hddbp'} = 'HDD backplane';
|
||||
$base{'v20z'}->{'sp'} = 'Service CPU';
|
||||
|
||||
# Sun x2100
|
||||
$base{'x2100'}->{'cpucorevoltage'} = 'CPU core';
|
||||
$base{'x2100'}->{'batteryvolt'} = 'VBAT';
|
||||
$base{'x2100'}->{'ddr26v'} = 'DDR 2.6V';
|
||||
$base{'x2100'}->{'vcc33v'} = '+3.3V';
|
||||
$base{'x2100'}->{'vcc5v'} = '+5V';
|
||||
$base{'x2100'}->{'vcc12v'} = '+12V';
|
||||
$base{'x2100'}->{'cputemp'} = 'CPU';
|
||||
$base{'x2100'}->{'system'} = 'System';
|
||||
# Sun x2100M2 extents
|
||||
$base{'x2100'}->{'ddrp118v'} = 'DDR P1 1.8V';
|
||||
$base{'x2100'}->{'vcc33vstb'} = '+3.3VSTBY';
|
||||
$base{'x2100'}->{'ambienttemp'} = 'System';
|
||||
# Sun x2200 extents
|
||||
$base{'x2100'}->{'ddrp018v'} = 'DDR P0 1.8V';
|
||||
$base{'x2100'}->{'ambienttemp0'} = 'System temp 0';
|
||||
$base{'x2100'}->{'ambienttemp1'} = 'System temp 1';
|
||||
$base{'x2100'}->{'cpu0temp'} = 'CPU0 temp';
|
||||
$base{'x2100'}->{'cpu1temp'} = 'CPU1 temp';
|
||||
|
||||
# Intel SHG2
|
||||
$base{'shg2'}->{'baseboard12v'} = 'MB 12V';
|
||||
$base{'shg2'}->{'baseboard15v'} = 'MB 1.5V';
|
||||
$base{'shg2'}->{'baseboard25v'} = 'MB 2.5V';
|
||||
$base{'shg2'}->{'baseboard33v'} = 'MB 3.3V';
|
||||
$base{'shg2'}->{'baseboard33vsb'} = '3.3VSTBY';
|
||||
$base{'shg2'}->{'baseboard5v'} = 'MB 5V';
|
||||
$base{'shg2'}->{'baseboarddash12v'} = 'MB -12V';
|
||||
$base{'shg2'}->{'batteryvoltage'} = 'VBAT';
|
||||
$base{'shg2'}->{'processorvrm'} = 'VRM';
|
||||
|
||||
# IBM x346
|
||||
$base{'x346'}->{'125vsense'} = '+1.25V';
|
||||
$base{'x346'}->{'12vasense'} = '+12V A';
|
||||
$base{'x346'}->{'12vbsense'} = '+12V B';
|
||||
$base{'x346'}->{'12vcsense'} = '+12V C';
|
||||
$base{'x346'}->{'13vsense'} = '+1.3V';
|
||||
$base{'x346'}->{'15vsense'} = '+1.5V';
|
||||
$base{'x346'}->{'18vsense'} = '+1.8V';
|
||||
$base{'x346'}->{'25vsense'} = '+2.5V';
|
||||
$base{'x346'}->{'5vsense'} = '+5V';
|
||||
$base{'x346'}->{'cpu1vcore'} = 'CPU1 Vcore';
|
||||
$base{'x346'}->{'cpu2vcore'} = 'CPU2 Vcore';
|
||||
$base{'x346'}->{'cpuvtt'} = 'CPU VTT';
|
||||
$base{'x346'}->{'dash12vsense'} = '-12V';
|
||||
$base{'x346'}->{'vbat'} = 'VBAT';
|
||||
$base{'x346'}->{'cpu1'} = 'CPU1';
|
||||
$base{'x346'}->{'cpu2'} = 'CPU2';
|
||||
$base{'x346'}->{'dasd'} = 'DASD';
|
||||
$base{'x346'}->{'ambient'} = 'System';
|
||||
|
||||
# Sun x2250
|
||||
$base{'x2250'}->{'3v3_stby'} = '3.3VSTBY';
|
||||
$base{'x2250'}->{'3v3'} = '+3.3V';
|
||||
$base{'x2250'}->{'5v'} = '+5V';
|
||||
$base{'x2250'}->{'12v'} = '+12V';
|
||||
$base{'x2250'}->{'1v5'} = '+1.5V';
|
||||
$base{'x2250'}->{'1v8'} = '+1.8V';
|
||||
$base{'x2250'}->{'0v9'} = '+0.9V';
|
||||
$base{'x2250'}->{'vtt'} = 'VTT';
|
||||
$base{'x2250'}->{'1v5_esb'} = 'ESB +1.5V';
|
||||
$base{'x2250'}->{'1v2_nic'} = 'NIC +1.2V';
|
||||
$base{'x2250'}->{'1v8_nic'} = 'NIC +1.8V';
|
||||
$base{'x2250'}->{'1v5_fbd'} = 'FBDIMM +1.5V';
|
||||
|
||||
# Sun x2270
|
||||
$base{'x2270'}->{'3v3_stby'} = '3.3VSTBY';
|
||||
$base{'x2270'}->{'3v3'} = '+3.3V';
|
||||
$base{'x2270'}->{'5v'} = '+5V';
|
||||
$base{'x2270'}->{'12v'} = '+12V';
|
||||
$base{'x2270'}->{'3v3_vbat'} = '3.3VBAT';
|
||||
$base{'x2270'}->{'1v5'} = '+1.5V';
|
||||
$base{'x2270'}->{'p0_1v5_ddr'} = 'DDR P0 +1.5V';
|
||||
$base{'x2270'}->{'p1_1v5_ddr'} = 'DDR P1 +1.5V';
|
||||
$base{'x2270'}->{'p0_1v8'} = 'P0 +1.8V';
|
||||
$base{'x2270'}->{'p1_1v8'} = 'P1 +1.8V';
|
||||
$base{'x2270'}->{'p0_vtt'} = 'P0 VTT';
|
||||
$base{'x2270'}->{'p1_vtt'} = 'P1 VTT';
|
||||
$base{'x2270'}->{'p0_vccp'} = 'P0 VCCp';
|
||||
$base{'x2270'}->{'p1_vccp'} = 'P1 VCCp';
|
||||
|
||||
# Sun x4150
|
||||
$base{'x4150'}->{'mb_t_amb0'} = 'MB Sensor 0';
|
||||
$base{'x4150'}->{'mb_t_amb1'} = 'MB Sensor 1';
|
||||
$base{'x4150'}->{'mb_t_amb2'} = 'MB Sensor 2';
|
||||
$base{'x4150'}->{'mb_t_amb3'} = 'MB Sensor 3';
|
||||
$base{'x4150'}->{'ps0_t_amb'} = 'PS 1 temp';
|
||||
$base{'x4150'}->{'ps1_t_amb'} = 'PS 2 temp';
|
||||
$base{'x4150'}->{'t_amb'} = 'System';
|
||||
$base{'x4150'}->{'ps0_f0'} = 'PS 1 fan';
|
||||
$base{'x4150'}->{'ps1_f0'} = 'PS 2 fan';
|
||||
$base{'x4150'}->{'mb_p0_v_vcc'} = 'CPU0 VCC';
|
||||
$base{'x4150'}->{'mb_p1_v_vcc'} = 'CPU1 VCC';
|
||||
$base{'x4150'}->{'mb_v_12v'} = '+12V';
|
||||
$base{'x4150'}->{'mb_v_1v5'} = '+1.5V';
|
||||
$base{'x4150'}->{'mb_v_1v8'} = '+1.8V';
|
||||
$base{'x4150'}->{'mb_v_2v5stby'} = '+2.5VSTBY';
|
||||
$base{'x4150'}->{'mb_v_3v3'} = '+3.3V';
|
||||
$base{'x4150'}->{'mb_v_3v3stby'} = '+3.3VSTBY';
|
||||
$base{'x4150'}->{'mb_v_5v'} = '+5V';
|
||||
$base{'x4150'}->{'mb_v_nic'} = 'NIC';
|
||||
$base{'x4150'}->{'mb_v_vtt'} = 'VTT';
|
||||
$base{'x4150'}->{'ps0_v_in'} = 'PS 1 voltage in';
|
||||
$base{'x4150'}->{'ps0_v_out'} = 'PS 1 voltage out';
|
||||
$base{'x4150'}->{'ps1_v_in'} = 'PS 2 voltage in';
|
||||
$base{'x4150'}->{'ps1_v_out'} = 'PS 2 voltage out';
|
||||
|
||||
# Verari VB1205XM
|
||||
$base{'vb1205'}->{'12v'} = '+12V';
|
||||
$base{'vb1205'}->{'1_2v'} = '+1.2V';
|
||||
$base{'vb1205'}->{'1_5v'} = '+1.5V';
|
||||
$base{'vb1205'}->{'3_3v'} = '+3.3V';
|
||||
$base{'vb1205'}->{'5v'} = '+5V';
|
||||
$base{'vb1205'}->{'5vsb'} = '+5VSTBY';
|
||||
$base{'vb1205'}->{'cpu1vcore'} = 'CPU1 Vcore';
|
||||
$base{'vb1205'}->{'cpu2vcore'} = 'CPU2 Vcore';
|
||||
$base{'vb1205'}->{'dash12v'} = '-12V';
|
||||
$base{'vb1205'}->{'vbat'} = 'VBAT';
|
||||
$base{'vb1205'}->{'cputemp1'} = 'CPU 1 temp';
|
||||
$base{'vb1205'}->{'cputemp2'} = 'CPU 2 temp';
|
||||
$base{'vb1205'}->{'systemp'} = 'System';
|
||||
|
||||
# Dell PowerEdge 2650
|
||||
$base{'pe2650'}->{'esmmbfan1'} = 'Fan 1';
|
||||
$base{'pe2650'}->{'esmmbfan2'} = 'Fan 2';
|
||||
$base{'pe2650'}->{'esmmbfan3'} = 'Fan 3';
|
||||
$base{'pe2650'}->{'esmmbfan4'} = 'Fan 4';
|
||||
$base{'pe2650'}->{'esmmbfan5'} = 'Fan 5';
|
||||
$base{'pe2650'}->{'esmmbfan6'} = 'Fan 6';
|
||||
$base{'pe2650'}->{'esmmbfan7'} = 'Fan 7';
|
||||
$base{'pe2650'}->{'esmmb12'} = 'MB +12V';
|
||||
$base{'pe2650'}->{'esmmb25'} = 'MB +2.5V';
|
||||
$base{'pe2650'}->{'esmmb33'} = 'MB +3.3V';
|
||||
$base{'pe2650'}->{'esmmb5'} = 'MB +5V';
|
||||
$base{'pe2650'}->{'esmmbbat'} = 'VBAT';
|
||||
$base{'pe2650'}->{'esmmbdash12'} = 'MB -12V';
|
||||
$base{'pe2650'}->{'esmrombpk'} = 'ROMB PK';
|
||||
$base{'pe2650'}->{'esmvtt'} = 'VTT';
|
||||
$base{'pe2650'}->{'esmcpu'} = 'CPU';
|
||||
$base{'pe2650'}->{'esm5aux'} = '5V AUX';
|
||||
$base{'pe2650'}->{'esmcpu1'} = 'CPU1';
|
||||
$base{'pe2650'}->{'esmcpu2'} = 'CPU2';
|
||||
$base{'pe2650'}->{'esmfrti_o'} = 'Front I/O';
|
||||
$base{'pe2650'}->{'esmriser'} = 'Riser';
|
||||
|
||||
# IBM x3200
|
||||
$base{'ibmx3xx0'}->{'planar12v'} = '+12V';
|
||||
$base{'ibmx3xx0'}->{'planar15v'} = '+1.5V';
|
||||
$base{'ibmx3xx0'}->{'planar18v'} = '+1.8V';
|
||||
$base{'ibmx3xx0'}->{'planar33v'} = '+3.3V';
|
||||
$base{'ibmx3xx0'}->{'planar5v'} = '+5V';
|
||||
$base{'ibmx3xx0'}->{'cpuvcore'} = 'CPU Vcore';
|
||||
$base{'ibmx3xx0'}->{'cpuvtt'} = 'VTT';
|
||||
$base{'ibmx3xx0'}->{'ambient'} = 'System';
|
||||
$base{'ibmx3xx0'}->{'cpu'} = 'CPU';
|
||||
# IBM x3550 extents
|
||||
$base{'ibmx3xx0'}->{'planarvbat'} = 'VBAT';
|
||||
|
||||
# IBM LS41
|
||||
$base{'ibmlsxx'}->{'12vsense'} = '+12V';
|
||||
$base{'ibmlsxx'}->{'3_3vsense'} = '+3.3V';
|
||||
$base{'ibmlsxx'}->{'5vsense'} = '+5V';
|
||||
$base{'ibmlsxx'}->{'planarvbat'} = 'VBAT';
|
||||
# IBM LS20 extents
|
||||
$base{'ibmlsxx'}->{'1_8vsense'} = '+1.8V';
|
||||
$base{'ibmlsxx'}->{'1_8vsbsense'} = '+1.8VSB';
|
||||
$base{'ibmlsxx'}->{'12vsbsense'} = '+12VSB';
|
||||
$base{'ibmlsxx'}->{'12v_isense'} = '+12V_I';
|
||||
|
||||
# IBM HS21
|
||||
$base{'ibmhsxx'}->{'planar0_9v'} = '+0.9V';
|
||||
$base{'ibmhsxx'}->{'planar12v'} = '+12V';
|
||||
$base{'ibmhsxx'}->{'planar3_3v'} = '+3.3V';
|
||||
$base{'ibmhsxx'}->{'planar5v'} = '+5V';
|
||||
$base{'ibmhsxx'}->{'planarvbat'} = 'VBAT';
|
||||
# IBM iDataplex DX320 extents
|
||||
$base{'ibmhsxx'}->{'cpu1vcore'} = 'CPU1 Vcore';
|
||||
$base{'ibmhsxx'}->{'cpu2vcore'} = 'CPU2 Vcore';
|
||||
|
||||
# Fujitsu-Siemens TX120
|
||||
$base{'tx120'}->{'12v'} = '12V';
|
||||
$base{'tx120'}->{'15v'} = '1.5V';
|
||||
$base{'tx120'}->{'18v'} = '1.8V';
|
||||
$base{'tx120'}->{'33v'} = '3.3V';
|
||||
$base{'tx120'}->{'5v'} = '5V';
|
||||
$base{'tx120'}->{'dash12v'} = '-12V';
|
||||
$base{'tx120'}->{'stdby33v'} = '3.3VSTBY';
|
||||
$base{'tx120'}->{'vtt'} = 'VTT';
|
||||
$base{'tx120'}->{'battery3v'} = '3VBAT';
|
||||
$base{'tx120'}->{'fanpsu'} = 'Fan PSU';
|
||||
$base{'tx120'}->{'fan1sys'} = 'Fan Sys 1';
|
||||
$base{'tx120'}->{'fan2sys'} = 'Fan Sys 2';
|
||||
$base{'tx120'}->{'fancpu'} = 'Fan CPU';
|
||||
$base{'tx120'}->{'ambient'} = 'Ambient';
|
||||
$base{'tx120'}->{'systemboard'} = 'System board';
|
||||
$base{'tx120'}->{'cpu'} = 'CPU';
|
||||
|
||||
# Dell DCS XS23-sc
|
||||
$base{'xs23'}->{'systemfan'} = 'System fan';
|
||||
$base{'xs23'}->{'cpu0'} = 'CPU 0';
|
||||
$base{'xs23'}->{'cpu1'} = 'CPU 1';
|
||||
$base{'xs23'}->{'midplane'} = 'Midplane';
|
||||
$base{'xs23'}->{'p12v'} = 'Planar 12V';
|
||||
$base{'xs23'}->{'p15v'} = 'Planar 1.5V';
|
||||
$base{'xs23'}->{'p18v'} = 'Planar 1.8V';
|
||||
$base{'xs23'}->{'p33v'} = 'Planar 3.3V';
|
||||
$base{'xs23'}->{'p5v'} = 'Planar 5V';
|
||||
$base{'xs23'}->{'vtt'} = 'Vtt';
|
||||
$base{'xs23'}->{'vcc33vaux'} = 'Vcc 3.3V AUX';
|
||||
|
||||
# Supermicro X8DT6 / X8DTT-F via Winbond Hermon BMC
|
||||
$base{'hermon'}->{'fan1'} = 'Fan 1';
|
||||
$base{'hermon'}->{'fan2'} = 'Fan 2';
|
||||
$base{'hermon'}->{'fan3'} = 'Fan 3';
|
||||
$base{'hermon'}->{'fan4'} = 'Fan 4';
|
||||
$base{'hermon'}->{'fan5'} = 'Fan 5';
|
||||
$base{'hermon'}->{'fan6'} = 'Fan 6';
|
||||
$base{'hermon'}->{'fan7'} = 'Fan 7';
|
||||
$base{'hermon'}->{'fan8'} = 'Fan 8';
|
||||
$base{'hermon'}->{'system'} = 'System';
|
||||
$base{'hermon'}->{'cpu1temp'} = 'CPU1 temp';
|
||||
$base{'hermon'}->{'cpu2temp'} = 'CPU2 temp';
|
||||
$base{'hermon'}->{'12v'} = '+12V';
|
||||
$base{'hermon'}->{'15v'} = '+1.5V';
|
||||
$base{'hermon'}->{'33v'} = '+3.3V';
|
||||
$base{'hermon'}->{'33vsb'} = '+3.3VSB';
|
||||
$base{'hermon'}->{'5v'} = '+5V';
|
||||
$base{'hermon'}->{'vbat'} = 'VBAT';
|
||||
$base{'hermon'}->{'cpu1dimm'} = 'CPU1 DIMM';
|
||||
$base{'hermon'}->{'cpu2dimm'} = 'CPU2 DIMM';
|
||||
$base{'hermon'}->{'cpu1vcore'} = 'CPU1 Vcore';
|
||||
$base{'hermon'}->{'cpu2vcore'} = 'CPU2 Vcore';
|
||||
|
||||
# Most of these are similar on the Supermicro X* boards
|
||||
$base{'aocipmi20e'} = $base{'hermon'};
|
||||
$base{'aocipmi20e'}->{'dash12v'} = '-12V';
|
||||
$base{'aocipmi20e'}->{'5vsb'} = '+5VSB';
|
||||
$base{'aocipmi20e'}->{'fan7_cpu1'} = 'Fan7 / CPU1';
|
||||
$base{'aocipmi20e'}->{'fan8_cpu2'} = 'Fan8 / CPU2';
|
||||
$base{'aocipmi20e'}->{'sys'} = 'System';
|
||||
|
||||
# Asus K8N-LR / HP DL145G2
|
||||
$base{'asmb2'}->{'cpufan1'} = 'CPU Fan 1';
|
||||
$base{'asmb2'}->{'cpufan2'} = 'CPU Fan 2';
|
||||
$base{'asmb2'}->{'frontfan1'} = 'Front Fan 1';
|
||||
$base{'asmb2'}->{'frontfan2'} = 'Front Fan 2';
|
||||
$base{'asmb2'}->{'rearfan1'} = 'Rear Fan 1';
|
||||
$base{'asmb2'}->{'rearfan2'} = 'Rear Fan 2';
|
||||
$base{'asmb2'}->{'cpu1thermal'} = 'CPU1';
|
||||
$base{'asmb2'}->{'systemthermal'} = 'System';
|
||||
$base{'asmb2'}->{'25vor18v'} = '+2.5V / +1.8V';
|
||||
$base{'asmb2'}->{'bat_cmos'} = 'VBAT';
|
||||
$base{'asmb2'}->{'cpuvcore1'} = 'CPU1 Vcore';
|
||||
$base{'asmb2'}->{'system12v'} = '+12V';
|
||||
$base{'asmb2'}->{'system15v'} = '+1.5V';
|
||||
$base{'asmb2'}->{'system5v'} = '+5V';
|
||||
$base{'asmb2'}->{'system3v'} = '+3V';
|
||||
$base{'asmb2'}->{'system5vsb'} = '+5VSTBY';
|
||||
|
||||
# Dell M610 blade
|
||||
$base{'m610'}->{'ambienttemp'} = 'Ambient temp';
|
||||
$base{'m610'}->{'temp'} = 'Blade temp';
|
||||
|
||||
# hpasmcli / Proliant DL385G1
|
||||
$base{'hpasmcli'}->{'cpu-1'} = 'CPU 1';
|
||||
$base{'hpasmcli'}->{'cpu-2'} = 'CPU 2';
|
||||
$base{'hpasmcli'}->{'i_o_zone'} = 'I/O zone';
|
||||
$base{'hpasmcli'}->{'power_supply_bay'} = 'PSU bay';
|
||||
$base{'hpasmcli'}->{'processor_zone'} = 'CPU zone';
|
||||
|
||||
# Machine config, run through the file/output
|
||||
my $label; my $tmp;
|
||||
foreach my $line ( @ipmioutput )
|
||||
{
|
||||
$line =~ s/\s+/ /g;
|
||||
if ( $sensor eq 'fan' && $line =~ /.*RPM.*ok/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\.speed.*/; $label = $1; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)\.tach.*/; $label = $1; }
|
||||
if ( $machine eq 'x2100') { $line =~ s/(.*)\s+\|.*RPM.*/\L$1/; $label = $line; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*) Tach.*/; $label = $1; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ s/(.*)\s+\|.*RPM.*\|\s+ok/$1/; $label = $1; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /(.*)\/TACH.*RPM.*/; $label = $1; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /(.*)\/TACH.*RPM.*/; $label = $1; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\/TACH.*RPM.*/; $label = $1; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) RPM\s+\|.*RPM.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*) Tach.*/; $label = $1; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\s+\|.*RPM.*\|\s+ok/; $label = $1; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\s+\|.*RPM.*\|\s+ok/; $label = $1; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\s+\|.*RPM.*\|\s+ok/; $label = $1; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\s+\|.*RPM.*\|\s+ok/; $label = $1; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|.*RPM.*\|\s+ok/; $label = $1; }
|
||||
|
||||
}
|
||||
elsif ( $sensor eq 'fan' && $line =~ /\#\d+\s+\S+\s+Yes.*\%/ ) {
|
||||
if ( $machine eq 'hpasmcli' ) { $line =~ /\#(\d+)\s+(.*)\s+Yes.*\%.*/; $label = "$2_$1"; }
|
||||
}
|
||||
|
||||
if ( $sensor eq 'temp' && $line =~ /.*degree.*ok/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\ \|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)temp.*/; $label = $1; }
|
||||
if ( $machine eq 'x2100') { $line =~ s/(.*)\s+\|.*deg.*/\L$1/; $label = $line; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*) Temp.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmls4x' ) { $line =~ /(.*) TEMP.*/; $label = $1; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /MB\/T\_(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /MB\/T\_(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'vb1205' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) Temp.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*) Temp.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmlsxx' ) { $line =~ /(.*) TEMP.*/; $label = $1; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\ \|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\ Temp\s+|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\ Temp\s+|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\ Temp\s+|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'm610' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
if ( $machine eq 'proliantg5' ) { $line =~ /(.*)\s+\|.*deg.*/; $label = $1; }
|
||||
}
|
||||
elsif ( $sensor eq 'temp' && $line =~ /\d+C\/\d+F/ ) {
|
||||
if ( $machine eq 'hpasmcli' ) { $line =~ /.*\s+(.*)\s+\d+C\/\d+F\s+\d+C\/\d+F/; $label = $1; }
|
||||
}
|
||||
|
||||
if ( $sensor eq 'volt' && $line =~ /.*Volts.*/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\ \|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)\ \|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'x2100') { $line =~ s/(.*)\s+\|.*Volts.*/\L$1/; $label = $line; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmls4x' ) { $line =~ /(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ /(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /MB\/V\_(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /MB\/(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'vb1205' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) Volt\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'ibmlsxx' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'ibmhsxx' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\ \|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\s+\|.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|\s+.*Volts.*/; $label = $1; }
|
||||
}
|
||||
|
||||
if ( $label )
|
||||
{
|
||||
$label =~ s/\.//g;
|
||||
$label =~ s/\-/dash/g;
|
||||
$label =~ s/\+//;
|
||||
$label =~ s/\s+//g;
|
||||
$label =~ s/(.*)/\L$1/;
|
||||
$label =~ s/\//_/g;
|
||||
$label =~ s/\#/_/g;
|
||||
|
||||
# Random fixups
|
||||
if ( $machine eq 'x2270' ) { $label =~ s/v_//; }
|
||||
if ( $machine eq 'x4x00' ) { $label =~ s/^sysv\_/mbv\_/; }
|
||||
if ( $machine eq 'tx120' ) { $label =~ s/main//; }
|
||||
|
||||
if ( $base{$machine}->{$label} )
|
||||
{
|
||||
$cnf{ $label. '.label' } = $base{$machine}->{$label};
|
||||
}
|
||||
else
|
||||
{
|
||||
$cnf{ $label. '.label' } = $label;
|
||||
}
|
||||
}
|
||||
|
||||
undef ($label);
|
||||
}
|
||||
foreach my $key ( sort(keys(%cnf)) )
|
||||
{
|
||||
print "$key $cnf{$key}\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
my %res; my $label; my $value;
|
||||
foreach my $line ( @ipmioutput )
|
||||
{
|
||||
$line =~ s/\s+/ /g;
|
||||
if ( $sensor eq 'fan' && $line =~ /.*RPM.*ok/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\.speed\s+\|\s+(\d+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)\.tach\s+\|\s+(\d+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2100' ) { $line =~ s/(.*)\s+\|\s+(\S+) RPM.*/\L$1/; $label = $line; $value = $2; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*) Tach\s+\| (\d+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|.*ok/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /(.*)\/TACH\s+\|\s+(.*) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /(.*)\/TACH\s+\|\s+(.*) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\/TACH\s+\|\s+(\S+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) RPM\s+\|\s+(\S+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*) Tach\s+\|\s+(\S+) RPM.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|\s+ok/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|\s+ok/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|\s+ok/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|\s+ok/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|\s+(.*) RPM.*\|\s+ok/; $label = $1; $value = $2; }
|
||||
}
|
||||
elsif ( $sensor eq 'fan' && $line =~ /\#\d+\s+\S+\s+Yes.*\%/ ) {
|
||||
if ( $machine eq 'hpasmcli' ) { $line =~ /\#(\d+)\s+(.*)\s+Yes\s+\w+\s+(\d+)\%.*/; $label = "$2_$1"; $value = $3; }
|
||||
}
|
||||
|
||||
if ( $sensor eq 'temp' && $line =~ /.*degree.*ok/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)temp\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2100' ) { $line =~ s/(.*)\s+\|\s+(\d+) deg.*/\L$1/; $label = $line; $value = $2; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*) Temp\s+\|\s+(\d+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmls4x' ) { $line =~ /(.*) TEMP\s+\|\s+(\d+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ /(.*)\s+\|\s+(\d+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /MB\/T\_(.*)\s+\|\s+(\d+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /MB\/T\_(.*)\s+\|\s+(\d+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\s+\|\s+(\S+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'vb1205' ) { $line =~ /(.*)\s+\|\s+(\S+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) Temp\s+\|\s+(\S+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*) Temp\s+\|\s+(\S+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmlsxx' ) { $line =~ /(.*) TEMP\s+\|\s+(\S+) deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\ Temp\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\ Temp\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\ Temp\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'm610' ) { $line =~ /(.*)\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'proliantg5' ) { $line =~ /(.*)\s+\|\s+(\S+)\ deg.*/; $label = $1; $value = $2; }
|
||||
}
|
||||
elsif ( $sensor eq 'temp' && $line =~ /\d+C\/\d+F/ ) {
|
||||
if ( $machine eq 'hpasmcli' ) { $line =~ /.*\s+(.*)\s+(\d+)C\/\d+F\s+\d+C\/\d+F/; $label = $1; $value = $2; }
|
||||
}
|
||||
|
||||
if ( $sensor eq 'volt' && $line =~ /.*Volt.*ok/ )
|
||||
{
|
||||
if ( $machine eq 'x4x00' ) { $line =~ /(.*)\ \|\s+(\S+)\ Volt.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'v20z' ) { $line =~ /(.*)\s+\|\s+(\S+)\ Volt.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2100' ) { $line =~ s/(.*)\s+\|\s+(\S+)\ Volt.*/\L$1/; $label = $line; $value = $2; }
|
||||
if ( $machine eq 'x346' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmls4x' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'shg2' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2250' ) { $line =~ /MB\/V\_(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x2270' ) { $line =~ /MB\/(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'x4150' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'vb1205' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'pe2650' ) { $line =~ /(.*) Volt\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmx3xx0' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'ibmlsxx' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'ibmhsxx' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; $label =~ s/\./_/g; }
|
||||
if ( $machine eq 'tx120' ) { $line =~ /(.*)\ \|\s+(\S+)\ Volt.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'xs23' ) { $line =~ /(.*)\ \|\s+(\S+)\ Volt.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'hermon' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'aocipmi20e' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
if ( $machine eq 'asmb2' ) { $line =~ /(.*)\s+\|\s+(\S+) Volts.*/; $label = $1; $value = $2; }
|
||||
}
|
||||
|
||||
if ( $label )
|
||||
{
|
||||
$label =~ s/\.//g;
|
||||
$label =~ s/\-/dash/g;
|
||||
$label =~ s/\+//;
|
||||
$label =~ s/\s+//g;
|
||||
$label =~ s/(.*)/\L$1/;
|
||||
$label =~ s/\//_/g;
|
||||
$label =~ s/\#/_/g;
|
||||
|
||||
# Random fixups
|
||||
if ( $machine eq 'x2270' ) { $label =~ s/v_//; }
|
||||
if ( $machine eq 'x4x00' ) { $label =~ s/^sysv\_/mbv\_/; }
|
||||
if ( $machine eq 'tx120' ) { $label =~ s/main//; }
|
||||
|
||||
|
||||
$res{$label} = $value;
|
||||
}
|
||||
undef ($label);
|
||||
}
|
||||
|
||||
my $key;
|
||||
foreach $key ( sort(keys(%res)) )
|
||||
{
|
||||
print "$key.value ".$res{$key}."\n";
|
||||
}
|
||||
|
461
plugins/sensors/ipmitool_sensor_
Executable file
461
plugins/sensors/ipmitool_sensor_
Executable file
|
@ -0,0 +1,461 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Wildcard plugin to monitor sensor by using ipmitool sensor program.
|
||||
#
|
||||
# Contributed by Jun Futagawa
|
||||
# This script is based on sensors_ plugin.
|
||||
#
|
||||
# Usage:
|
||||
# ln -s /usr/share/munin/plugins/ipmitool_sensor_ /etc/munin/plugins/ipmitool_sensor_fan
|
||||
# ln -s /usr/share/munin/plugins/ipmitool_sensor_ /etc/munin/plugins/ipmitool_sensor_temp
|
||||
# ln -s /usr/share/munin/plugins/ipmitool_sensor_ /etc/munin/plugins/ipmitool_sensor_volt
|
||||
#
|
||||
# Requirements:
|
||||
# - OpenIPMI tool (ipmitool command)
|
||||
#
|
||||
# Note:
|
||||
# - Sensor names are read from the output of the ipmitool sensor program.
|
||||
#
|
||||
# Add the following to your /etc/munin/plugin-conf.d/munin-node:
|
||||
#
|
||||
# [ipmitool_sensor*]
|
||||
# user root
|
||||
# timeout 20
|
||||
#
|
||||
# If you want to use "ipmitool sdr", add the following:
|
||||
# Note: When you use this, the threshold provided by the sensor board is not used.
|
||||
#
|
||||
# [ipmitool_sensor*]
|
||||
# user root
|
||||
# timeout 20
|
||||
# env.ipmitool_options sdr
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
# suggest
|
||||
#
|
||||
# Configurable variables
|
||||
#
|
||||
# ipmitool - ipmitool command (default: ipmitool)
|
||||
# ipmitool_options - ipmitool command options (default: sensor)
|
||||
# sdr: you can use 'sdr' instead of sensor.
|
||||
# cache_file - cache file
|
||||
# (default: /var/lib/munin/plugin-state/plugin-ipmitool_sensor.cache)
|
||||
# cache_expires - cache expires (default: 275)
|
||||
#
|
||||
# fan_type_regex - Regular expression for unit of fan (default: RPM)
|
||||
# temp_type_regex - Regular expression for unit of temp (default: degrees C)
|
||||
# volt_type_regex - Regular expression for unit of volt (default: (Volts|Watts|Amps))
|
||||
#
|
||||
# fan_warn_percent - Percentage over mininum for warning (default: 5)
|
||||
# fan_lower_critical - Preferred lower critical value for fan
|
||||
# fan_upper_critical - Preferred upper critical value for fan
|
||||
# temp_lower_critical - Preferred lower critical value for temp
|
||||
# temp_lower_warning - Preferred lower warining value for temp
|
||||
# temp_upper_warning - Preferred upper warning value for temp
|
||||
# temp_upper_critical - Preferred upper critical value for temp
|
||||
# volt_warn_percent - Percentage over mininum/under maximum for warning
|
||||
# Narrow the voltage bracket by this. (default: 20)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.6 2011/02/07 12:50:00 jfut
|
||||
# Bug fix: Check temp_upper_warning and temp_upper_critical was not working again.
|
||||
#
|
||||
# Revision 1.5 2011/01/28 00:39:00 jfut
|
||||
# Bug fix: Check temp_upper_warning and temp_upper_critical was not working.
|
||||
#
|
||||
# Revision 1.4 2009/02/08 23:51:00 jfut
|
||||
# Support "ipmitool sdr".
|
||||
# Add Watts and Amp as voltage unit.
|
||||
# Add fan_type_regex/temp_type_regex/volt_type_regex as option of sensor type.
|
||||
#
|
||||
# Revision 1.3 2008/11/11 13:55:00 jfut
|
||||
# Add infinity value check for HP ProLiant DL160.
|
||||
# Add preferred value option for fan and temp.
|
||||
#
|
||||
# Revision 1.2 2008/10/28 19:21:22 jfut
|
||||
# Add file check.
|
||||
#
|
||||
# Revision 1.1 2008/10/27 18:52:31 jfut
|
||||
# Add cache mechanism.
|
||||
#
|
||||
# Revision 1.0 2008/10/27 14:25:12 jfut
|
||||
# Initial release.
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=manual
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
use strict;
|
||||
|
||||
$ENV{'LANG'} = "C"; # Force parseable output from sensors.
|
||||
$ENV{'LC_ALL'} = "C"; # Force parseable output from sensors.
|
||||
my $IPMITOOL = $ENV{'ipmitool'} || 'ipmitool';
|
||||
my @IPMITOOL_OPTS = exists $ENV{'ipmitool_options'} ? split(/\s+/, $ENV{'ipmitool_options'}) : ('sensor');
|
||||
|
||||
my $CACHE_DIR = "/var/lib/munin/plugin-state";
|
||||
my $CACHE_FILE = $ENV{'cache_file'} || "$CACHE_DIR/plugin-ipmitool_sensor.cache";
|
||||
my $CACHE_EXPIRES = $ENV{'cache_expires'} || 275;
|
||||
|
||||
my %config = (
|
||||
fan => {
|
||||
regex => exists $ENV{'fan_type_regex'} ? qr/$ENV{'fan_type_regex'}/im : qr/RPM/im,
|
||||
title => 'IPMITool Sensor: Fans',
|
||||
vtitle => 'RPM',
|
||||
print_threshold => \&fan_threshold,
|
||||
graph_args => '--base 1000 -l 0'
|
||||
},
|
||||
temp => {
|
||||
regex => exists $ENV{'temp_type_regex'} ? qr/$ENV{'temp_type_regex'}/im : qr/degrees C/im,
|
||||
title => 'IPMITool Sensor: Temperatures',
|
||||
vtitle => 'Celsius',
|
||||
print_threshold => \&temp_threshold,
|
||||
graph_args => '--base 1000 -l 0'
|
||||
},
|
||||
volt => {
|
||||
regex => exists $ENV{'volt_type_regex'} ? qr/$ENV{'volt_type_regex'}/im : qr/(Volts|Watts|Amps)/im,
|
||||
title => 'IPMITool Sensor: Voltages',
|
||||
vtitle => '_AUTO_DETECT_FAILED_',
|
||||
print_threshold => \&volt_threshold,
|
||||
graph_args => '--base 1000'
|
||||
},
|
||||
);
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'autoconf') {
|
||||
close(STDERR);
|
||||
my $ret = system($IPMITOOL);
|
||||
open (STDERR, ">&STDOUT");
|
||||
if ($ret == 0 || $ret == 256) {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
} else {
|
||||
print "no (program $IPMITOOL not found)\n";
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'suggest') {
|
||||
my $text = get_sensor_data();
|
||||
my $alltext = join('\n', @{$text});
|
||||
foreach my $func (keys %config) {
|
||||
print $func, "\n" if $alltext =~ $config{$func}->{regex};
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
$0 =~ /ipmitool_sensor_(.+)*$/;
|
||||
my $func = $1;
|
||||
exit 2 unless defined $func;
|
||||
|
||||
my $text = get_sensor_data();
|
||||
my $sensor = 1;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq 'config') {
|
||||
# detect the unit of volt
|
||||
if ($func eq 'volt') {
|
||||
foreach my $line (@{$text}) {
|
||||
if ($line =~ /$config{$func}->{regex}/) {
|
||||
my ($label, $value, $unit, $lcr, $lnc, $unc, $ucr) = &get_sensor_items($line, $config{$func}->{regex});
|
||||
$config{$func}->{vtitle} = $unit;
|
||||
last;
|
||||
}
|
||||
}
|
||||
$text = get_sensor_data();
|
||||
}
|
||||
|
||||
# print header
|
||||
print "graph_title $config{$func}->{title}\n";
|
||||
print "graph_vtitle $config{$func}->{vtitle}\n";
|
||||
print "graph_args $config{$func}->{graph_args}\n";
|
||||
print "graph_category sensors\n";
|
||||
|
||||
# print data
|
||||
foreach my $line (@{$text}) {
|
||||
if ($line =~ /$config{$func}->{regex}/) {
|
||||
my ($label, $value, $unit, $lcr, $lnc, $unc, $ucr) = &get_sensor_items($line, $config{$func}->{regex});
|
||||
if (&is_valid_value($value)) {
|
||||
print "$func$sensor.label $label\n";
|
||||
$config{$func}->{print_threshold}->($func.$sensor, $lcr, $lnc, $unc, $ucr);
|
||||
print "$func$sensor.graph no\n" if exists $ENV{"ignore_$func$sensor"};
|
||||
$sensor++;
|
||||
}
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
foreach my $line (@{$text}) {
|
||||
if ($line =~ /$config{$func}->{regex}/) {
|
||||
my ($label, $value, $unit, $lcr, $lnc, $unc, $ucr) = &get_sensor_items($line, $config{$func}->{regex});
|
||||
# for debug
|
||||
# print "$func$sensor.value [$label] [$value] [$lcr] [$lnc] [$unc] [$ucr]\n";
|
||||
if (&is_valid_value($value)) {
|
||||
print "$func$sensor.value $value\n";
|
||||
$sensor++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub get_sensor_data {
|
||||
my $text = undef;
|
||||
if (-f $CACHE_FILE) {
|
||||
my $cache_timestamp = (stat($CACHE_FILE))[9];
|
||||
if ($CACHE_EXPIRES == -1 || time - $cache_timestamp <= $CACHE_EXPIRES) {
|
||||
open(IN, "<", $CACHE_FILE) or die "Could not open \"$CACHE_FILE\" for reading\n";
|
||||
while (<IN>) {
|
||||
push (@{$text}, $_);
|
||||
}
|
||||
close(IN);
|
||||
}
|
||||
}
|
||||
if (! defined $text) {
|
||||
my $pid = open(EXE, '-|');
|
||||
if ($pid == 0) {
|
||||
exec($IPMITOOL, @IPMITOOL_OPTS);
|
||||
} elsif (defined $pid) {
|
||||
while(<EXE>) {
|
||||
push (@{$text}, $_);
|
||||
}
|
||||
close(EXE);
|
||||
} else {
|
||||
die "fork failed: $!";
|
||||
}
|
||||
if (-w $CACHE_DIR) {
|
||||
open(OUT, ">", $CACHE_FILE) or die "Could not open \"$CACHE_FILE\" for writing\n";
|
||||
foreach my $line (@{$text}) {
|
||||
print OUT "$line";
|
||||
}
|
||||
close OUT;
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
sub get_sensor_items {
|
||||
my ($line, $regex) = @_;
|
||||
my @items = split(/\s*\|\s*/, $line);
|
||||
my ($label, $value, $unit, $lcr, $lnc, $unc, $ucr)
|
||||
= (trim($items[0]), trim($items[1]), trim($items[2]), trim($items[5]), trim($items[6]), trim($items[7]), trim($items[8]));
|
||||
if ($#items == 9) {
|
||||
# ipmitool sensor
|
||||
} elsif ($#items == 2) {
|
||||
# ipmitool sdr
|
||||
if ($value =~ /$regex/) {
|
||||
$value = trim($`);
|
||||
$unit = trim($1);
|
||||
}
|
||||
}
|
||||
|
||||
# some boards show data in incorrect order.
|
||||
# - HP ProLiant ML110 G5
|
||||
# CPU FAN | 1434.309 | RPM | ok | 5537.099 | 4960.317 | 4859.086 | na | 937.383 | na
|
||||
# SYSTEM FAN | 1506.932 | RPM | ok | 5952.381 | 5668.934 | 5411.255 | na | 937.383 | na
|
||||
# - HP ProLiant DL160
|
||||
# FAN1 ROTOR1 | 7680.492 | RPM | ok | na | inf | na | na | 1000.400 | na
|
||||
if (&is_valid_value($lcr) && &is_valid_value($ucr) && $lcr > $ucr || $lcr eq 'inf') {
|
||||
($lcr, $lnc, $unc, $ucr) = ($ucr, $unc, $lnc, $lcr);
|
||||
}
|
||||
if (&is_valid_value($lnc) && &is_valid_value($unc) && $lnc > $unc || $lnc eq 'inf') {
|
||||
($lcr, $lnc, $unc, $ucr) = ($ucr, $unc, $lnc, $lcr);
|
||||
}
|
||||
return ($label, $value, $unit, $lcr, $lnc, $unc, $ucr);
|
||||
}
|
||||
|
||||
sub fan_threshold {
|
||||
my ($name, $lcr, $lnc, $unc, $ucr) = @_;
|
||||
my $warn_percent = exists $ENV{fan_warn_percent} ? $ENV{fan_warn_percent} : 5;
|
||||
|
||||
# lcr: lower critical
|
||||
if (exists $ENV{fan_lower_critical}) {
|
||||
$lcr = $ENV{fan_lower_critical};
|
||||
} elsif (! &is_valid_value($lcr)) {
|
||||
if ($lcr eq 'inf') { $lcr = ''; }
|
||||
else { $lcr = '50'; }
|
||||
}
|
||||
# lnc: lower warning
|
||||
if (! &is_valid_value($lnc)) {
|
||||
if ($lnc eq 'inf') { $lnc = ''; }
|
||||
else { $lnc = ($lcr eq '') ? '' : $lcr * (100 + $warn_percent) / 100; }
|
||||
}
|
||||
# ucr: upper critical
|
||||
if (exists $ENV{fan_upper_critical}) {
|
||||
$ucr = $ENV{fan_upper_critical};
|
||||
} elsif (! &is_valid_value($ucr)) {
|
||||
if ($ucr eq 'inf') { $ucr = ''; }
|
||||
else { $ucr = '6000'; }
|
||||
}
|
||||
# unc: upper warning
|
||||
if (! &is_valid_value($unc)) {
|
||||
if ($unc eq 'inf') { $unc = ''; }
|
||||
else { $unc = ($ucr eq '') ? '' : $ucr * (100 - $warn_percent) / 100; }
|
||||
}
|
||||
|
||||
return unless ($lcr ne '' || $lnc ne '' || $unc ne '' || $ucr ne '');
|
||||
|
||||
printf "$name.warning $lnc:$unc\n";
|
||||
printf "$name.critical $lcr:$ucr\n";
|
||||
}
|
||||
|
||||
sub temp_threshold {
|
||||
my ($name, $lcr, $lnc, $unc, $ucr) = @_;
|
||||
|
||||
# lcr: lower critical
|
||||
if (exists $ENV{temp_lower_critical}) {
|
||||
$lcr = $ENV{temp_lower_critical};
|
||||
} elsif (! &is_valid_value($lcr)) {
|
||||
if ($lcr eq 'inf') { $lcr = ''; }
|
||||
else { $lcr = 5; }
|
||||
}
|
||||
# lnc: lower warning
|
||||
if (exists $ENV{temp_lower_warning}) {
|
||||
$lnc = $ENV{temp_lower_warning};
|
||||
} elsif (! &is_valid_value($lnc)) {
|
||||
if ($lnc eq 'inf') { $lnc = ''; }
|
||||
else { $lnc = 10; }
|
||||
}
|
||||
# unc: upper warning
|
||||
if (exists $ENV{temp_upper_warning}) {
|
||||
$unc = $ENV{temp_upper_warning};
|
||||
} elsif (! &is_valid_value($unc)) {
|
||||
if ($unc eq 'inf') { $unc = ''; }
|
||||
else { $unc = '65'; }
|
||||
}
|
||||
# ucr: upper critical
|
||||
if (exists $ENV{temp_upper_critical}) {
|
||||
$ucr = $ENV{temp_upper_critical};
|
||||
} elsif (! &is_valid_value($ucr)) {
|
||||
if ($ucr eq 'inf') { $ucr = ''; }
|
||||
else { $ucr = '70'; }
|
||||
}
|
||||
|
||||
return unless ($lcr ne '' || $lnc ne '' || $unc ne '' || $ucr ne '');
|
||||
|
||||
printf "$name.warning $lnc:$unc\n";
|
||||
printf "$name.critical $lcr:$ucr\n";
|
||||
}
|
||||
|
||||
sub volt_threshold {
|
||||
my ($name, $lcr, $lnc, $unc, $ucr) = @_;
|
||||
my $warn_percent = exists $ENV{volt_warn_percent} ? $ENV{volt_warn_percent} : 20;
|
||||
|
||||
if (! &is_valid_value($lcr)) { $lcr = ''; }
|
||||
if (! &is_valid_value($lnc)) { $lnc = ($lcr eq '') ? '' : $lcr * (100 + $warn_percent) / 100; }
|
||||
if (! &is_valid_value($ucr)) { $ucr = ''; }
|
||||
if (! &is_valid_value($unc)) { $unc = ($ucr eq '') ? '' : $ucr * (100 - $warn_percent) / 100; }
|
||||
|
||||
return unless ($lcr ne '' || $lnc ne '' || $unc ne '' || $ucr ne '');
|
||||
|
||||
printf "$name.warning $lnc:$unc\n";
|
||||
printf "$name.critical $lcr:$ucr\n";
|
||||
}
|
||||
|
||||
sub trim {
|
||||
my $value = shift;
|
||||
if (defined $value) {
|
||||
$value =~ s/^\s*(.*?)\s*$/$1/;
|
||||
} else {
|
||||
$value = 'na'
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
sub is_valid_value() {
|
||||
my $value = shift;
|
||||
if ($value eq 'na' || $value eq 'inf' || $value eq '') {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
########################################
|
||||
|
||||
=head1 How to test
|
||||
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_volt
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_volt config
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_volt suggest
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_volt autoconf
|
||||
fan_warn_percent=50 fan_lower_critical=100 fan_upper_critical=1000 cache_file=ipmitool_sensor_ \
|
||||
cache_expires=-1 ./ipmitool_sensor_fan config
|
||||
temp_lower_warning=1 temp_lower_critical=2 temp_upper_critical=71 temp_upper_warning=72 \
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_temp config
|
||||
volt_warn_percent=50 \
|
||||
cache_file=ipmitool_sensor_ cache_expires=-1 ./ipmitool_sensor_volt config
|
||||
|
||||
=head1 Test Data
|
||||
|
||||
unr Upper Non-Recoverable
|
||||
ucr Upper Critical
|
||||
unc Upper Non-Critical
|
||||
lnc Lower Non-Critical
|
||||
lcr Lower Critical
|
||||
lnr Lower Non-Recoverable
|
||||
|
||||
=head2 ipmitool sensor
|
||||
|
||||
# HP ProLiant ML110 G5
|
||||
CPU FAN | 1434.309 | RPM | ok | 5537.099 | 4960.317 | 4859.086 | na | 937.383 | na
|
||||
SYSTEM FAN | 1497.454 | RPM | ok | 5952.381 | 5668.934 | 5411.255 | na | 937.383 | na
|
||||
System 12V | 12.152 | Volts | ok | na | na | na | na | na | na
|
||||
System 5V | 5.078 | Volts | ok | na | na | na | na | na | na
|
||||
System 3.3V | 3.271 | Volts | ok | na | na | na | na | na | na
|
||||
CPU0 Vcore | 1.127 | Volts | ok | na | na | na | na | na | na
|
||||
System 1.25V | 1.254 | Volts | ok | na | na | na | na | na | na
|
||||
System 1.8V | 1.842 | Volts | ok | na | na | na | na | na | na
|
||||
System 1.2V | 1.107 | Volts | ok | na | na | na | na | na | na
|
||||
CPU0 Diode | na | degrees C | na | na | 20.000 | 25.000 | 85.000 | 90.000 | 95.000
|
||||
CPU0 Dmn 0 Temp | 24.500 | degrees C | ok | na | 0.000 | 0.000 | 97.000 | 100.000 | 100.500
|
||||
CPU0 Dmn 1 Temp | 29.000 | degrees C | ok | na | 0.000 | 0.000 | 97.000 | 100.000 | 100.500
|
||||
# HP ProLiant DL160
|
||||
FAN1 ROTOR1 | 7680.492 | RPM | ok | na | inf | na | na | 1000.400 | na
|
||||
# HP ProLiant DL360 G5
|
||||
Fan Block 1 | 34.888 | unspecified | nc | na | na | 75.264 | na | na | na
|
||||
Fan Block 2 | 29.792 | unspecified | nc | na | na | 75.264 | na | na | na
|
||||
Fan Block 3 | 37.240 | unspecified | nc | na | na | 75.264 | na | na | na
|
||||
Fan Blocks | 0.000 | unspecified | nc | na | na | 0.000 | na | na | na
|
||||
Temp 1 | 40.000 | degrees C | ok | na | na | -64.000 | na | na | na
|
||||
Temp 2 | 21.000 | degrees C | ok | na | na | -64.000 | na | na | na
|
||||
Temp 3 | 30.000 | degrees C | ok | na | na | -64.000 | na | na | na
|
||||
Temp 4 | 30.000 | degrees C | ok | na | na | -64.000 | na | na | na
|
||||
Temp 5 | 28.000 | degrees C | ok | na | na | -64.000 | na | na | na
|
||||
Temp 6 | na | degrees C | na | na | na | 32.000 | na | na | na
|
||||
Temp 7 | na | degrees C | na | na | na | 32.000 | na | na | na
|
||||
Power Meter | 214.000 | Watts | cr | na | na | 384.000 | na | na | na
|
||||
Power Meter 2 | 220.000 | watts | cr | na | na | 384.000 | na | na | na
|
||||
|
||||
=head2 ipmitool sdr
|
||||
|
||||
# HP ProLiant ML110 G5
|
||||
CPU FAN | 1434.31 RPM | ok
|
||||
SYSTEM FAN | 1497.45 RPM | ok
|
||||
System 12V | 12.10 Volts | ok
|
||||
System 5V | 5.08 Volts | ok
|
||||
System 3.3V | 3.27 Volts | ok
|
||||
CPU0 Vcore | 1.14 Volts | ok
|
||||
System 1.25V | 1.25 Volts | ok
|
||||
System 1.8V | 1.84 Volts | ok
|
||||
System 1.2V | 1.11 Volts | ok
|
||||
CPU0 Diode | disabled | ns
|
||||
CPU0 Dmn 0 Temp | 23.50 degrees C | ok
|
||||
CPU0 Dmn 1 Temp | 29 degrees C | ok
|
||||
# HP ProLiant DL360 G5
|
||||
Fan Block 1 | 34.89 unspecifi | nc
|
||||
Fan Block 2 | 29.79 unspecifi | nc
|
||||
Fan Block 3 | 37.24 unspecifi | nc
|
||||
Fan Blocks | 0 unspecified | nc
|
||||
Temp 1 | 41 degrees C | ok
|
||||
Temp 2 | 19 degrees C | ok
|
||||
Temp 3 | 30 degrees C | ok
|
||||
Temp 4 | 30 degrees C | ok
|
||||
Temp 5 | 26 degrees C | ok
|
||||
Temp 6 | disabled | ns
|
||||
Temp 7 | disabled | ns
|
||||
Power Meter | 208 Watts | cr
|
||||
Power Meter 2 | 210 watts | cr
|
||||
|
||||
=cut
|
||||
|
||||
# vim:syntax=perl
|
69
plugins/sensors/k8temp
Executable file
69
plugins/sensors/k8temp
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# k8temp
|
||||
#
|
||||
# Plugin to monitor the CPU temperature through lm-sensors
|
||||
# on multicore AMD cpus
|
||||
#
|
||||
# Author: Marc Schiffbauer <marc@schiffbauer.net>
|
||||
#
|
||||
# Requirements:
|
||||
# - A configured lm-sensors installation with k8temp kernel module
|
||||
# - rewuired shell commands: sensors, grep, sed, uniq, cut
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# capabilities=autoconf
|
||||
|
||||
# VERSION 1.0
|
||||
|
||||
case $1 in
|
||||
config)
|
||||
I=1
|
||||
LAST_CORE=""
|
||||
echo "graph_title CPU temperature"
|
||||
echo "graph_vlabel temperature in °C"
|
||||
echo "graph_options light"
|
||||
echo "graph_info This graph shows temperature of all CPU cores in °C"
|
||||
echo "graph_category sensors"
|
||||
sensors -uA | grep "^Core" | while read CORE FOO TEMP REST; do
|
||||
if [ "$LAST_CORE" == "$CORE" ]; then
|
||||
I=$((I+1))
|
||||
else
|
||||
I=1
|
||||
fi
|
||||
LAST_CORE=$CORE
|
||||
CORE_NUM=$(echo $CORE | sed 's/Core//')
|
||||
echo "core${CORE_NUM}_${I}.label Core ${CORE_NUM} sensor $I"
|
||||
#echo "core${CORE_NUM}_${I}.draw LINE1"
|
||||
echo "core${CORE_NUM}_${I}.warning 65"
|
||||
echo "core${CORE_NUM}_${I}.critical 80"
|
||||
done
|
||||
exit 0
|
||||
;;
|
||||
autoconf)
|
||||
if [ "$(sensors -uA | grep "^Core" | uniq)" ]; then
|
||||
echo "yes"
|
||||
exit 0
|
||||
else
|
||||
echo "no"
|
||||
exit 1
|
||||
fi
|
||||
esac
|
||||
|
||||
sensors -uA | grep "^Core" | while read CORE FOO TEMP REST; do
|
||||
if [ "$LAST_CORE" == "$CORE" ]; then
|
||||
I=$((I+1))
|
||||
else
|
||||
I=1
|
||||
fi
|
||||
LAST_CORE=$CORE
|
||||
CORE_NUM=$(echo $CORE | sed 's/Core//')
|
||||
TEMP=$(echo $TEMP | cut -d"." -f1)
|
||||
echo "core${CORE_NUM}_${I}.value $TEMP"
|
||||
done
|
||||
|
61
plugins/sensors/mbmon
Executable file
61
plugins/sensors/mbmon
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
#
|
||||
# Author: Slaven Rezic
|
||||
#
|
||||
# Copyright (C) 2011 Slaven Rezic. All rights reserved.
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the same terms as Perl itself.
|
||||
#
|
||||
# Mail: slaven@rezic.de
|
||||
# WWW: http://www.rezic.de/eserte/
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
my $mbmon = "/usr/local/bin/mbmon";
|
||||
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
if (-x $mbmon) {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
} else {
|
||||
print "no\n";
|
||||
exit 1;
|
||||
}
|
||||
} elsif ($ARGV[0] eq 'config') {
|
||||
print <<EOF;
|
||||
graph_title CPU temperature
|
||||
graph_order temp0 temp1 temp2
|
||||
graph_args --base 1000 -l 0
|
||||
graph_category sensors
|
||||
graph_vlabel temp in °C
|
||||
temp0.label Temperature0
|
||||
temp1.label Temperature1
|
||||
temp2.label Temperature2
|
||||
EOF
|
||||
|
||||
## more info from mbmon
|
||||
# fan0
|
||||
# fan1
|
||||
# fan2
|
||||
# vc0
|
||||
# vc1
|
||||
# v33
|
||||
# v50p
|
||||
# V12P
|
||||
# V12N
|
||||
# V50N
|
||||
|
||||
} else {
|
||||
my(@res) = `$mbmon -r -c 1`;
|
||||
chomp @res;
|
||||
for my $line (@res) {
|
||||
my($k,$v) = split /\s*:\s*/, $line, 2;
|
||||
$k = lc $k;
|
||||
if ($k =~ m{^temp[012]$}) {
|
||||
print "$k.value $v\n";
|
||||
}
|
||||
}
|
||||
}
|
92
plugins/sensors/megaraid-hdd-temperature-using-megacli
Executable file
92
plugins/sensors/megaraid-hdd-temperature-using-megacli
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Plugin to monitor harddrive temperatures connected to a MegaRAID controller
|
||||
#
|
||||
# Plugin must be ran as root so add these configuration in
|
||||
# /etc/munin/plugin-conf.d/munin-node.
|
||||
#
|
||||
# [megacli*]
|
||||
# user root
|
||||
#
|
||||
# -----------
|
||||
# 2011-06-10 ver 1.0
|
||||
# - initial version
|
||||
|
||||
|
||||
# TODO
|
||||
# - allow override of tool path via config
|
||||
|
||||
# 32-bit or 64-bit
|
||||
if [[ $( uname -a | grep x86_64 ) ]]
|
||||
then
|
||||
MEGACLI='/opt/MegaRAID/MegaCli/MegaCli64'
|
||||
else
|
||||
MEGACLI='/opt/MegaRAID/MegaCli/MegaCli'
|
||||
fi
|
||||
|
||||
if [[ ! -x $MEGACLI ]]
|
||||
then
|
||||
echo "FATAL ERROR: $MEGACLI not found or not executable!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -a output
|
||||
|
||||
IFS=$'\n'
|
||||
output=($($MEGACLI -PDList -aALL -NoLog | grep -E 'Inquiry Data:|Drive Temperature' | cut -f2 -d:))
|
||||
unset IFS
|
||||
|
||||
# TODO
|
||||
# - if array size is odd, there's a problem, exit?
|
||||
output_size=${#output[*]}
|
||||
|
||||
if [ "$1" = "config" ]
|
||||
then
|
||||
|
||||
echo 'graph_title MegaCli HDD temperature'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
|
||||
i=0
|
||||
while [[ $i -lt $output_size ]]
|
||||
do
|
||||
if [ $((i % 2)) -eq 0 ]
|
||||
then
|
||||
|
||||
label=$( echo ${output[$i]} | perl -ne \
|
||||
's/^\s*|\s*$//; print;' )
|
||||
|
||||
# TODO:
|
||||
# - add other brands??
|
||||
|
||||
# remove brand name, just model and serial number
|
||||
label_graph=$( echo ${output[$i]} | perl -ne \
|
||||
's/SEAGATE|MAXTOR|WDC//i; s/^\s*|\s*$//; print;' )
|
||||
|
||||
echo $(echo $label | tr ' ' _).label $label_graph
|
||||
fi
|
||||
|
||||
(( i++ ))
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# print label and corresponding value
|
||||
# - even -> label
|
||||
# - odd -> value
|
||||
i=0
|
||||
while [[ $i -lt $output_size ]]
|
||||
do
|
||||
if [ $((i % 2)) -eq 0 ]
|
||||
then
|
||||
label=$( echo ${output[$i]} | perl -ne 's/^\s*|\s*$//; print;' )
|
||||
echo -n $(echo $label | tr ' ' _).value
|
||||
else
|
||||
value=$( echo ${output[$i]} | cut -f1 -dC )
|
||||
echo " $value"
|
||||
fi
|
||||
|
||||
(( i++ ))
|
||||
done
|
93
plugins/sensors/nut
Executable file
93
plugins/sensors/nut
Executable file
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
# This script is intended for use with Munin to monitor
|
||||
# UPS Load, Battery Charge, Input and Output Voltages
|
||||
# querying data from NUT (www.networkupstools.org), tested under Ubuntu Linux
|
||||
# v. 1.1, 12/16/2007
|
||||
# (c) Alex Yanchenko (yanchenko{at}gmail.com), 2007
|
||||
# Distributed under GPL v.3 (http://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
#
|
||||
# The plugin can utilize automatic configuration,
|
||||
# here are the basic steps (require root privileges):
|
||||
# 1. Copy it as /usr/share/munin/plugins/nut_
|
||||
# 2. Make executable: "chmod 755 /usr/share/munin/plugins/nut_"
|
||||
# 3. Run "munin-node-configure --shell", you should see smth like
|
||||
# "ln -s /usr/share/munin/plugins/nut_ /etc/munin/plugins/nut_apc_AT_localhost"
|
||||
# with "apc@localhost" been UPS configured in upsmon.conf (see NUT docs).
|
||||
# Note that "@" is replaced with "_AT_".
|
||||
# Multiple UPS monitoring is supported as well.
|
||||
# 4. Run the proposed command to create a link.
|
||||
# 5. To verify, run "munin-node-configure", you should notice the "nut_" record
|
||||
#
|
||||
# Plugin | Used | Suggestions
|
||||
# ------ | ---- | -----------
|
||||
# nut_ | yes | apc_AT_localhost
|
||||
#
|
||||
# 6. Restart munin: "/etc/init.d/munin-node restart"
|
||||
# 7. Hold on for 5 minutes at most and watch the graph appear.
|
||||
# 8. Customize voltage warning that are commented out for now.
|
||||
#
|
||||
#%# family=contrib
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
function FETCH_DATA() {
|
||||
# UPS address, fetched from file name
|
||||
UPS=$(basename $0 | sed 's|^nut_||g' | sed 's|_AT_|@|g')
|
||||
|
||||
# Save data into variables
|
||||
model=$(upsc $UPS | grep ups.model: | cut -d" " -f2)
|
||||
in=$(upsc $UPS | grep input.voltage: | cut -d" " -f2)
|
||||
out=$(upsc $UPS | grep output.voltage: | cut -d" " -f2)
|
||||
load=$(upsc $UPS | grep ups.load: | cut -d" " -f2)
|
||||
charge=$(upsc $UPS | grep battery.charge: | cut -d" " -f2)
|
||||
}
|
||||
|
||||
# Munin routines
|
||||
case "$1" in
|
||||
autoconf)
|
||||
grep ^MONITOR < /etc/nut/upsmon.conf &> /dev/null
|
||||
if [[ "$?" = "0" ]]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo "no (NUT not installed or no UPS info available in /etc/nut/upsmon.conf)"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
config)
|
||||
FETCH_DATA
|
||||
cat << EOM
|
||||
graph_title UPS: $model - $UPS
|
||||
graph_category sensors
|
||||
graph_info The graph shows UPS info monitored by NUT.
|
||||
graph_args --base 1000 --lower-limit 0
|
||||
in.label Input Voltage (v)
|
||||
in.warning 190:260
|
||||
out.label Output Voltage (v)
|
||||
out.critical 208:253
|
||||
charge.label Battery Charge (%)
|
||||
charge.draw AREA
|
||||
charge.colour 00aaaa
|
||||
charge.warning 30:
|
||||
load.label UPS Load (%)
|
||||
load.colour ff0000
|
||||
load.warning :80
|
||||
EOM
|
||||
exit 0
|
||||
;;
|
||||
suggest)
|
||||
grep ^MONITOR < /etc/nut/upsmon.conf | cut -d" " -f2 | sed 's|@|_AT_|g'
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
|
||||
FETCH_DATA
|
||||
# Print data for Munin
|
||||
cat << EOM
|
||||
in.value $in
|
||||
out.value $out
|
||||
charge.value $charge
|
||||
load.value $load
|
||||
EOM
|
||||
exit 0
|
||||
;;
|
||||
esac
|
318
plugins/sensors/nutups2_
Executable file
318
plugins/sensors/nutups2_
Executable file
|
@ -0,0 +1,318 @@
|
|||
#! /usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
nutups2_ - Plugin to monitor UPSes managed by NUT
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Generally none needed.
|
||||
|
||||
If you have installed NUT at a non-standard location, then you can specify its
|
||||
location like:
|
||||
|
||||
[nutups2_*]
|
||||
env.upsc /some/location/bin/upsc
|
||||
|
||||
=head1 WARNING AND CRITICAL SETTINGS
|
||||
|
||||
If upsc reports 'high' and 'low' values for some attribute, those will used
|
||||
as the critical range. Otherwise the following environment variables can be
|
||||
used to set the defaults for all fields:
|
||||
|
||||
env.warning
|
||||
env.critical
|
||||
|
||||
You can also control individual fields like:
|
||||
|
||||
env.input_L1.warning
|
||||
env.output.critical
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
=head1 FEATURES
|
||||
|
||||
The plugin supports reporting battery charge, UPS load, input/output
|
||||
frequencies/currents/voltages, apparent and real power output, humidity and
|
||||
temperature readings. Note however that different UPS models report different
|
||||
levels of detail; the plugin reports whatever information the NUT UPS driver
|
||||
(and in turn the UPS itself) provides.
|
||||
|
||||
Although the 'suggest' command will only offer UPSes for which the local host
|
||||
is the master, you can also monitor remote UPSes if you include the host name
|
||||
in the symlink, like:
|
||||
|
||||
nutups2_<upsname>@<hostname or address>_frequency
|
||||
|
||||
etc.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Gábor Gombás <gombasg@sztaki.hu>
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2 or later
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Munin::Plugin;
|
||||
use Carp;
|
||||
|
||||
my $UPSC = $ENV{'upsc'} || 'upsc';
|
||||
|
||||
# For the 'filter' field, the first sub-match should contain the name to
|
||||
# display, and the second sub-match should indicate if it is a nominal
|
||||
# value instead of a sensor reading.
|
||||
my %config = (
|
||||
charge => {
|
||||
filter => qr/^(.*)\.(?:charge|load)$/,
|
||||
title => 'UPS load and battery charge',
|
||||
args => '--base 1000 -l 0 -u 100',
|
||||
vlabel => '%',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
current => {
|
||||
filter => qr/^(.*)\.current(\.nominal)?$/,
|
||||
title => 'UPS current',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'Amper',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
frequency => {
|
||||
filter => qr/^(.*)\.frequency(\.nominal)?$/,
|
||||
title => 'UPS frequency',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'Hz',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
humidity => {
|
||||
filter => qr/^(.*)\.humidity$/,
|
||||
title => 'UPS humidity',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => '%',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
power => {
|
||||
filter => qr/^(.*)\.power(\.nominal)?$/,
|
||||
title => 'UPS apparent power',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'VA',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
realpower => {
|
||||
filter => qr/^(.*)\.realpower(\.nominal)?$/,
|
||||
title => 'UPS real power',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'Watt',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
temperature => {
|
||||
filter => qr/^(.*)\.temperature$/,
|
||||
title => 'UPS temperature',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'Celsius',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
voltage => {
|
||||
filter => qr/^(.*)\.voltage(\.nominal)?$/,
|
||||
title => 'UPS voltage',
|
||||
args => '--base 1000 -l 0',
|
||||
vlabel => 'Volt',
|
||||
config => \&common_config,
|
||||
fetch => \&common_fetch,
|
||||
},
|
||||
);
|
||||
|
||||
sub read_ups_values {
|
||||
my $ups = shift;
|
||||
|
||||
my @lines = `$UPSC $ups 2>/dev/null`;
|
||||
my $values = {};
|
||||
for my $line (@lines) {
|
||||
chomp $line;
|
||||
|
||||
my ($key, $value) = $line =~ m/^([^:]+):\s+(\S.*)$/;
|
||||
$values->{$key} = $value;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
sub graph_config {
|
||||
my ($func, $ups, $values) = @_;
|
||||
|
||||
print "graph_title " . $config{$func}->{'title'} . " ($ups)\n";
|
||||
print "graph_vlabel " . $config{$func}->{'vlabel'} . "\n";
|
||||
print "graph_args " . $config{$func}->{'args'} . "\n";
|
||||
print "graph_category sensors\n";
|
||||
|
||||
my @info;
|
||||
push @info, 'Manufacturer: "' . $values->{'ups.mfr'} . '"'
|
||||
if exists $values->{'ups.mfr'} and $values->{'ups.mfr'} ne 'unknown';
|
||||
push @info, 'Model: "' . $values->{'ups.model'} . '"'
|
||||
if exists $values->{'ups.model'};
|
||||
push @info, 'Serial: "' . $values->{'ups.serial'} . '"'
|
||||
if exists $values->{'ups.serial'};
|
||||
map { s/\s+/ /g } @info;
|
||||
print "graph_info " . join(', ', @info) . "\n"
|
||||
if @info;
|
||||
}
|
||||
|
||||
sub print_range_warning {
|
||||
my ($id, $key, $values) = @_;
|
||||
|
||||
if (exists $values->{$key . '.minimum'}) {
|
||||
print $id . ".min " . $values->{$key . '.minimum'} . "\n";
|
||||
}
|
||||
if (exists $values->{$key . '.maximum'}) {
|
||||
print $id . ".max " . $values->{$key . '.maximum'} . "\n";
|
||||
}
|
||||
|
||||
my $range = '';
|
||||
if (exists $values->{$key . '.high'}) {
|
||||
$range = $values->{$key . '.high'};
|
||||
}
|
||||
if (exists $values->{$key . '.low'}) {
|
||||
$range = $values->{$key . '.low'} . ':' . $range;
|
||||
}
|
||||
# print_thresholds() needs 'undef' for no range
|
||||
undef $range unless $range;
|
||||
print_thresholds($id, undef, undef, undef, $range);
|
||||
}
|
||||
|
||||
# Example keys for voltages:
|
||||
# battery.voltage
|
||||
# battery.voltage.minimum
|
||||
# battery.voltage.maximum
|
||||
# battery.voltage.nominal
|
||||
# input.voltage
|
||||
# input.voltage.minimum
|
||||
# input.voltage.maximum
|
||||
# input.bypass.L1-N.voltage
|
||||
# input.L1-N.voltage
|
||||
# output.voltage
|
||||
# output.voltage.nominal
|
||||
# output.L1-N.voltage
|
||||
#
|
||||
# Replace 'voltage' with 'current' in the above list to get an example
|
||||
# for current keys.
|
||||
#
|
||||
# Frequency keys:
|
||||
# input.frequency
|
||||
# input.frequency.nominal
|
||||
# input.bypass.frequency
|
||||
# input.bypass.frequency.nominal
|
||||
# output.frequency
|
||||
# output.frequency.nominal
|
||||
# output.frequency.minimum
|
||||
# output.frequency.maximum
|
||||
sub common_config {
|
||||
my ($func, $ups) = @_;
|
||||
|
||||
my $values = read_ups_values($ups);
|
||||
graph_config($func, $ups, $values);
|
||||
for my $key (sort keys %$values) {
|
||||
my ($field, $nominal) = $key =~ $config{$func}->{'filter'};
|
||||
next unless $field;
|
||||
|
||||
$field .= $nominal if $nominal;
|
||||
my $id = clean_fieldname($field);
|
||||
|
||||
# These labels look better this way and are still short enough
|
||||
$field = $key if $func =~ m/(charge|temperature|humidity)/;
|
||||
|
||||
# Beautification
|
||||
$field = ucfirst($field);
|
||||
$field =~ s/\./ /g;
|
||||
|
||||
print $id . ".label " . $field . "\n";
|
||||
print $id . ".type GAUGE\n";
|
||||
|
||||
# Draw nominal values a litle thinner
|
||||
print $id . ".draw LINE1\n" if $nominal;
|
||||
|
||||
print_range_warning($id, $key, $values);
|
||||
}
|
||||
}
|
||||
|
||||
sub common_fetch {
|
||||
my ($func, $ups) = @_;
|
||||
|
||||
my $values = read_ups_values($ups);
|
||||
for my $key (sort keys %$values) {
|
||||
my ($field, $nominal) = $key =~ $config{$func}->{'filter'};
|
||||
next unless $field;
|
||||
|
||||
$field .= $nominal if $nominal;
|
||||
my $id = clean_fieldname($field);
|
||||
|
||||
print $id . ".value " . $values->{$key} . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq 'autoconf') {
|
||||
# The former nutups_ plugin parsed upsmon.conf. But for a large UPS
|
||||
# that powers dozens or hundreds of machines, that would mean
|
||||
# monitoring the same UPS from every host it powers, which does not
|
||||
# make sense. Using upsc and defaulting to localhost means that
|
||||
# 'autoconf' will only enable the plugin on the UPS master node, where
|
||||
# upsd is running.
|
||||
my @upses = `$UPSC -l 2>/dev/null`;
|
||||
if ($?) {
|
||||
if ($? == -1) {
|
||||
print "no (program '$UPSC' was not found)\n";
|
||||
}
|
||||
else {
|
||||
print "no (program '$UPSC -l' returned error)\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
map { chomp $_ } @upses;
|
||||
unless (@upses and $upses[0]) {
|
||||
print "no (program '$UPSC' listed no units)\n";
|
||||
}
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq 'suggest') {
|
||||
my @upses = `$UPSC -l 2>/dev/null`;
|
||||
for my $ups (@upses) {
|
||||
chomp $ups;
|
||||
for my $metric (keys %config) {
|
||||
my $values = read_ups_values($ups);
|
||||
my @keys = grep { +$_ =~ $config{$metric}->{'filter'} } keys(%$values);
|
||||
print $ups . '_' . $metric . "\n" if @keys;
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
croak("Unknown command line arguments") if $ARGV[0] and $ARGV[0] ne 'config';
|
||||
|
||||
# The UPS name may contain underscores
|
||||
my $fn_re = join('|', keys %config);
|
||||
my ($ups, $func) = $0 =~ m/nutups2_(.*)_($fn_re)$/;
|
||||
|
||||
if ($ARGV[0] and $ARGV[0] eq 'config') {
|
||||
$config{$func}->{'config'}($func, $ups);
|
||||
}
|
||||
else {
|
||||
$config{$func}->{'fetch'}($func, $ups);
|
||||
}
|
||||
|
||||
exit 0;
|
60
plugins/sensors/nvclock
Executable file
60
plugins/sensors/nvclock
Executable file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# plugin to monitor a nvidia graphic card temperature(s)
|
||||
# dynamically shows the sensor name (gpu, board...)
|
||||
# written by Dju
|
||||
#
|
||||
# Requirements :
|
||||
# - a nvidia graphic card
|
||||
# - a working nvclock binary
|
||||
# - shell commands: grep, awk, sed, cut
|
||||
# - root rights to execute nvclock. add in plugin-conf.d/munin-node
|
||||
# [nvclock]
|
||||
# user root
|
||||
#
|
||||
# Parameters : autoconf and config
|
||||
#
|
||||
# Version: 1.1
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
NVCLOCK=`which nvclock`
|
||||
if [ ! -z "$NVCLOCK" -a -f $NVCLOCK -a -x $NVCLOCK ]; then
|
||||
NVCLOCK_OK=1
|
||||
temps=$($NVCLOCK -i | grep 'temperature:' | awk '{print $1,$3}' | sed 's/ /@/g' | sed 's/C$//g')
|
||||
else
|
||||
NVCLOCK_OK=0
|
||||
fi
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ $NVCLOCK_OK -eq 1 ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
echo 'graph_title Nvidia temperatures'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel temp in °C'
|
||||
echo 'graph_category sensors'
|
||||
if [ $NVCLOCK_OK -eq 1 ]; then
|
||||
for temp in $temps; do
|
||||
label=$(echo $temp | cut -d@ -f1)
|
||||
echo "${label}.label ${label}"
|
||||
done
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $NVCLOCK_OK -eq 1 ]; then
|
||||
for temp in $temps; do
|
||||
label=$(echo $temp | cut -d@ -f1)
|
||||
value=$(echo $temp | cut -d@ -f2)
|
||||
echo "${label}.value ${value}"
|
||||
done
|
||||
fi
|
114
plugins/sensors/omreport_fan_speed
Executable file
114
plugins/sensors/omreport_fan_speed
Executable file
|
@ -0,0 +1,114 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2008 Rackspace US, Inc. <http://www.rackspace.com>
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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/gpl.txt
|
||||
#
|
||||
#
|
||||
# This plugin will graph the chassis fan sensors on a Dell PowerEdge Server
|
||||
# via the omreport tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PE2650/6650
|
||||
# PE2850/6850
|
||||
# PE2950
|
||||
#
|
||||
# To enable, link omreport_fan_speed to this file. E.g.
|
||||
#
|
||||
# ln -s /usr/share/node/node/plugins/omreport_fan_speed /etc/munin/plugins/omreport_fan_speed
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [omreport_*]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Justin Shepherd <galstrom21@gmail.com>
|
||||
# Revision: 1.5 2008/10/22
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||||
if (-f $omreport) {
|
||||
print "yes\n";
|
||||
}
|
||||
else {
|
||||
print "no ($omreport does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
} # end if
|
||||
else {
|
||||
my $cmd = "$omreport chassis fans";
|
||||
my @result = `$cmd`;
|
||||
my (%val, $index);
|
||||
foreach my $line (@result) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/\s$//g;
|
||||
next if ($line eq "");
|
||||
my ($field, $value) = split(/ \: /, $line);
|
||||
if ($field eq "Index") {
|
||||
$val{$value} = {};
|
||||
$index = $value;
|
||||
}
|
||||
elsif ($field eq "Probe Name") {
|
||||
$value =~ s/ RPM//g;
|
||||
$val{$index}{$field} = "$value";
|
||||
}
|
||||
elsif ($field eq "Reading") {
|
||||
$value =~ s/ RPM//g;
|
||||
$val{$index}{"$field"} = "$value";
|
||||
}
|
||||
elsif ($field eq "Maximum Warning Threshold") {
|
||||
$value =~ s/ RPM//g;
|
||||
$val{$index}{"Warning Threshold"} = "$value";
|
||||
}
|
||||
elsif ($field eq "Maximum Failure Threshold") {
|
||||
$value =~ s/ RPM//g;
|
||||
$val{$index}{"Critical Threshold"} = "$value";
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title OpenManage - Fan Probes\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Speed in RPMs\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "fan_$j.label $val{$j}{\"Probe Name\"}\n";
|
||||
if ($val{$j}{"Warning Threshold"} !~ m/\[N\/A\]/i) {
|
||||
print "fan_$j.warning " .
|
||||
"$val{$j}{\"Warning Threshold\"}\n";
|
||||
}
|
||||
if ($val{$j}{"Critical Threshold"} !~ m/\[N\/A\]/i) {
|
||||
print "fan_$j.critical " .
|
||||
"$val{$j}{\"Critical Threshold\"}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $j (sort keys %val) {
|
||||
print "fan_$j.value $val{$j}{\"Reading\"}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
105
plugins/sensors/omreport_pwrmon_current
Executable file
105
plugins/sensors/omreport_pwrmon_current
Executable file
|
@ -0,0 +1,105 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Chadwick, University of Oxford <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Based on work by Rackspace US, Inc. <http://www.rackspace.com>, (C) 2008.
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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/gpl.txt
|
||||
#
|
||||
#
|
||||
# This plugin will graph the per-PSU current draw of a Dell PowerEdge Server
|
||||
# via the omreport tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PowerEdge R905
|
||||
#
|
||||
# To enable, create a link in your plugins directory to wherever you
|
||||
# installed this file, e.g.:
|
||||
#
|
||||
# cd /etc/munin/plugins
|
||||
# ln -s /usr/share/munin/plugins/omreport_pwrmon_current
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [omreport_*]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Andrew Chadwick <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Revision: 0.1 2008-01-28
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
use strict;
|
||||
my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||||
if (-f $omreport) {
|
||||
print "yes\n";
|
||||
}
|
||||
else {
|
||||
print "no ($omreport does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
my @cmd = ($omreport, qw{chassis pwrmonitoring});
|
||||
my ($index, %val);
|
||||
my $pid = open(my $cmd_out, '-|', @cmd) or die "@cmd: $!\n";
|
||||
defined $pid or die "fork() failed: $!\n";
|
||||
my $amperage_idx = 0;
|
||||
while (<$cmd_out>) {
|
||||
s/\s+/\040/g;
|
||||
s/\s+$//;
|
||||
s/^\s+//;
|
||||
|
||||
/^Amperage\b/ .. /^Power\s+Tracking\b/ or next;
|
||||
|
||||
my ($field, $value) = split(/\s+\:\s+/, $_);
|
||||
if ($field eq 'Location') {
|
||||
$index = "current_${amperage_idx}";
|
||||
++$amperage_idx;
|
||||
$val{$index} = {
|
||||
label => $value,
|
||||
};
|
||||
}
|
||||
elsif ($field eq 'Reading') {
|
||||
$value =~ s{\s+A$}{};
|
||||
$value =~ s{\[N/A\]}{}g;
|
||||
$val{$index}{value} = $value;
|
||||
}
|
||||
}
|
||||
close $cmd_out;
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title OpenManage - Power Monitoring - Current\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Amps\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "$j.label $val{$j}{label}\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $j (sort keys %val) {
|
||||
print "$j.value $val{$j}{value}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
121
plugins/sensors/omreport_pwrmon_power
Executable file
121
plugins/sensors/omreport_pwrmon_power
Executable file
|
@ -0,0 +1,121 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Chadwick, University of Oxford <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Based on work by Rackspace US, Inc. <http://www.rackspace.com>, (C) 2008.
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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/gpl.txt
|
||||
#
|
||||
#
|
||||
# This plugin will graph the power consumption of a Dell PowerEdge Server
|
||||
# via the omreport tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PowerEdge R905
|
||||
#
|
||||
# To enable, create a link in your plugins directory to wherever you
|
||||
# installed this file, e.g.:
|
||||
#
|
||||
# cd /etc/munin/plugins
|
||||
# ln -s /usr/share/munin/plugins/omreport_pwrmon_power
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [omreport_*]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Andrew Chadwick <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Revision: 0.1 2008-01-28
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
use strict;
|
||||
my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||||
if (-f $omreport) {
|
||||
print "yes\n";
|
||||
}
|
||||
else {
|
||||
print "no ($omreport does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
my @cmd = ($omreport, qw{chassis pwrmonitoring});
|
||||
my ($index, %val);
|
||||
my $pid = open(my $cmd_out, '-|', @cmd) or die "@cmd: $!\n";
|
||||
defined $pid or die "fork() failed: $!\n";
|
||||
my $amperage_idx = 0;
|
||||
while (<$cmd_out>) {
|
||||
s/\s+/\040/g;
|
||||
s/\s+$//;
|
||||
s/^\s+//;
|
||||
|
||||
/^Power\s+Consumption\b/ .. /^Amperage\b/ or next;
|
||||
|
||||
my ($field, $value) = split(/\s+\:\s+/, $_);
|
||||
if ($field eq 'Index') {
|
||||
$index = "power_${value}";
|
||||
$val{$index} = {};
|
||||
}
|
||||
elsif ($field eq 'Probe Name') {
|
||||
$val{$index}{label} = $value;
|
||||
}
|
||||
elsif ($field eq 'Reading') {
|
||||
$value =~ s{\s+W$}{};
|
||||
$value =~ s{\[N/A\]}{}g;
|
||||
$val{$index}{value} = $value;
|
||||
}
|
||||
elsif ($field eq 'Warning Threshold') {
|
||||
$value =~ s{\s+W$}{};
|
||||
$value =~ s{\[N/A\]}{}g;
|
||||
$val{$index}{warning} = $value;
|
||||
}
|
||||
elsif ($field eq 'Failure Threshold') {
|
||||
$value =~ s{\s+W$}{};
|
||||
$value =~ s{\[N/A\]}{}g;
|
||||
$val{$index}{critical} = $value;
|
||||
}
|
||||
}
|
||||
close $cmd_out;
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title OpenManage - Power Monitoring - Power\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Watts\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "$j.label $val{$j}{label}\n";
|
||||
if ($val{$j}{warning}) {
|
||||
print "$j.warning $val{$j}{warning}\n";
|
||||
}
|
||||
if ($val{$j}{critical}) {
|
||||
print "$j.critical $val{$j}{critical}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $j (sort keys %val) {
|
||||
print "$j.value $val{$j}{value}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
195
plugins/sensors/omreport_storage_temp
Executable file
195
plugins/sensors/omreport_storage_temp
Executable file
|
@ -0,0 +1,195 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright (C) 2009 Andrew Chadwick, University of Oxford <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Based on work by Rackspace US, Inc. <http://www.rackspace.com>, (C) 2008.
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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/gpl.txt
|
||||
#
|
||||
#
|
||||
# This plugin will graph all available temperature probes in the storage
|
||||
# array enclosures of a Dell PowerEdge Server via the omreport tool. It has
|
||||
# been tested on the following combinations:
|
||||
#
|
||||
# PowerEdge R905 + PERC 6/E + MD1120
|
||||
#
|
||||
# To enable, create a link in your plugins directory to wherever you
|
||||
# installed this file, e.g.:
|
||||
#
|
||||
# cd /etc/munin/plugins
|
||||
# ln -s /usr/share/munin/plugins/omreport_storage_temp
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [omreport_*]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Andrew Chadwick <andrew.chadwick@ceu.ox.ac.uk>
|
||||
# Revision: 0.1 2008-01-28
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
sub get_controllers {
|
||||
my $omreport = shift;
|
||||
my %ctrlrs;
|
||||
my @cmd = ($omreport, 'storage', 'controller');
|
||||
my $pid = open(my $cmd_out, '-|', @cmd) or die "@cmd: $!\n";
|
||||
defined $pid or die "fork() failed: $!\n";
|
||||
my $id;
|
||||
while (<$cmd_out>) {
|
||||
s/\s+/\040/g;
|
||||
s/\s+$//;
|
||||
s/^\s+//;
|
||||
my ($field, $value) = split(/\s+\:\s+/, $_);
|
||||
defined $value or next;
|
||||
if ($field eq 'ID') {
|
||||
$id = $value;
|
||||
}
|
||||
elsif ($field eq 'Name') {
|
||||
defined $id or next;
|
||||
$ctrlrs{$id} = $value;
|
||||
}
|
||||
}
|
||||
close $cmd_out;
|
||||
return %ctrlrs;
|
||||
}
|
||||
|
||||
|
||||
sub get_controller_enclosures {
|
||||
my ($omreport, $ctrlr) = @_;
|
||||
my %encs;
|
||||
my @cmd = ($omreport, 'storage', 'enclosure', "controller=$ctrlr");
|
||||
my $pid = open(my $cmd_out, '-|', @cmd) or die "@cmd: $!\n";
|
||||
defined $pid or die "fork() failed: $!\n";
|
||||
my $id;
|
||||
while (<$cmd_out>) {
|
||||
s/\s+/\040/g;
|
||||
s/\s+$//;
|
||||
s/^\s+//;
|
||||
my ($field, $value) = split(/\s+\:\s+/, $_);
|
||||
defined $value or next;
|
||||
if ($field eq 'ID') {
|
||||
$id = $value;
|
||||
}
|
||||
elsif ($field eq 'Name') {
|
||||
defined $id or next;
|
||||
$encs{$id} = $value;
|
||||
}
|
||||
}
|
||||
close $cmd_out;
|
||||
return %encs;
|
||||
}
|
||||
|
||||
sub get_enclosure_temps {
|
||||
my ($omreport, $ctrlr, $enc) = @_;
|
||||
my %temp_hashes;
|
||||
my @cmd = ($omreport, 'storage', 'enclosure', "controller=$ctrlr",
|
||||
"enclosure=$enc", "info=temps");
|
||||
my $pid = open(my $cmd_out, '-|', @cmd) or die "@cmd: $!\n";
|
||||
defined $pid or die "fork() failed: $!\n";
|
||||
my $idx;
|
||||
while (<$cmd_out>) {
|
||||
s/\s+/\040/g;
|
||||
s/\s+$//;
|
||||
s/^\s+//;
|
||||
my ($field, $value) = split(/\s+\:\s+/, $_);
|
||||
defined $value or next;
|
||||
if ($field eq 'ID') {
|
||||
$idx = $value;
|
||||
$temp_hashes{$idx} = {
|
||||
id => $value,
|
||||
};
|
||||
}
|
||||
elsif ($field eq 'Name') {
|
||||
defined $idx or next;
|
||||
$temp_hashes{$idx}{name} = $value;
|
||||
}
|
||||
elsif ($field eq 'Reading') {
|
||||
defined $idx or next;
|
||||
$value =~ s{\s+C$}{};
|
||||
$temp_hashes{$idx}{value} = $value;
|
||||
}
|
||||
elsif ($field eq 'Maximum Warning Threshold') {
|
||||
defined $idx or next;
|
||||
$value =~ s{\s+C$}{};
|
||||
$temp_hashes{$idx}{warning} = $value;
|
||||
}
|
||||
elsif ($field eq 'Maximum Failure Threshold') {
|
||||
defined $idx or next;
|
||||
$value =~ s{\s+C$}{};
|
||||
$temp_hashes{$idx}{critical} = $value;
|
||||
}
|
||||
}
|
||||
close $cmd_out;
|
||||
return %temp_hashes;
|
||||
}
|
||||
|
||||
|
||||
use strict;
|
||||
my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||||
if (-f $omreport) {
|
||||
print "yes\n";
|
||||
}
|
||||
else {
|
||||
print "no ($omreport does not exist)\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
my %ctrlrs = get_controllers($omreport);
|
||||
my $is_config_pass = $ARGV[0] && $ARGV[0] eq "config";
|
||||
if ($is_config_pass) {
|
||||
print "graph_title OpenManage - Storage - Temperatures\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Temp in Degrees Celsius\n";
|
||||
print "graph_category Sensors\n";
|
||||
print "graph_info Temperature sensors within storage enclosures on the system, typically external ones managed via PERC 6/E adapters.\n";
|
||||
}
|
||||
foreach my $c (sort keys %ctrlrs) {
|
||||
my $c_name = $ctrlrs{$c};
|
||||
my %encs = get_controller_enclosures($omreport, $c);
|
||||
foreach my $e (sort keys %encs) {
|
||||
my $e_name = $encs{$e};
|
||||
my %temp_hashes = get_enclosure_temps($omreport, $c, $e);
|
||||
foreach my $t (sort keys %temp_hashes) {
|
||||
my $t_hash = $temp_hashes{$t};
|
||||
my ($t_name, $val, $warn, $crit) = @$t_hash{qw(
|
||||
name value warning critical
|
||||
)};
|
||||
$c =~ s{\W+}{_}g;
|
||||
$e =~ s{\W+}{_}g;
|
||||
$t =~ s{\W+}{_}g;
|
||||
my $g = "ctrlr${c}_enc${e}_temp${t}";
|
||||
if ($is_config_pass) {
|
||||
print "$g.label $c_name\: $e_name\: $t_name\n";
|
||||
print "$g.warning $warn\n";
|
||||
print "$g.critical $crit\n";
|
||||
}
|
||||
else {
|
||||
print "$g.value $val\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0);
|
109
plugins/sensors/omreport_temp
Executable file
109
plugins/sensors/omreport_temp
Executable file
|
@ -0,0 +1,109 @@
|
|||
#! /usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2008 Rackspace US, Inc. <http://www.rackspace.com>
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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/gpl.txt
|
||||
#
|
||||
#
|
||||
# This plugin will graph the chassis temp sensors on a Dell PowerEdge Server
|
||||
# via the omreport tool. It has been tested on the following chassis:
|
||||
#
|
||||
# PE2650/6650
|
||||
# PE2850/6850
|
||||
# PE2950
|
||||
#
|
||||
# To enable, link omreport_temps to this file. E.g.
|
||||
#
|
||||
# ln -s /usr/share/node/node/plugins/omreport_temps /etc/munin/plugins/omreport_temps
|
||||
#
|
||||
# Configuration parameters for /etc/munin/plugin-conf.d/munin-node
|
||||
#
|
||||
# [omreport_*]
|
||||
# user - User that has permissions to run the omreport binary
|
||||
# env.omreport - Path to the omreport binary
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Author: Justin Shepherd <galstrom21@gmail.com>
|
||||
# Revision: 1.5 2008/10/22
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my $omreport = $ENV{"omreport"} || "/usr/bin/omreport";
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "autoconf") {
|
||||
if (-f $omreport) {
|
||||
print "yes\n";
|
||||
} # end if
|
||||
else {
|
||||
print "no ($omreport does not exist)\n";
|
||||
exit(1);
|
||||
} # end else
|
||||
} # end if
|
||||
else {
|
||||
my $cmd = "$omreport chassis temps";
|
||||
my @result = `$cmd`;
|
||||
my (%val, $index);
|
||||
foreach my $line (@result) {
|
||||
$line =~ s/\s+/ /g;
|
||||
$line =~ s/\s$//g;
|
||||
next if ($line eq "");
|
||||
my ($field, $value) = split(/ \: /, $line);
|
||||
if ($field eq "Index") {
|
||||
$val{$value} = {};
|
||||
$index = $value;
|
||||
} # end if
|
||||
elsif ($field eq "Probe Name") {
|
||||
$value =~ s/ Temp//g;
|
||||
$val{$index}{$field} = "$value";
|
||||
} # end elsif
|
||||
elsif ($field eq "Reading") {
|
||||
$value =~ s/ C//g;
|
||||
$val{$index}{"$field"} = "$value";
|
||||
} # end elsif
|
||||
elsif ($field eq "Maximum Warning Threshold") {
|
||||
$value =~ s/ C//g;
|
||||
$val{$index}{"Warning Threshold"} = "$value";
|
||||
} # end elsif
|
||||
elsif ($field eq "Maximum Failure Threshold") {
|
||||
$value =~ s/ C//g;
|
||||
$val{$index}{"Critical Threshold"} = "$value";
|
||||
} # end elsif
|
||||
} # end foreach
|
||||
|
||||
if ($ARGV[0] && $ARGV[0] eq "config") {
|
||||
print "graph_title OpenManage - Temperature Probes\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel Temperature in Celsius\n";
|
||||
print "graph_category Sensors\n";
|
||||
foreach my $j (sort keys %val) {
|
||||
print "probe_$j.label $val{$j}{\"Probe Name\"}\n";
|
||||
print "probe_$j.warning $val{$j}{\"Warning Threshold\"}\n";
|
||||
print "probe_$j.critical $val{$j}{\"Critical Threshold\"}\n";
|
||||
} # end foreach
|
||||
} # end if
|
||||
else {
|
||||
foreach my $j (sort keys %val) {
|
||||
print "probe_$j.value $val{$j}{\"Reading\"}\n";
|
||||
} # end foreach
|
||||
} # end else
|
||||
} # end else
|
||||
exit(0);
|
||||
|
110
plugins/sensors/room_alert_
Executable file
110
plugins/sensors/room_alert_
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
# Plugin to monitor Room Alert 11E environmental units.
|
||||
# Requires ruby and the ruby SNMP library.
|
||||
#
|
||||
# Written by Phil Gold <phil_g@pobox.com>.
|
||||
#
|
||||
# Usage: Copy or link into /etc/munin/node.d/. End word can be either
|
||||
# "temperature" or "humidity".
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# Config variables:
|
||||
#
|
||||
# units - DNS names of environmental units
|
||||
# community - Community to use to access the Room Alert unit
|
||||
# Defaults to 'public'.
|
||||
# variables of the form label_<unit>_<num>, where dots and dashes in the
|
||||
# unit names are replaced with underscores - labels for specific sensors
|
||||
# in the unit.
|
||||
# e.g. env.label_192_168_1_115_2 Main Unit
|
||||
#
|
||||
# Example config:
|
||||
#
|
||||
# [room_alert_*]
|
||||
# env.units unit1.example.com unit2.example.com
|
||||
# env.community private
|
||||
# env.label_unit1_example_com_2 Main Unit
|
||||
# env.label_unit1_example_com_3 Rack 2 Sensor
|
||||
|
||||
require 'snmp'
|
||||
|
||||
base_oid = "enterprises.20916.1.3.1"
|
||||
|
||||
case $0.match('[^_]+$')[0]
|
||||
when "temperature"
|
||||
subchannel = 1
|
||||
name = "temperature"
|
||||
label = "°C"
|
||||
letter = "t"
|
||||
when "humidity"
|
||||
subchannel = 3
|
||||
name = "humidity"
|
||||
label = "% Relative Humidity"
|
||||
letter = "h"
|
||||
else
|
||||
exit 1
|
||||
end
|
||||
|
||||
def is_vb_valid(vb, subchannel)
|
||||
return (vb.name[-1] == 0 and vb.name[-2] == subchannel and vb.value > 1)
|
||||
end
|
||||
|
||||
def field_name(unit, vb, letter)
|
||||
clean_unit = unit.gsub(/[.-]/, '_')
|
||||
sensor = vb.name[-3].to_s
|
||||
return "#{clean_unit}_#{letter}#{sensor}"
|
||||
end
|
||||
|
||||
def label(unit, vb)
|
||||
clean_unit = unit.gsub(/[.-]/, '_')
|
||||
sensor = vb.name[-3].to_s
|
||||
label = "#{unit} " + (ENV["label_#{clean_unit}_#{sensor}"] || "sensor #{sensor}")
|
||||
end
|
||||
|
||||
units = (ENV['units'] || "").split(/\s+/)
|
||||
community = ENV['community'] || "public"
|
||||
|
||||
case ARGV[0]
|
||||
when "autoconf"
|
||||
puts "no"
|
||||
exit 1
|
||||
when "config"
|
||||
puts "graph_title Room Alert 11E units (#{name} probes)"
|
||||
puts "graph_vlabel #{label}"
|
||||
puts "graph_category sensors"
|
||||
if name == "humidity"
|
||||
puts "graph_args --lower-limit 0 --upper-limit 100"
|
||||
end
|
||||
units.each do |unit|
|
||||
SNMP::Manager.open(:Host => unit,
|
||||
:Community => community,
|
||||
:Version => :SNMPv1) do |manager|
|
||||
manager.walk(base_oid) do |vb|
|
||||
if not is_vb_valid(vb, subchannel)
|
||||
next
|
||||
end
|
||||
puts "#{field_name(unit, vb, letter)}.label #{label(unit, vb)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
exit 0
|
||||
end
|
||||
|
||||
|
||||
units.each do |unit|
|
||||
SNMP::Manager.open(:Host => unit,
|
||||
:Community => community,
|
||||
:Version => :SNMPv1) do |manager|
|
||||
manager.walk(base_oid) do |vb|
|
||||
if not is_vb_valid(vb, subchannel)
|
||||
next
|
||||
end
|
||||
puts "#{field_name(unit, vb, letter)}.value #{vb.value.to_f / 100}"
|
||||
end
|
||||
end
|
||||
end
|
138
plugins/sensors/snmp__hp_temp
Executable file
138
plugins/sensors/snmp__hp_temp
Executable file
|
@ -0,0 +1,138 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Munin-plugin to monitor temperature on HP-servers.
|
||||
# Uses SNMP, and needs hpasmd.
|
||||
#
|
||||
# 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; version 2 dated June,
|
||||
# 1991.
|
||||
#
|
||||
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=snmpauto
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
use strict;
|
||||
use Net::SNMP;
|
||||
|
||||
my $DEBUG = 0;
|
||||
my $MAXLABEL = 20;
|
||||
|
||||
my $host = $ENV{host} || undef;
|
||||
my $port = $ENV{port} || 161;
|
||||
my $community = $ENV{community} || "public";
|
||||
|
||||
# Taken from CPQHLTH-MIB.mib
|
||||
my %locations = (
|
||||
1 => "other",
|
||||
2 => "unknown",
|
||||
3 => "system",
|
||||
4 => "systemBoard",
|
||||
5 => "ioBoard",
|
||||
6 => "cpu",
|
||||
7 => "memory",
|
||||
8 => "storage",
|
||||
9 => "removableMedia",
|
||||
10 => "powerSupply",
|
||||
11 => "ambient",
|
||||
12 => "chassis",
|
||||
13 => "bridgeCard"
|
||||
);
|
||||
|
||||
#my $response;
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
|
||||
{
|
||||
print "index 1.3.6.1.4.1.232.6.2.6.8.1.\n";
|
||||
print "require 1.3.6.1.4.1.232.6.2.6.8.1.4.1.1. [1-4]\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_HP_temp$/)
|
||||
{
|
||||
$host = $1;
|
||||
if ($host =~ /^([^:]+):(\d+)$/)
|
||||
{
|
||||
$host = $1;
|
||||
$port = $2;
|
||||
}
|
||||
}
|
||||
elsif (!defined($host))
|
||||
{
|
||||
print "# Debug: $0 -- $1\n" if $DEBUG;
|
||||
die "# Error: couldn't understand what I'm supposed to monitor.";
|
||||
}
|
||||
|
||||
# Sensor locations
|
||||
my $cpqHeTemperatureLocale = "1.3.6.1.4.1.232.6.2.6.8.1.3.1.";
|
||||
|
||||
# Temperatures
|
||||
my $cpqHeTemperatureCelsius = "1.3.6.1.4.1.232.6.2.6.8.1.4.1.";
|
||||
|
||||
# Temperatures thresholds
|
||||
my $cpqHeTemperatureThreshold = "1.3.6.1.4.1.232.6.2.6.8.1.5.1.";
|
||||
|
||||
|
||||
my ($session, $error) = Net::SNMP->session(
|
||||
-hostname => $host,
|
||||
-community => $community,
|
||||
-port => $port
|
||||
);
|
||||
|
||||
if (!defined ($session)) {
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
# Fetch the values.
|
||||
my $temp_locales = $session->get_table($cpqHeTemperatureLocale);
|
||||
|
||||
if (!defined ($temp_locales)) {
|
||||
die "Croaking: $error";
|
||||
}
|
||||
|
||||
my @i = ();
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
#print "host_name $host\n";
|
||||
print "graph_title Temperature (in C)\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_args --upper-limit 100 -l 0\n";
|
||||
print "graph_vlabel C\n";
|
||||
print "graph_info This graph shows the temperatures on a HP server.\n";
|
||||
|
||||
while (my ($oid, $loc_id) = each (%$temp_locales)) {
|
||||
@i = split(/\./, $oid);
|
||||
my $t = $session->get_request($cpqHeTemperatureThreshold . $i[-1]);
|
||||
while (my ($ooid, $threshold) = each(%$t)) {
|
||||
print "$locations{$loc_id}$i[-1].label $locations{$loc_id}\n";
|
||||
print "$locations{$loc_id}$i[-1].info Temperature sensor on $locations{$loc_id}\n";
|
||||
print "$locations{$loc_id}$i[-1].critical $threshold\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
# Fetch values
|
||||
while (my ($oid, $loc_id) = each (%$temp_locales)) {
|
||||
@i = split(/\./, $oid);
|
||||
my $t = $session->get_request($cpqHeTemperatureCelsius . $i[-1]);
|
||||
while (my ($ooid, $temperature) = each(%$t)) {
|
||||
print "$locations{$loc_id}$i[-1].value $temperature\n";
|
||||
}
|
||||
}
|
||||
|
114
plugins/sensors/snmp__linksys_poe
Executable file
114
plugins/sensors/snmp__linksys_poe
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
"
|
||||
=head1 NAME
|
||||
|
||||
snmp__linksys_poe - Munin plugin to monitor the current supplied by Linksys PoE
|
||||
switches.
|
||||
|
||||
Requires ruby and the ruby SNMP library.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
I wrote this to query SRW2008MP switches and determined the OIDs by trial and
|
||||
error. There may be other Linksys devices that this will also work for.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
This plugin defaults to SNMP version 2c and a community string of 'public'. The
|
||||
defaults can be overridden in the usual way:
|
||||
|
||||
[snmp_*]
|
||||
env.version 1
|
||||
env.community private
|
||||
|
||||
SNMP version 3 is not supported.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin simply reports the current being supplied on each of the device's
|
||||
PoE ports.
|
||||
|
||||
=head1 MIB INFORMATION
|
||||
|
||||
Information is gathered from Linksys' private MIB space, so it's probably only
|
||||
applicable to Linksys devices. I have been unable to get an actual copy of
|
||||
the appropriate MIB, so I don't know the actual names of the values I'm
|
||||
retrieving.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=snmpauto contrib
|
||||
#%# capabilities=snmpconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.0
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None known.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Written by Phil Gold <phil_g@pobox.com>.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
CC0 <http://creativecommons.org/publicdomain/zero/1.0/>
|
||||
|
||||
To the extent possible under law, all copyright and related or neighboring
|
||||
rights to this plugin are waived. Do with it as you wish.
|
||||
|
||||
=cut
|
||||
"
|
||||
|
||||
require 'snmp'
|
||||
|
||||
idx_oid = "enterprises.3955.89.108.1.1.2"
|
||||
max_oid = "enterprises.3955.89.108.1.1.6"
|
||||
cur_oid = "enterprises.3955.89.108.1.1.5"
|
||||
|
||||
community = ENV['community'] || "public"
|
||||
version = ENV['version'] == '1' ? :SNMPv1 : :SNMPv2c
|
||||
|
||||
case ARGV[0]
|
||||
when "autoconf"
|
||||
puts "no"
|
||||
exit 1
|
||||
when "snmpconf"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.2.1. [0-9]"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.5.1. [0-9]"
|
||||
puts "require 1.3.6.1.4.1.3955.89.108.1.1.6.1. [0-9]"
|
||||
exit 0;
|
||||
when "config"
|
||||
host = $0.match('^(?:|.*\/)snmp_([^_]+)')[1]
|
||||
puts "host_name #{host}"
|
||||
puts "graph_title PoE Power Usage"
|
||||
puts "graph_vlabel Watts"
|
||||
puts "graph_category sensors"
|
||||
max_current = 0
|
||||
SNMP::Manager.open(:Host => host,
|
||||
:Community => community,
|
||||
:Version => version) do |manager|
|
||||
manager.walk([idx_oid, max_oid]) do |row|
|
||||
puts "iface_#{row[0].value}.label Port #{row[0].value}"
|
||||
puts "iface_#{row[0].value}.cdef iface_#{row[0].value},1000,/"
|
||||
puts "iface_#{row[0].value}.line #{row[1].value.to_f / 1000}"
|
||||
if row[1].value > max_current
|
||||
max_current = row[1].value
|
||||
end
|
||||
end
|
||||
end
|
||||
puts "graph_args --upper-limit #{max_current.to_f / 1000}"
|
||||
exit 0
|
||||
else
|
||||
host = $0.match('^(?:|.*\/)snmp_([^_]+)')[1]
|
||||
SNMP::Manager.open(:Host => host,
|
||||
:Community => community,
|
||||
:Version => version) do |manager|
|
||||
manager.walk([idx_oid, cur_oid]) do |row|
|
||||
puts "iface_#{row[0].value}.value #{row[1].value}"
|
||||
end
|
||||
end
|
||||
end
|
112
plugins/sensors/snmp__sfsnmp_fan
Executable file
112
plugins/sensors/snmp__sfsnmp_fan
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/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__
|
||||
|
111
plugins/sensors/snmp__sfsnmp_temp
Executable file
111
plugins/sensors/snmp__sfsnmp_temp
Executable file
|
@ -0,0 +1,111 @@
|
|||
#!/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 Celcius\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__
|
||||
|
112
plugins/sensors/snmp__sfsnmp_volt
Executable file
112
plugins/sensors/snmp__sfsnmp_volt
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/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__
|
||||
|
36
plugins/sensors/snmp__ups_battery
Executable file
36
plugins/sensors/snmp__ups_battery
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor battery from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_battery /etc/munin/plugins/snmp_UPS.IP_ups_battery
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL - Battery"
|
||||
echo "graph_args --base 1000 -l 0 -u 100"
|
||||
echo "graph_vlabel %"
|
||||
echo "graph_scale no"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the battery capacity/load read from $UPSMODEL"
|
||||
echo "batterycapacity.label Battery Capacity"
|
||||
echo "batterycapacity.type GAUGE"
|
||||
echo "batterycapacity.draw LINE3"
|
||||
echo "batterycapacity.info Battery Capacity"
|
||||
echo "batterycapacity.colour ff0000"
|
||||
echo "batteryload.label Battery Load"
|
||||
echo "batteryload.type GAUGE"
|
||||
echo "batteryload.draw AREA"
|
||||
echo "batteryload.info Battery Load"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "batterycapacity.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.2.2.1.0 | awk '{print $NF}'
|
||||
echo -n "batteryload.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.4.2.3.0 | awk '{print $NF}'
|
29
plugins/sensors/snmp__ups_temp
Executable file
29
plugins/sensors/snmp__ups_temp
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor temperature from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_temp /etc/munin/plugins/snmp_UPS.IP_ups_temp
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL- Temperature"
|
||||
echo "graph_args --base 1000 -l 0 "
|
||||
echo "graph_vlabel degrees C"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the temperature read from $UPSMODEL"
|
||||
echo "temperature.label sensor UPS"
|
||||
echo "temperature.type GAUGE"
|
||||
echo "temperature.info Temperature from sensor UPS."
|
||||
echo "temperature.warning 25"
|
||||
echo "temperature.critical 30"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "temperature.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1 | awk '{print $NF}'
|
34
plugins/sensors/snmp__ups_voltage
Executable file
34
plugins/sensors/snmp__ups_voltage
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor voltage from UPS APC 9619
|
||||
# 2009/04/10 12:27:02 radar AT aol DOT pl
|
||||
#
|
||||
# ln -s /usr/share/munin/plugins/snmp__ups_voltage /etc/munin/plugins/snmp_UPS.IP_ups_voltage
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some installation scripts):
|
||||
#%# family=contrib
|
||||
|
||||
UPSHOST=$(basename $0 | awk -F'_|_' '{print $2}')
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
UPSMODEL=$(snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.1.1.1.0 | awk -F'"|"' '{print $2}')
|
||||
echo "graph_title $UPSMODEL - Voltage"
|
||||
echo "graph_args --base 1000"
|
||||
echo "graph_vlabel Voltage in (-) / out (+)"
|
||||
echo "graph_category sensors"
|
||||
echo "graph_info This graph shows the voltage read from $UPSMODEL"
|
||||
echo "voltagein.label V"
|
||||
echo "voltagein.type GAUGE"
|
||||
echo "voltagein.info Voltage."
|
||||
echo "voltagein.graph no"
|
||||
echo "voltageout.label V"
|
||||
echo "voltageout.type GAUGE"
|
||||
echo "voltageout.info Voltage."
|
||||
echo "voltageout.negative voltagein"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -n "voltagein.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.3.2.1.0 | awk '{print $NF}'
|
||||
echo -n "voltageout.value "
|
||||
snmpwalk -v 2c -c public $UPSHOST .1.3.6.1.4.1.318.1.1.1.4.2.1.0 | awk '{print $NF}'
|
95
plugins/sensors/temperature_
Executable file
95
plugins/sensors/temperature_
Executable file
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Plugin to fetch temperature from weather.noaa.gov
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
my $usehum = $ENV{humidity} || undef; # set to "yes" to enable humidity
|
||||
my $wcode = $ENV{wcode} || "ENGM"; # Find areacode here http://weather.noaa.gov/
|
||||
my $unit = $ENV{unit} || "C"; # "C" = Celsius, "F" = Fahrenheit
|
||||
my $proxy = $ENV{proxy} || undef; # Example: "http://proxy.foo.bar:8080/"
|
||||
|
||||
my $ret = undef;
|
||||
if (! eval "require LWP::UserAgent;") {
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||
if (defined $ret) {
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
# Extract weather-code from filename. Example: weather_CODE
|
||||
if ($0 =~ /^(?:|.*\/)temperature_([^_]+)$/) {
|
||||
$wcode = $1;
|
||||
}
|
||||
|
||||
|
||||
my $datasource = "http://weather.noaa.gov/pub/data/observations/metar/decoded/$wcode.TXT";
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
$ua->agent('Munin');
|
||||
|
||||
# Use proxy, if defined.
|
||||
if (defined $proxy) {
|
||||
$ua->proxy(['http'], $proxy);
|
||||
}
|
||||
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$datasource));
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
|
||||
if ($response->content =~ /^((.*?),.*\)).*\n/) {
|
||||
print "graph_title Temperature at $2\n";
|
||||
} else {
|
||||
print "graph_title Temperature at locationcode $wcode\n";
|
||||
}
|
||||
|
||||
if ($unit =~ /F/) {
|
||||
print "graph_vlabel temp in F\n";
|
||||
} else {
|
||||
print "graph_vlabel temp in C\n";
|
||||
}
|
||||
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info Temperatures at $1 (fetched from weather.nooa.gov).\n";
|
||||
print "temperature.label temperature\n";
|
||||
if (defined $usehum) {
|
||||
print "humidity.label humidity\n";
|
||||
print "humidity.info Humidity in %.\n";
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ($response->content =~ /Temperature:\s*(.*)\s+F\s*\(\s*(.*)\s+C/) {
|
||||
if ($unit =~ /F/) {
|
||||
print "temperature.value $1\n";
|
||||
} else {
|
||||
print "temperature.value $2\n";
|
||||
}
|
||||
} else {
|
||||
print "temperature.value U\n";
|
||||
}
|
||||
|
||||
if (defined $usehum) {
|
||||
if ($response->content =~ /Relative Humidity:\s*(\d+)\%.*/) {
|
||||
print "humidity.value $1\n";
|
||||
}
|
||||
}
|
97
plugins/sensors/temperatures
Executable file
97
plugins/sensors/temperatures
Executable file
|
@ -0,0 +1,97 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2006 Lars Strand
|
||||
#
|
||||
# Plugin to fetch temperature from weather.noaa.gov
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
|
||||
# Find areacodes here http://weather.noaa.gov/
|
||||
my @wcode = undef;
|
||||
|
||||
if (defined($ENV{wcode})) {
|
||||
@wcode = split(' ', $ENV{wcode});
|
||||
} else {
|
||||
@wcode = ("ENGM", "ENBR", "ENVA", "ENTC");
|
||||
}
|
||||
|
||||
my $unit = $ENV{unit} || "C"; # "C" = Celsius, "F" = Fahrenheit
|
||||
my $proxy = $ENV{proxy} || undef; # Example: "http://proxy.foo.bar:8080/"
|
||||
|
||||
my $ret = undef;
|
||||
if (! eval "require LWP::UserAgent;")
|
||||
{
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "autoconf") {
|
||||
if (defined $ret) {
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
} else {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
my $datasource = "http://weather.noaa.gov/pub/data/observations/metar/decoded/";
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => 30);
|
||||
$ua->agent('Munin');
|
||||
|
||||
# Use proxy, if defined.
|
||||
if (defined($proxy)) {
|
||||
$ua->proxy(['http'], $proxy);
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] and $ARGV[0] eq "config") {
|
||||
|
||||
print "graph_title Outside temperature\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_category sensors\n";
|
||||
print "graph_info This graph shows temperatures fetched from weather.nooa.gov.\n";
|
||||
|
||||
if ($unit =~ /F/) {
|
||||
print "graph_vlabel temp in F\n";
|
||||
} else {
|
||||
print "graph_vlabel temp in C\n";
|
||||
}
|
||||
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
# New York City, Central Park, NY, United States (KNYC) 40-47-00N 073-58-00W 48M
|
||||
if ($response->content =~ /^((.*?),.*\)).*\n/) {
|
||||
print "$station.label $2\n";
|
||||
print "$station.info $1\n";
|
||||
} else {
|
||||
print "$station.label $station\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
for my $station (@wcode) {
|
||||
my $url = "$datasource$station.TXT";
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
|
||||
if ($response->content =~ /Temperature:\s*(.*)\s+F\s*\(\s*(.*)\s+C/) {
|
||||
if ($unit =~ /F/) {
|
||||
print "$station.value $1\n";
|
||||
} else {
|
||||
print "$station.value $2\n";
|
||||
}
|
||||
} else {
|
||||
print "$station.value U\n";
|
||||
}
|
||||
}
|
||||
|
33
plugins/sensors/w1-therm
Executable file
33
plugins/sensors/w1-therm
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf suggest
|
||||
#
|
||||
# Supported env variables:
|
||||
# desc: sensor description
|
||||
#
|
||||
|
||||
NAME="${0#*_}"
|
||||
TITLE="Temperature ${desc:-on $NAME}"
|
||||
|
||||
case "$1" in
|
||||
config)
|
||||
cat << EOF
|
||||
graph_title $TITLE
|
||||
graph_vtitle Celsius
|
||||
graph_args --base 1000 -l 0
|
||||
graph_category sensors
|
||||
temp.label $NAME
|
||||
EOF
|
||||
;;
|
||||
suggest)
|
||||
grep -lw "t=[0-9]*" /sys/bus/w1/devices/*/w1_slave 2>&1 |\
|
||||
sed 's#.*/\([0-9a-f-]*\)/w1_slave#\1#'
|
||||
;;
|
||||
autoconf)
|
||||
echo "yes"
|
||||
;;
|
||||
*)
|
||||
awk '/t=/ { sub("t=", "", $NF); print "temp.value", $NF/1000.0 }' \
|
||||
/sys/bus/w1/devices/"$NAME"/w1_slave
|
||||
;;
|
||||
esac
|
61
plugins/sensors/weather_
Executable file
61
plugins/sensors/weather_
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib
|
||||
|
||||
url = 'http://www.weather.com/weather/today/%s'
|
||||
|
||||
re_tmp = re.compile('realTemp: "(\d+)"')
|
||||
re_hum = re.compile('relativeHumidity: "(\d+)"')
|
||||
re_loc = re.compile('locName: "([\w ]+)"')
|
||||
|
||||
#code = sys.argv[0][(sys.argv[0].rfind('_') + 1):]
|
||||
code = os.environ.get('code', sys.argv[0][(sys.argv[0].rfind('_') + 1):])
|
||||
|
||||
if code == None: sys.exit(1)
|
||||
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "autoconf":
|
||||
print "yes"
|
||||
elif len(sys.argv) == 2 and sys.argv[1] == "config":
|
||||
u = urllib.urlopen(url % code)
|
||||
txt = u.read()
|
||||
u.close()
|
||||
|
||||
LOC_list = re_loc.findall(txt)
|
||||
|
||||
if len(LOC_list):
|
||||
LOC = LOC_list[0]
|
||||
else:
|
||||
LOC = "Unknown"
|
||||
|
||||
print 'graph_title Weather in %s' % LOC
|
||||
print 'graph_vlabel Temperature and Humidity'
|
||||
print 'graph_category sensors'
|
||||
|
||||
print 'temperature.label Temperature'
|
||||
print 'humidity.label Humidity'
|
||||
|
||||
print 'graph_args --base 1000 -l 0'
|
||||
else:
|
||||
u = urllib.urlopen(url % code)
|
||||
txt = u.read()
|
||||
u.close()
|
||||
|
||||
TMP_F_list = re_tmp.findall(txt)
|
||||
HUM_list = re_hum.findall(txt)
|
||||
|
||||
if len(HUM_list):
|
||||
HUM = HUM_list[0]
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
if len(TMP_F_list):
|
||||
TMP_F = TMP_F_list[0]
|
||||
TMP_C = (int(TMP_F) - 32) * 5/9
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
print 'temperature.value %s' % TMP_C
|
||||
print 'humidity.value %s' % HUM
|
99
plugins/sensors/wfrog
Executable file
99
plugins/sensors/wfrog
Executable file
|
@ -0,0 +1,99 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Author: William Viker <william.viker@gmail.com>
|
||||
# Version: 0.1
|
||||
|
||||
# Non-members may check out a read-only working copy anonymously over HTTP.
|
||||
# $ svn checkout http://wfrogmunin.googlecode.com/svn/trunk/ wfrogmunin-read-only
|
||||
|
||||
# TODO:
|
||||
# * Wait a couple of hours to see if this actually works.
|
||||
# * Add proper data labels for the different values possible
|
||||
# * more..
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
# INSTRUCTIONS
|
||||
#
|
||||
# 1. Install wfrog, get it up running with your weather station
|
||||
# 2. Locate your wfrog.csv file (wfrog creates after 10 mins)
|
||||
# 3. cd /etc/munin/plugins/
|
||||
# 4. ln -s /usr/share/munin/plugins/wfrog wfrog_temp
|
||||
# 4. ln -s /usr/share/munin/plugins/wfrog wfrog_pressure
|
||||
# 5. etc..
|
||||
# 6. reload munin-node ;-)
|
||||
|
||||
|
||||
# In case you need to change this.
|
||||
|
||||
my %CONFIG = (
|
||||
'wfrogcsv' => '/var/lib/wfrog/wfrog.csv',
|
||||
);
|
||||
|
||||
|
||||
my $interesting;
|
||||
|
||||
if ($0 =~ m#wfrog_(\w+)#) {
|
||||
$interesting = $1;
|
||||
}
|
||||
|
||||
else {
|
||||
print STDERR "Symlink the wfrog plugin file to wfrog_something, like wfrog_temperature, etc." . "\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
open FILE, "<", $CONFIG{'wfrogcsv'};
|
||||
|
||||
my $header = <FILE>;
|
||||
|
||||
seek( FILE, -300, 2 );
|
||||
my @line = readline FILE;
|
||||
|
||||
$header =~ s/[\r\n]//gs; # bah @ csv
|
||||
$line[-1] =~ s/[\r\n]//gs; # --- " ---
|
||||
|
||||
my @Data = split /,/, $line[-1];
|
||||
my @Keys = split /,/, $header;
|
||||
|
||||
my $GotKeyName;
|
||||
my $GotKeyData;
|
||||
my $cpos = 0;
|
||||
|
||||
for (@Keys) {
|
||||
if ($_ eq $interesting) {
|
||||
$GotKeyName = $_;
|
||||
if (defined $Data[$cpos]) {
|
||||
$GotKeyData = $Data[$cpos];
|
||||
}
|
||||
}
|
||||
$cpos++;
|
||||
}
|
||||
|
||||
unless (defined $GotKeyName) {
|
||||
print STDERR "Could not find any data on '$interesting'. Does the file contain any data?\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $graph_name = $GotKeyName;
|
||||
$graph_name =~ s/[^a-z]//gi;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print "graph_title WFrog $GotKeyName\n"
|
||||
. "graph_args --base 1000 -l 0\n"
|
||||
. "graph_vlabel Value\n"
|
||||
. "graph_scale yes\n"
|
||||
. "graph_category sensors\n"
|
||||
# . "graph_printf %3.0lf\n"
|
||||
. "$graph_name.label $GotKeyName\n"
|
||||
. "$graph_name.draw AREASTACK\n";
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
print "$graph_name.value $GotKeyData\n";
|
Loading…
Add table
Add a link
Reference in a new issue