Fixed any bugs I could find.

This commit is contained in:
Matthew Connelly 2015-02-19 22:44:42 +00:00
parent 760a1ae363
commit 953953a092
3 changed files with 4 additions and 4 deletions

View File

@ -6,7 +6,7 @@ myname='openwrt-munin-node'
ver='1.1'
host=`cat /proc/sys/kernel/hostname`
modules=""
register_module() { mn=`echo $1|sed 's/:$//'`;me=`echo $2|sed 's/:$//'`;shift 2;for f in config fetch;do rme=$me;[ "`echo $me|head -c1`" == "_" ]&&rme="$f$me";eval "${f}_$mn() { $rme `[ "$f" == "config" ]&&echo config` $@ \$@; };";done; }
register_module() { mn=`echo $1|sed 's/:$//'`;me=`echo $2|sed 's/:$//'`;shift 2;for f in config fetch;do rme=$me;[ "`echo $me|head -c1`" == "_" ]&&rme="$f$me";eval "${f}_$mn() { $rme `[ "$f" == "config" -a "$me" == "$rme" ]&&echo config` $@ \$@; };";done; }
is_registered() { [ ! -z "`command -v config_$1`" ] && [ ! -z "`command -v fetch_$1`" ] && return 0;return 1; }
register_modules() { for mod in `ls -1 $base/plugins.d/*`;do [ -f $mod -a -x $mod ] || continue;modn=`basename $mod`;[ "$modn" != "if" ]&&modules="$modules $modn";register_module $modn $mod;done; }
register_iface_modules() { for iface in `ifconfig|grep '^\w'|awk '{print $1}'`;do [ "$iface" == "lo" ] && continue; iface_mod=`echo $iface|sed -e 's/\./VLAN/;s/\-/_/'`;modules="$modules if_$iface_mod";register_module if_$iface_mod _if $iface;done; }

View File

@ -2,13 +2,13 @@
# this is just awful.
CPUS=`/bin/grep '^processor' /proc/cpuinfo`
CPUS=`/bin/grep -c '^processor' /proc/cpuinfo`
IINFO=`/bin/sed -e 's/ \{1,\}/ /g;s/^ //' /proc/interrupts|/bin/grep '.:'`
IDS=`echo "$IINFO"|/usr/bin/cut -d: -f1`
if [ "$1" == "config" ];then
echo "graph_title Individual interrupts
graph_args --base 1000 -l 0;
graph_args --base 1000 -l 0
graph_vlabel interrupts / \${graph_period}
graph_category system"
for ID in $IDS;do

View File

@ -10,4 +10,4 @@ leases.label leases"
exit 0
fi
echo "leases.value `cat /tmp/upnp.leases|/usr/bin/wc -l`
echo "leases.value `cat /tmp/upnp.leases|/usr/bin/wc -l`"