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

Plugin-Gallery: Get better 2nd level headings

amule -> filetransfer (amule)
torrent -> filetransfer (rtorrent)
This commit is contained in:
dipohl 2017-02-24 18:29:14 +01:00
parent 95de964ec9
commit 4b400a7320
30 changed files with 19 additions and 19 deletions

139
plugins/fan/dell_fans Executable file
View file

@ -0,0 +1,139 @@
#!/usr/bin/env python
"""
USAGE
dell_changeme [config] [autoconfig]
Copy script to two files: dell_fans and dell_temps.
Example: cat dell_changeme | tee dell_fans > dell_temps
DESCRIPTION
A Munin plugin to graph the fan speeds and chassis temperatures of Dell
hardware. Requires Dell's OpenManage software, specifically omreport. OMSA
services must be started prior to plugins use. Script expects omreport to
be in /usr/sbin/, you may need to add a symlink.
omreport accesses the proc filesystem and as such this plugin must be ran
as root. Alternatively, you could modify script to use sudoers, or setuid.
To run script as root add the following lines to munin's plugin-conf.d dir.
[dell*]
user root
group root
Troubleshooting info: http://www.ryanbowlby.com/infotech/munin-plugin-dell/
AUTHOR
Ryan Bowlby <rbowlby83 yahoo>
LICENSE
This script is in the public domain, free from copyrights or restrictions.
"""
# Magic markers (optional) - used by munin-node-configure:
#
#%# family=auto
#%# capabilities=autoconf
import sys
import subprocess as sp
class Statistics(object):
"""A base class that runs omreport and prints the filtered results."""
def __init__(self, command):
self.command = command.split()
self.data = sp.Popen(self.command,stdout=sp.PIPE).stdout.readlines()
self.count = 0
# Make sure omreport returns at least one sensor block.
for item in self.data:
if item.startswith("Probe Name") or item.startswith("Reading"):
self.count += 1
if self.count < 2:
raise ValueError("No output from omreport. Is OMSA running?")
def print_omreport_results(self):
"""Prints names and values for each sensor."""
self.count = 0
for item in self.data:
if "Reading" in item:
# Extract variable length integer.
self.value = float(item.split(":")[1].split()[0])
print "%s_%s.value %s" % (self.command[-1], self.count, self.value)
self.count += 1
def print_config_dynamic(self):
"""Prints Munin config data with "label" values from omreport data."""
self.name = []
for item in self.data:
if "Probe Name" in item:
self.name.append(item.split(":")[1].replace("RPM","").strip())
for index, item in enumerate(self.name):
print "%s_%s.label %s" % (self.command[-1], index, item)
class FanSpeed(Statistics):
"""A subclass that includes the Munin "config" output."""
def __init__(self, command):
Statistics.__init__(self, command)
def print_config(self):
print "graph_title Dell Fan Speeds"
print "graph_args --base 1000 -l 0"
print "graph_vlabel speed (RPM)"
print "graph_category sensors"
print "graph_info This graph shows the speed in RPM of all fans."
print "graph_period second"
# Print remaining non-static values.
self.print_config_dynamic()
class ChassisTemps(Statistics):
"""A subclass that includes the Munin "config" output."""
def __init__(self, command):
Statistics.__init__(self, command)
def print_config(self):
print "graph_title Dell Temperature Readings"
print "graph_args --base 1000 -l 0"
print "graph_vlabel Temp in Degrees Celsius"
print "graph_category sensors"
print "graph_info This graph shows the temperature for all sensors."
print "graph_period second"
# Print remaining non-static values.
self.print_config_dynamic()
if __name__ == '__main__':
try:
if "fans" in sys.argv[0]:
cmd = "/usr/sbin/omreport chassis fans"
omdata = FanSpeed(cmd)
elif "temps" in sys.argv[0]:
cmd = "/usr/sbin/omreport chassis temps"
omdata = ChassisTemps(cmd)
else:
print >> sys.stderr, "Change filename to dell_fans or dell_temps."
sys.exit(1)
except (OSError, ValueError), e:
# omreport returns 0 results if OMSA services aren't started.
print >> sys.stderr, "Error running '%s', %s" % (cmd, e)
sys.exit(1)
# Munin populates sys.argv[1] with "" (an empty argument), let's remove it.
sys.argv = [x for x in sys.argv if x]
if len(sys.argv) > 1:
if sys.argv[1].lower() == "autoconf":
# omreport ran earlier, since we got this far autoconf is good.
print "true"
elif sys.argv[1].lower() == "config":
omdata.print_config()
else:
omdata.print_omreport_results()

42
plugins/fan/ibmfan Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
#
# Plugin to monitor fan speed on an IBM/Lenovo Laptop
#
# This plugin reads the current speed of the system fan from
# the /proc file system. As it queries specific files provided
# by kernel modules for IBM/Lenovo Laptops, it probably only
# works for those, but it should be easy to adapt to others
# if similar information is available for other types of laptops.
#
# By dominik dot stadler at gmx dot at
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -r /proc/acpi/ibm/fan ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Fan speed'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel speed'
echo 'graph_scale no'
echo 'graph_category sensors'
echo 'graph_info This graph shows the speed of the system fan.'
echo 'fan.label speed'
echo 'fan.info The current speed of the system fan.'
exit 0
fi
cat /proc/acpi/ibm/fan | grep "speed:" | awk '{print "fan.value " $2}'