Re-including some removed plugins, rewritten entirely so as to avoid relicensing.

This commit is contained in:
Matthew Connelly 2015-02-20 04:08:05 +00:00
parent 4b44665072
commit 4d4f65d1b0
5 changed files with 111 additions and 6 deletions

View File

@ -1,21 +1,21 @@
Plugins should be installed in this directory, and should have purely alphanumeric names. Plugins can, as with all munin-node implementations I've seen, be written in any supported language, however as this munin-node implementation specifically targets OpenWRT, sh-compatible/ash-specific shellscript is recommended.
Plugins in this directory may be enabled/disabled as needed by either adding or removing the executable permission (chmod +x, chmod -x).
The following plugins were originally provided with muninlite (http://sourceforge.net/projects/muninlite/) and have been altered to varying degrees to act as generic plugins. These plugins were originally bundled with this project, however due to license incompatibilities (GPLv2 doesn't seem to permit me to license my project under BSD 3-Clause while including GPLv2-licensed plugins, even modified to some degree, thus there will be no non-BSD code). They will be re-included once original replacements have been written:
- cpu
- df
- if
The following plugins were originally included in modified form from plugins shipped with the muninlite project, however they have been removed due to licensing incompatibilities and a lack of desire to rewrite them such that they could be licensed under 3-Clause BSD:
- interrupts
- irqstats
- memory
- uptime
The following plugins have been written to more specifically monitor the functions of an OpenWRT router installation, and are licensed under the 3-clause BSD license:
- cpu - Tracks CPU usage
- df - Tracks disk usage
- dhcp - Tracks the current count of valid DHCP leases.
- dns - Tracks caching/forwarding statistics in the dnsmasq caching resolver
- if - Tracks bandwidth usage for interfaces on the system
- load - Tracks system load for the past one, five and fifteen minutes, as well as active and running processes.
- memory - Tracks memory usage
- netstats - Tracks currently-open TCP, UDP, ICMP and other connections. A netstats plugin is provided with muninlite, however it is related only in name to this.
- ping - Tracks outbound latency and packet loss to a single host, intended to measure outbound connection quality/uptime through an ISP.
- skysr102 - Tracks ADSL line attenuation/noise and sync speeds. This plugin is specific to the Sky SR102 modem-router and may not work on other devices.
- upnp - Tracks the current count of valid UPnP forward leases
- uptime - Tracks uptime statistics
- wireless - Tracks total connected stations across all wireless interfaces, as well as signal and noise levels for each interface/AP.

36
plugins.d/cpu Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
# this module has been rewritten to avoid licensing issues. the muninlite project's cpu plugin will work here with minimal alterations should you wish.
if [ "$1" == "config" ];then
echo "graph_title CPU usage
graph_order system user nice idle iowait irq softirq
graph_vlabel percent
graph_args -u 100 -l 0
graph_scale no
graph_category system
graph_period second
sys.label system
sys.min 0
sys.type COUNTER
usr.label user
usr.min 0
usr.type COUNTER
nice.label nice
nice.min 0
nice.type COUNTER
idle.label idle
idle.min 0
idle.type COUNTER
iow.label io wait
iow.min 0
iow.type COUNTER
irq.label irq
irq.min 0
irq.type COUNTER
sirq.label soft-irq
sirq.min 0
sirq.type COUNTER"
exit 0
fi
/bin/grep '^cpu ' /proc/stat|/usr/bin/awk '{print "usr.value "$2"\nnice.value "$3"\nsys.value "$4"\nidle.value "$5"\niow.value "$6"\nirq.value "$7"\nsirq.value "$8}'

14
plugins.d/df Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
# this module has been rewritten to avoid licensing conflicts.
disks=`/bin/mount|/bin/egrep -v 'type ((debug|overlay|root|squash|sys|tmp)fs|proc|devpts)'|/usr/bin/awk '{print $1}'`
if [ "$1" == "config" ];then
echo "graph_title Disk usage (percent)
graph_args -u 100 -l 0
graph_vlabel percent
graph_category disk"
for disk in $disks;do echo "`echo $disk|/bin/sed -e 's/\W/_/g'`.label $disk";done
exit 0
fi
for disk in $disks;do echo "`echo $disk|/bin/sed -e 's/\W/_/g'`.value `/bin/df $disk|/usr/bin/tail -n1|/usr/bin/awk '{print $5}'|/bin/sed -e 's/\W//g'`";done

42
plugins.d/memory Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
# this plugin was rewritten to avoid licensing conflicts.
maxswap=`/usr/bin/free|/bin/grep '^Swap:'|/usr/bin/awk '{print $2}'`
maxmem=`/usr/bin/free|/bin/grep '^Mem:'|/usr/bin/awk '{print $2}'`
swap=0; [ $maxswap -ne 0 ] && swap=1
if [ "$1" == "config" ];then
[ $maxswap -gt 0 ] && maxswap="-$maxswap"
echo "graph_title Memory usage
graph_args --base 1024 -u $maxmem -l $maxswap
graph_category system
used.label in-use memory
used.draw STACK
cache.label caches
cache.draw STACK
buff.label buffers
buff.draw STACK
shared.label shared memory
shared.draw STACK
free.label available memory
free.draw STACK"
[ $swap -eq 1 ] && echo "usedswap.label in-use swap
usedswap.draw STACK
usedswap.max 0
cacheswap.label in-swap caches
cacheswap.draw STACK
cacheswap.max 0
freeswap.label available swap
freeswap.draw STACK
freeswap.max 0"
exit 0
fi
echo "used.value `/usr/bin/free|grep '^Mem:'|/usr/bin/awk '{print $3'}`
cache.value `/bin/grep '^Cached:' /proc/meminfo|/usr/bin/awk '{print $2}'`
buff.value `/usr/bin/free|/bin/grep '^Mem:'|/usr/bin/awk '{print $6}'`
shared.value `/usr/bin/free|/bin/grep '^Mem:'|/usr/bin/awk '{print $5}'`
free.value `/usr/bin/free|/bin/grep '^Mem:'|/usr/bin/awk '{print $4}'`"
[ $swap -eq 1 ] && echo "usedswap.value `/usr/bin/free|/bin/grep '^Swap:'|/usr/bin/awk '{print $3}'`
cacheswap.value `/bin/grep '^SwapCached:' /proc/meminfo|/usr/bin/awk '{print $2}'`
freeswap.value `/usr/bin/free|/bin/grep '^Swap:'|/usr/bin/awk '{print $4}'`"

13
plugins.d/uptime Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
# this plugin has been rewritten to avoid licensing conflicts.
if [ "$1" == "config" ]; then
echo "graph_title Uptime
graph_args --base 1000 -l 0
graph_vlabel days
uptime.label uptime
uptime.draw AREA"
exit 0
fi
/usr/bin/awk '{print "uptime.value",$1/86400}' /proc/uptime