Signed-off-by: Jonathan McCrohan <jmccrohan@gmail.com>
@ -0,0 +1,52 @@ | |||||
# | |||||
# Copyright (C) 2006-2014 OpenWrt.org | |||||
# | |||||
# This is free software, licensed under the GNU General Public License v2. | |||||
# See /LICENSE for more information. | |||||
# | |||||
include $(TOPDIR)/rules.mk | |||||
PKG_NAME:=muninlite | |||||
PKG_VERSION:=1.0.4 | |||||
PKG_RELEASE:=5 | |||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | |||||
PKG_SOURCE_URL:=@SF/$(PKG_NAME) | |||||
PKG_MD5SUM:=a8cc86f0cc536a6c22dc298f4ed55339 | |||||
include $(INCLUDE_DIR)/package.mk | |||||
define Package/muninlite | |||||
SECTION:=admin | |||||
CATEGORY:=Administration | |||||
DEPENDS:=+xinetd | |||||
TITLE:=Munin node implemented in shell | |||||
URL:=http://sourceforge.net/projects/muninlite/ | |||||
MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com> | |||||
endef | |||||
define Package/muninlite/Default/description | |||||
Munin node implemented in shell. | |||||
Munin is a monitoring system for Unix networks. | |||||
endef | |||||
define Package/muninlite/install | |||||
$(INSTALL_DIR) $(1)/usr/sbin/ | |||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/munin-node $(1)/usr/sbin/ | |||||
$(INSTALL_DIR) $(1)/etc/xinetd.d | |||||
$(INSTALL_DATA) ./files/etc/xinetd.d/munin $(1)/etc/xinetd.d/ | |||||
endef | |||||
define Package/muninlite/conffiles | |||||
/etc/xinetd.d/munin | |||||
endef | |||||
define Build/Configure | |||||
endef | |||||
define Build/Compile | |||||
$(MAKE) -C $(PKG_BUILD_DIR) | |||||
endef | |||||
$(eval $(call BuildPackage,muninlite)) |
@ -0,0 +1,10 @@ | |||||
service munin | |||||
{ | |||||
socket_type = stream | |||||
protocol = tcp | |||||
wait = no | |||||
user = root | |||||
group = root | |||||
server = /usr/sbin/munin-node | |||||
disable = no | |||||
} |
@ -0,0 +1,12 @@ | |||||
--- a/Makefile | |||||
+++ b/Makefile | |||||
@@ -1,7 +1,7 @@ | |||||
-PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats ntpdate plugindir_ | |||||
-#PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats | |||||
+#PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats ntpdate plugindir_ | |||||
+PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats | |||||
munin-node: plugins/* munin-node.conf | |||||
@VERSION=$$(cat VERSION); \ |
@ -0,0 +1,11 @@ | |||||
--- a/munin-node.in | |||||
+++ b/munin-node.in | |||||
@@ -113,7 +113,7 @@ PLUGINS=$RES | |||||
# ===== MAIN LOOP ===== | |||||
FUNCTIONS="list nodes config fetch version quit" | |||||
-HOSTNAME=$(hostname -f 2>/dev/null || hostname) | |||||
+HOSTNAME=$(/sbin/uci get "system.@system[0].hostname" 2>/dev/null || cat /proc/sys/kernel/hostname) | |||||
echo "# munin node at $HOSTNAME" | |||||
while read arg0 arg1 | |||||
do |
@ -0,0 +1,21 @@ | |||||
--- a/plugins/if_ | |||||
+++ b/plugins/if_ | |||||
@@ -15,10 +15,14 @@ config_if() { | |||||
echo "up.min 0" | |||||
echo "up.negative down" | |||||
echo "up.cdef up,8,*" | |||||
- if ethtool $1 | grep -q Speed; then | |||||
- MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) | |||||
- echo "up.max $MAX" | |||||
- echo "down.max $MAX" | |||||
+ if [ -n "$(which ethtool)" ]; then | |||||
+ if [ -x "$(which ethtool)" ]; then | |||||
+ if ethtool $1 | grep -q Speed; then | |||||
+ MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000)) | |||||
+ echo "up.max $MAX" | |||||
+ echo "down.max $MAX" | |||||
+ fi | |||||
+ fi | |||||
fi | |||||
} | |||||
fetch_if() { |
@ -0,0 +1,20 @@ | |||||
--- a/munin-node.in | |||||
+++ b/munin-node.in | |||||
@@ -72,7 +72,7 @@ RES="" | |||||
for PLUG in $PLUGINS | |||||
do | |||||
if [ "$PLUG" = "if_" ]; then | |||||
- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
+ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
do | |||||
INTERRES=$(echo $INTER | sed 's/\./VLAN/') | |||||
RES="$RES if_$INTERRES" | |||||
@@ -80,7 +80,7 @@ do | |||||
eval "config_if_${INTERRES}() { config_if $INTER $@; };" | |||||
done | |||||
elif [ "$PLUG" = "if_err_" ]; then | |||||
- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
+ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
do | |||||
INTERRES=$(echo $INTER | sed 's/\./VLAN/') | |||||
RES="$RES if_err_$INTERRES" |
@ -0,0 +1,24 @@ | |||||
--- a/munin-node.in | |||||
+++ b/munin-node.in | |||||
@@ -72,17 +72,17 @@ RES="" | |||||
for PLUG in $PLUGINS | |||||
do | |||||
if [ "$PLUG" = "if_" ]; then | |||||
- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
+ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
do | |||||
- INTERRES=$(echo $INTER | sed 's/\./VLAN/') | |||||
+ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') | |||||
RES="$RES if_$INTERRES" | |||||
eval "fetch_if_${INTERRES}() { fetch_if $INTER $@; };" | |||||
eval "config_if_${INTERRES}() { config_if $INTER $@; };" | |||||
done | |||||
elif [ "$PLUG" = "if_err_" ]; then | |||||
- for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
+ for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'); | |||||
do | |||||
- INTERRES=$(echo $INTER | sed 's/\./VLAN/') | |||||
+ INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/') | |||||
RES="$RES if_err_$INTERRES" | |||||
eval "fetch_if_err_${INTERRES}() { fetch_if_err $INTER $@; };" | |||||
eval "config_if_err_${INTERRES}() { config_if_err $INTER $@; };" |