[Midnightbsd-cvs] mports: mports/sysutils: Add munin! Combined with the "server" part,

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri May 9 22:54:10 EDT 2008


Log Message:
-----------
Add munin!  Combined with the "server" part, this allows you to monitor system activity on one or more systems.  We dont' have the server "yet".

Modified Files:
--------------
    mports/sysutils:
        Makefile (r1.64 -> r1.65)

Added Files:
-----------
    mports/sysutils/munin-node:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-deinstall (r1.1)
        pkg-descr (r1.1)
        pkg-install (r1.1)
        pkg-plist (r1.1)
    mports/sysutils/munin-node/files:
        munin-node-revive.sh.in (r1.1)
        munin-node.sh.in (r1.1)
        patch-Makefile.config (r1.1)
        patch-hddtemp_smartctl.in (r1.1)
        patch-if_.in (r1.1)
        patch-munin-node.conf.in (r1.1)
        patch-node::midnightbsd (r1.1)
        pkg-message.in (r1.1)
        plugins.conf (r1.1)

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/sysutils/Makefile,v
retrieving revision 1.64
retrieving revision 1.65
diff -L sysutils/Makefile -L sysutils/Makefile -u -r1.64 -r1.65
--- sysutils/Makefile
+++ sysutils/Makefile
@@ -45,6 +45,7 @@
     SUBDIR += memtest
     SUBDIR += memtest86
     SUBDIR += mixer
+    SUBDIR += munin-node
     SUBDIR += nautilus-cd-burner
     SUBDIR += nodebrain
     SUBDIR += nvclock
--- /dev/null
+++ sysutils/munin-node/pkg-install
@@ -0,0 +1,121 @@
+#! /bin/sh
+
+ask() {
+    local question default answer
+
+    question=$1
+    default=$2
+    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+        read -p "${question} [${default}]? " answer
+    fi
+    if [ x${answer} = x ]; then
+        answer=${default}
+    fi
+    echo ${answer}
+}
+
+yesno() {
+    local dflt question answer
+
+    question=$1
+    dflt=$2
+    while :; do
+        answer=$(ask "${question}" "${dflt}")
+        case "${answer}" in
+        [Yy]*)          return 0;;
+        [Nn]*)          return 1;;
+        esac
+        echo "Please answer yes or no."
+    done
+}
+
+make_group() {
+    local g
+
+    g=$1
+
+    if pw group show "${g}" >/dev/null 2>&1; then
+	echo "You already have a group \"${g}\", so I will use it."
+    else
+	echo "You need a group \"${g}\"."
+	if which -s pw && yesno "Would you like me to create it" y; then
+	    pw groupadd ${g} || exit
+	    echo "Done."
+	else
+	    echo "Please create it, and try again."
+	    if ! /usr/sbin/pw user show ${u} >/dev/null 2>/dev/null; then
+		echo "While you're at it, please create a user \"${u}\" too,"
+		echo "with a default group of \"${g}\"."
+	    fi
+	    exit 1
+	fi
+    fi
+}
+
+init_plugins() {
+    if [ -f ${PKG_PREFIX}/etc/munin/VERSION.node ]; then
+	prevver=$(cat ${PKG_PREFIX}/etc/munin/VERSION.node)
+    fi
+
+    if [ -n "$prevver" ]; then
+	echo -n "Initializing new plugins.."
+	${PKG_PREFIX}/sbin/munin-node-configure --shell --newer "${prevver%-*}" | sh -x
+    else
+	echo -n "Initializing plugins.."
+	${PKG_PREFIX}/sbin/munin-node-configure --shell | sh -x
+    fi
+    echo "done."
+}
+
+create_crontab_entries() {
+    local sched prog
+    sched=$1
+    prog=$2
+
+    if grep -q "^[^#]*$prog" /etc/crontab; then
+	echo "It looks like your crontab is already set up, so I'll use that."
+    else
+	echo "It looks like your perl suffers from unsafe signals."
+	if yesno "Would you like me to set up your root crontab to restart munin-node" y; then
+	    cat <<EOT >>/etc/crontab
+$sched	root	$prog
+EOT
+	else
+	    echo "You may suffer from munin-node crashing after log rotation."
+	    echo "If you still want to restart munin-node, use $prog."
+	fi
+    fi
+}
+
+newsyslog() {
+    if yesno "Would you like me to set up log rotation" y; then
+	if grep -q /var/log/munin-node.log /etc/newsyslog.conf; then
+	    :
+	else
+	    cat >> /etc/newsyslog.conf <<EOT
+/var/log/munin-node.log			644  7	   *	@T00  Z	/var/run/munin/munin-node.pid
+EOT
+	fi
+	if [ -f ${PKG_PREFIX}/bin/munin-node-revive ]; then
+	    create_crontab_entries '4	*	*	*	*' ${PKG_PREFIX}/bin/munin-node-revive
+	fi
+    else
+	echo "/var/log/munin-node.log will grow without bounds."
+    fi
+}
+
+
+########################################################################
+
+case $2 in
+    PRE-INSTALL)
+	make_group munin
+	;;      
+    POST-INSTALL)
+	if [ -z "${PACKAGE_BUILDING}" ]; then
+		init_plugins
+		${PKG_PREFIX}/etc/rc.d/munin-node.sh start
+		newsyslog
+	fi
+	;;      
+esac
--- /dev/null
+++ sysutils/munin-node/pkg-descr
@@ -0,0 +1,13 @@
+Munin network-wide graphing framework (node)
+
+Munin is a tool for graphing all sorts of information about one or more
+servers and displaying it in a web interface. It uses the excellent
+RRDTool (written by Tobi Oetiker) and is written in Perl. Munin has a
+master/node architecture. The master connects to all the nodes at regular
+intervals, and asks them for data. It then stores the data in RRD-files,
+and (if needed) updates the graphs. One of the main goals have been ease
+of creating own "plugins" (graphs).
+
+This is the node part. It is used on all machines Munin shall watch.
+
+WWW: http://www.linpro.no/projects/munin/
--- /dev/null
+++ sysutils/munin-node/pkg-plist
@@ -0,0 +1,141 @@
+ at exec mkdir -p %D/etc/munin/plugins
+ at exec mkdir -p %D/etc/munin/plugin-conf.d && chmod 755 %D/etc/munin/plugin-conf.d
+ at exec mkdir -p %D/var/munin/plugin-state && chgrp munin %D/var/munin/plugin-state && chmod 775 %D/var/munin/plugin-state
+ at unexec rm %D/bin/munin-node-revive 2>/dev/null || true
+ at unexec if [ -n "$PACKAGE_BUILDING" ]; then rm -f %D/etc/munin/VERSION.node; fi
+ at unexec if cmp -s %D/etc/munin/munin-node.conf %D/etc/munin/munin-node.conf.sample; then rm -f %D/etc/munin/munin-node.conf; fi
+etc/munin/munin-node.conf.sample
+ at unexec if cmp -s %D/etc/munin/plugin-conf.d/plugins.conf %D/etc/munin/plugin-conf.d/plugins.conf.sample; then rm -f %D/etc/munin/plugin-conf.d/plugins.conf; fi
+etc/munin/plugin-conf.d/plugins.conf.sample
+etc/rc.d/munin-node.sh
+sbin/munin-node
+sbin/munin-node-configure
+sbin/munin-node-configure-snmp
+sbin/munin-run
+%%DATADIR%%/plugins/acpi
+%%DATADIR%%/plugins/amavis
+%%DATADIR%%/plugins/apache_accesses
+%%DATADIR%%/plugins/apache_processes
+%%DATADIR%%/plugins/apache_volume
+%%DATADIR%%/plugins/apc_envunit_
+%%DATADIR%%/plugins/apc_nis
+%%DATADIR%%/plugins/bind9
+%%DATADIR%%/plugins/bind9_rndc
+%%DATADIR%%/plugins/courier_
+%%DATADIR%%/plugins/courier_mta_mailqueue
+%%DATADIR%%/plugins/courier_mta_mailstats
+%%DATADIR%%/plugins/courier_mta_mailvolume
+%%DATADIR%%/plugins/cpu
+%%DATADIR%%/plugins/cupsys_pages
+%%DATADIR%%/plugins/df
+%%DATADIR%%/plugins/df_inode
+%%DATADIR%%/plugins/dhcpd3
+%%DATADIR%%/plugins/exim_mailqueue
+%%DATADIR%%/plugins/exim_mailqueue_alt
+%%DATADIR%%/plugins/exim_mailstats
+%%DATADIR%%/plugins/foldingathome
+%%DATADIR%%/plugins/foldingathome_rank
+%%DATADIR%%/plugins/foldingathome_wu
+%%DATADIR%%/plugins/hddtemp
+%%DATADIR%%/plugins/hddtemp2
+%%DATADIR%%/plugins/hddtemp_smartctl
+%%DATADIR%%/plugins/hddtempd
+%%DATADIR%%/plugins/if_
+%%DATADIR%%/plugins/if_errcoll_
+%%DATADIR%%/plugins/ipac-ng
+%%DATADIR%%/plugins/ircu
+%%DATADIR%%/plugins/load
+%%DATADIR%%/plugins/loggrep
+%%DATADIR%%/plugins/mailman
+%%DATADIR%%/plugins/mailscanner
+%%DATADIR%%/plugins/mbmon_
+%%DATADIR%%/plugins/memory
+%%DATADIR%%/plugins/mhttping
+%%DATADIR%%/plugins/multips
+%%DATADIR%%/plugins/munin_graph
+%%DATADIR%%/plugins/munin_update
+%%DATADIR%%/plugins/mysql_bytes
+%%DATADIR%%/plugins/mysql_isam_space_
+%%DATADIR%%/plugins/mysql_queries
+%%DATADIR%%/plugins/mysql_slowqueries
+%%DATADIR%%/plugins/mysql_threads
+%%DATADIR%%/plugins/named
+%%DATADIR%%/plugins/netstat
+%%DATADIR%%/plugins/ntp_
+%%DATADIR%%/plugins/ntp_states
+%%DATADIR%%/plugins/nut_misc
+%%DATADIR%%/plugins/nut_volts
+%%DATADIR%%/plugins/open_files
+%%DATADIR%%/plugins/perdition
+%%DATADIR%%/plugins/ping_
+%%DATADIR%%/plugins/plugins.history
+%%DATADIR%%/plugins/pm3users_
+%%DATADIR%%/plugins/pop_stats
+%%DATADIR%%/plugins/postfix_mailqueue
+%%DATADIR%%/plugins/postfix_mailstats
+%%DATADIR%%/plugins/postfix_mailvolume
+%%DATADIR%%/plugins/processes
+%%DATADIR%%/plugins/ps_
+%%DATADIR%%/plugins/psu_
+%%DATADIR%%/plugins/samba
+%%DATADIR%%/plugins/sendmail_mailqueue
+%%DATADIR%%/plugins/sendmail_mailstats
+%%DATADIR%%/plugins/sendmail_mailtraffic
+%%DATADIR%%/plugins/smart_
+%%DATADIR%%/plugins/snmp__df
+%%DATADIR%%/plugins/snmp__fc_if_
+%%DATADIR%%/plugins/snmp__fc_if_err_
+%%DATADIR%%/plugins/snmp__if_
+%%DATADIR%%/plugins/snmp__if_err_
+%%DATADIR%%/plugins/snmp__load
+%%DATADIR%%/plugins/snmp__processes
+%%DATADIR%%/plugins/snmp__sensors_fsc_bx_fan
+%%DATADIR%%/plugins/snmp__sensors_fsc_bx_temp
+%%DATADIR%%/plugins/snmp__sensors_fsc_fan
+%%DATADIR%%/plugins/snmp__sensors_fsc_temp
+%%DATADIR%%/plugins/snmp__sensors_mbm_fan
+%%DATADIR%%/plugins/snmp__sensors_mbm_temp
+%%DATADIR%%/plugins/snmp__sensors_mbm_volt
+%%DATADIR%%/plugins/snmp__users
+%%DATADIR%%/plugins/spamstats
+%%DATADIR%%/plugins/squid_cache
+%%DATADIR%%/plugins/squid_icp
+%%DATADIR%%/plugins/squid_requests
+%%DATADIR%%/plugins/squid_traffic
+%%DATADIR%%/plugins/surfboard
+%%DATADIR%%/plugins/swap
+%%DATADIR%%/plugins/sybase_space
+%%DATADIR%%/plugins/vmstat
+ at unexec rm -f /var/run/munin/munin-node.pid
+ at unexec rmdir /var/run/munin 2>/dev/null || true
+ at dirrmtry var/munin/plugin-state
+ at dirrmtry var/munin
+ at dirrmtry %%DATADIR%%/plugins
+ at dirrmtry %%DATADIR%%
+ at dirrmtry etc/munin/plugin-conf.d
+ at dirrmtry etc/munin/plugins
+ at dirrmtry etc/munin
+ at unexec echo remove %%SITE_PERL%%/Munin/Plugin
+ at unexec echo remove %%SITE_PERL%%/Munin
+ at dirrmtry %%SITE_PERL%%/Munin/Plugin
+ at dirrmtry %%SITE_PERL%%/Munin
+ at unexec echo
+ at unexec echo '********************************************************************'
+ at unexec echo "If you want to *completely* remove munin-node, you have to"
+ at unexec echo
+ at unexec echo "    rm -rf %D/etc/munin/VERSION.node %D/etc/munin/plugins \\"
+ at unexec if [ -d %D/var/munin/plugin-state ]; then echo "           %D/var/munin/plugin-state \\"; fi
+ at unexec if [ -f %D/etc/munin/munin-node.conf ]; then echo "           %D/etc/munin/munin-node.conf \\"; fi
+ at unexec if [ -d %D/var/munin/plugin-state ]; then echo "           %D/var/munin/plugin-state \\"; fi
+ at unexec if [ -d %%LOCALBASE%%/%%SITE_PERL%%/Munin/Plugin ]; then echo "           %%LOCALBASE%%/%%SITE_PERL%%/Munin/Plugin \\"; fi
+ at unexec if [ -d %%LOCALBASE%%/%%SITE_PERL%%/Munin ]; then echo "           %%LOCALBASE%%/%%SITE_PERL%%/Munin/Plugin \\"; fi
+ at unexec echo "           /var/log/munin-node.log*"
+ at unexec echo
+ at unexec echo "If you have already deinstalled munin-main, you can also"
+ at unexec echo
+ at unexec echo "    rmdir %D/etc/munin %D/var/munin"
+ at unexec echo
+ at unexec echo "These files and directories have to be left on the system because"
+ at unexec echo "you may be performing an update. This process can't tell."
+ at unexec echo '********************************************************************'
+ at unexec echo
--- /dev/null
+++ sysutils/munin-node/pkg-deinstall
@@ -0,0 +1,95 @@
+#! /bin/sh
+
+ask() {
+    local question default answer
+
+    question=$1
+    default=$2
+    if [ -z "${PACKAGE_BUILDING}" -a -z "${BATCH}" ]; then
+	read -p "${question} [${default}]? " answer
+    fi
+    if [ x${answer} = x ]; then
+	answer=${default}
+    fi
+    echo ${answer}
+}
+
+yesno() {
+    local dflt question answer
+
+    question=$1
+    dflt=$2
+    while :; do
+	answer=$(ask "${question}" "${dflt}")
+	case "${answer}" in
+	[Yy]*)		return 0;;
+	[Nn]*)		return 1;;
+	esac
+	echo "Please answer yes or no."
+    done
+}
+
+stop_process() {
+    STARTSTOP=${PKG_PREFIX}/etc/rc.d/munin-node.sh
+
+    if [ -x $STARTSTOP ]; then
+	$STARTSTOP stop
+    fi
+}
+
+delete_group() {
+    local g
+
+    g=$1
+    if yesno "Do you want me to remove group \"${g}\"" y; then
+	pw groupdel -n ${g}
+	echo "Done."
+    fi
+}
+
+delete_crontab_entries() {
+    local prog
+    prog=$1
+
+    if grep -q "^[^#]*$prog" /etc/crontab; then
+	TMPFILE=`mktemp -t munin` || exit 1
+	grep -v $prog /etc/crontab > $TMPFILE
+	cat $TMPFILE > /etc/crontab
+	rm $/etc/crontab
+    fi
+}
+
+delnewsyslog() {
+    tmp="/etc/#munin-node$$"
+    sed -e '/^\/var\/log\/munin-node.log[ 	]/d' /etc/newsyslog.conf >${tmp}
+    cat ${tmp} > /etc/newsyslog.conf
+    rm ${tmp}
+}
+
+newsyslog() {
+    ENTRY=`grep /var/log/munin-node.log /etc/newsyslog.conf`
+    DEFAULT='/var/log/munin-node.log			644  7	   *	@T00  Z	/var/run/munin/munin-node.pid'
+    if [ -z "$ENTRY" ]; then
+	exit 0
+    elif [ "$ENTRY" = "$DEFAULT" ]; then
+	delnewsyslog
+    elif yesno "You have changed the default munin-node entry in \"/etc/newsyslog.conf\".
+Do you want me to delete it?" y; then
+	delnewsyslog
+	echo "Done."
+    fi
+}
+
+
+case $2 in
+    DEINSTALL)
+	if [ -z "${PACKAGE_BUILDING}" ]; then
+		delete_crontab_entries ${PKG_PREFIX}/bin/munin-node-revive
+		stop_process
+		newsyslog
+	fi
+	;;
+    POST-DEINSTALL)
+	delete_group munin
+	;;
+esac
--- /dev/null
+++ sysutils/munin-node/Makefile
@@ -0,0 +1,53 @@
+# New ports collection makefile for:	munin-node
+# Date created:				25 Januar 2004
+# Whom:					Lupe Christoph <lupe at lupe-christoph.de>
+#
+# $MidnightBSD: mports/sysutils/munin-node/Makefile,v 1.1 2008/05/10 02:54:07 laffer1 Exp $
+#
+
+PORTNAME=	munin
+PORTVERSION=	1.2.5
+CATEGORIES=	sysutils perl5
+MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=	munin
+PKGNAMESUFFIX=	-node
+DISTNAME=	${PORTNAME}_${PORTVERSION:S/.r/rc/}
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	Node-specific part of Munin
+
+USE_PERL5=	yes
+
+RUN_DEPENDS=	${SITE_PERL}/Net/Server/Fork.pm:${PORTSDIR}/net/p5-Net-Server
+BUILD_DEPENDS=	${RUN_DEPENDS}
+
+.include <bsd.port.pre.mk>
+
+USE_GMAKE=	yes
+WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION:S/.r/rc/}
+PKGMESSAGE=	${WRKDIR}/pkg-message
+ALL_TARGET=	DATADIR=${DATADIR} PERL=${PERL} build build-man
+INSTALL_TARGET=	DATADIR=${FAKE_DESTDIR}/${DATADIR} PERL=${PERL} SITE_PERL_REL=$(SITE_PERL_REL) install-node install-node-plugins
+MAKE_ENV=	LANG=C
+
+MAN5=		munin-node.conf.5
+MAN8=		munin-node-configure.8 munin-node.8 munin-run.8
+
+SUB_FILES=	pkg-message munin-node.sh munin-node-revive.sh
+SUB_LIST=	RC_SUBR=${RC_SUBR}
+USE_RC_SUBR=	YES
+
+post-install:
+	${INSTALL_SCRIPT} ${WRKDIR}/munin-node.sh ${PREFIX}/etc/rc.d/munin-node.sh
+	${INSTALL_DATA} ${WRKSRC}/build/node/munin-node.conf ${PREFIX}/etc/munin/munin-node.conf.sample
+	${INSTALL_DATA} ${FILESDIR}/plugins.conf ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf.sample
+	@if [ ! -f ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf ]; then \
+		${INSTALL_DATA} ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf.sample ${PREFIX}/etc/munin/plugin-conf.d/plugins.conf; \
+	fi
+	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node.conf.5 ${PREFIX}/man/man5
+	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node-configure.8 ${PREFIX}/man/man8
+	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-node.8 ${PREFIX}/man/man8
+	@${INSTALL_MAN} -C ${WRKSRC}/build/doc/munin-run.8 ${PREFIX}/man/man8
+	@${ECHO} ${DISTNAME} | ${SED} -e 's/munin_//' > ${PREFIX}/etc/munin/VERSION.node
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ sysutils/munin-node/distinfo
@@ -0,0 +1,3 @@
+MD5 (munin_1.2.5.tar.gz) = e863d11693c02bde1c593a6c701e64fd
+SHA256 (munin_1.2.5.tar.gz) = 2d1ea4aa3f0eaf11a5beb0b90f9bbee63e184249e06274fcc9d4c17b70b47a5e
+SIZE (munin_1.2.5.tar.gz) = 353005
--- /dev/null
+++ sysutils/munin-node/files/patch-if_.in
@@ -0,0 +1,22 @@
+--- node/node.d.freebsd/if_.in.orig	2006-10-17 14:27:35.000000000 +0200
++++ node/node.d.freebsd/if_.in	2007-10-26 10:52:46.000000000 +0200
+@@ -63,7 +63,7 @@
+ 
+ if [ "$1" = "suggest" ]; then
+ 	if [ -x /usr/bin/netstat ]; then
+-		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
+ 		exit 0
+ 	else
+ 		exit 1
+--- node/node.d.freebsd/if_errcoll_.in.orig	2006-10-17 14:27:35.000000000 +0200
++++ node/node.d.freebsd/if_errcoll_.in	2007-10-26 10:53:08.000000000 +0200
+@@ -57,7 +57,7 @@
+ 
+ if [ "$1" = "suggest" ]; then
+ 	if [ -x /usr/bin/netstat ]; then
+-		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
+ 		exit 0
+ 	else
+ 		exit 1
--- /dev/null
+++ sysutils/munin-node/files/munin-node.sh.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+
+# PROVIDE: munin-node
+# REQUIRE: DAEMON
+# BEFORE:  cron
+
+#
+# Add the following lines to /etc/rc.conf to enable munin-node:
+# munin_node_enable (bool):      Set to "NO" by default.
+#                                Set it to "YES" to enable munin-node
+# munin_node_config (path):      Set to "%%PREFIX%%/etc/munin/munin-node.conf" by default.
+#
+
+. %%RC_SUBR%%
+
+name="munin_node"
+rcvar=`set_rcvar`
+
+[ -z "$munin_node_enable" ] && munin_node_enable="NO"
+[ -z "$munin_node_config" ] && munin_node_config="%%PREFIX%%/etc/munin/munin-node.conf"
+
+command="%%PREFIX%%/sbin/munin-node"
+pidfile=`awk '$1 == "pid_file" { print $2 }' $munin_node_config`
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+++ sysutils/munin-node/files/patch-node::midnightbsd
@@ -0,0 +1,1454 @@
+diff -urN node.d.midnightbsd.orig/cpu.in node.d.midnightbsd/cpu.in
+--- node/node.d.midnightbsd.orig/cpu.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/cpu.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,156 @@
++#!/bin/sh
++#
++# Plugin to monitor CPU usage.
++#
++# Usage: Place in /etc/munin/node.d/ (or link it there  using ln -s)
++#
++# Parameters understood:
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.8.2.3  2005/02/03 13:28:50  lupe
++# correct field.info
++#
++# Revision 1.8.2.2  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.10  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.9  2005/01/25 08:48:28  lupe
++# Correct multi-CPU bugs
++#
++# Revision 1.8.2.1  2005/01/25 09:22:52  lupe
++# Correct multi-CPU bugs
++#
++# Revision 1.8  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.7  2004/11/28 09:43:54  lupe
++# 6-CURRENT support
++#
++# Revision 1.6  2004/11/21 00:16:56  jimmyo
++# Changed a lot of plugins so they use DERIVE instead of COUNTER.
++#
++# Revision 1.5  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# Revision 1.4  2004/05/09 19:18:35  jimmyo
++# Added support for scaleto100-parameter (patch from Lupe Christoph).
++#
++# Revision 1.3  2004/02/18 16:39:36  jimmyo
++# Turned off scaling of values for cpu-graphs (no more nano-percentages).
++#
++# Revision 1.2  2004/02/01 18:59:54  lupe
++# FreeBSD 5 compatibility.
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers - optional - used by installation scripts and
++# munin-config:
++#
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /sbin/sysctl ]; then
++		/sbin/sysctl kern.cp_time > /dev/null
++		if [ $? = "0" ]; then
++			echo yes
++			exit 0
++		else
++			echo no
++			exit 1
++		fi
++	else
++		echo no
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.`
++	if [ "$OSV" = "4" ]; then
++		STATUNITS=`/sbin/sysctl -n kern.clockrate | cut -f16 -d' '`
++	elif [ "$OSV" -ge "5" ]; then
++		STATUNITS=`/sbin/sysctl -n kern.clockrate | cut -f13 -d' '`
++	fi
++	PERCENT=`/sbin/sysctl -n hw.ncpu | awk '{print ($1)*100}'`
++	NCPU=`/sbin/sysctl -n hw.ncpu`
++	if [ "$scaleto100" = yes ]; then
++		CDEF="$STATUNITS,/,100,*,$NCPU,/"
++		PERCENT=100
++	else
++		CDEF="$STATUNITS,/,100,*"
++		PERCENT=$(($NCPU*100))
++	fi
++#	SYSWARNING=$PERCENT*30/100
++#	SYSCRITICAL=$PERCENT*50/100
++#	INTWARNING=$PERCENT*80/100
++#	USRWARNING=$PERCENT*80/100
++	echo 'graph_title CPU usage'
++	echo 'graph_order system interrupt user nice idle'
++	echo "graph_args --base 1000 -r --lower-limit 0 --upper-limit $PERCENT "
++	echo 'graph_vlabel %'
++	echo 'graph_scale no'
++	echo 'graph_info This graph shows how CPU time is spent.'
++	echo 'graph_category system'
++	echo 'graph_period second'
++	echo 'system.label system'
++	echo 'system.draw AREA'
++	echo 'system.max 5000'
++	echo 'system.type DERIVE'
++	echo 'system.min 0'
++#	echo "system.warning $SYSWARNING" 
++#	echo "system.critical $SYSCRITICAL" 
++	echo 'system.info CPU time spent by the kernel in system activities'
++	echo "system.cdef system,$CDEF"
++	echo 'interrupt.label interrupt'
++	echo 'interrupt.draw STACK'
++	echo 'interrupt.max 5000'
++#	echo "interrupt.warning $INTWARNING"
++	echo 'interrupt.type DERIVE'
++	echo 'interrupt.min 0'
++	echo 'interrupt.info CPU time spent by the kernel processing interrupts'
++	echo "interrupt.cdef interrupt,$CDEF"
++	echo 'user.label user'
++	echo 'user.draw STACK'
++	echo 'user.max 5000'
++#	echo "user.warning $USRWARNING"
++	echo 'user.type DERIVE'
++	echo 'user.info CPU time spent by normal programs and daemons'
++	echo 'user.min 0'
++	echo "user.cdef user,$CDEF"
++	echo 'nice.label nice'
++	echo 'nice.draw STACK'
++	echo 'nice.max 5000'
++	echo 'nice.type DERIVE'
++	echo 'nice.info CPU time spent by nice(1)d programs'
++	echo 'nice.min 0'
++	echo "nice.cdef nice,$CDEF"
++	echo 'idle.label idle'
++	echo 'idle.draw STACK'
++	echo 'idle.max 5000'
++	echo 'idle.type DERIVE'
++	echo 'idle.info Idle CPU time'
++	echo 'idle.min 0'
++	echo "idle.cdef idle,$CDEF"
++	exit 0
++fi
++
++/sbin/sysctl kern.cp_time | awk '{ print "user.value " $2 "\nnice.value " $3 "\nsystem.value " $4 "\ninterrupt.value " $5 "\nidle.value " $6 }'
++
+diff -urN node.d.midnightbsd.orig/df.in node.d.midnightbsd/df.in
+--- node/node.d.midnightbsd.orig/df.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/df.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,95 @@
++#!/bin/sh
++#
++# Script to monitor disk usage.
++#
++# Parameters understood:
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.4.2.4  2005/01/28 16:24:23  lupe
++# Minor corrections
++#
++# Revision 1.4.2.3  2005/01/28 14:52:23  lupe
++# Delete a merge marker
++#
++# Revision 1.4.2.2  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# Revision 1.2.2.1  2005/01/25 10:32:40  lupe
++# Add support for FreeBSD 4.x ramdisks
++#
++# Revision 1.2.2.1  2005/01/25 10:32:40  lupe
++# Add support for FreeBSD 4.x ramdisks
++#
++# Revision 1.2.2.1  2005/01/25 10:32:40  lupe
++# Add support for FreeBSD 4.x ramdisks
++#
++# Revision 1.2  2004/02/01 19:00:29  lupe
++# Ignore devfs,fdescfs,linprocfs in addition to procfs,nfs.
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf
++
++MAXLABEL=20
++
++if [ "$1" = "autoconf" ]; then
++	echo yes
++	exit 0
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title Filesystem usage (in %)'
++	echo 'graph_args --upper-limit 100 -l 0'
++	echo 'graph_vlabel %'
++	echo 'graph_category disk'
++	echo 'graph_info This graph shows disk usage on the machine.'
++	mfs=0
++	/bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,nfs | tail +2 | grep -v "//" | while read i; do
++		case $i in
++		mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
++		*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
++		esac
++		echo -n "$name.label "
++		echo $i | awk "{
++			dir=\$6;
++			if (length(dir) <= $MAXLABEL)
++				print dir
++			else
++				printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
++			print \"$name.info \" \$6 \" -> \" \$1;
++			}"
++		echo "$name.warning 92"
++		echo "$name.critical 98"
++	done
++	exit 0
++fi
++
++mfs=0
++/bin/df -P -t noprocfs,devfs,fdescfs,linprocfs,nfs | tail +2 | grep -v "//" | while read i; do
++	case $i in
++	mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
++	*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
++	esac
++	echo -n "$name.value "
++	echo $i | awk '{ print $5 }' | cut -f1 -d%
++done
+diff -urN node.d.midnightbsd.orig/df_inode.in node.d.midnightbsd/df_inode.in
+--- node/node.d.midnightbsd.orig/df_inode.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/df_inode.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,103 @@
++#!/bin/sh
++#
++# Plugin to monitor inode-usage.
++#
++# Parameters understood:
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.4.2.4  2005/02/03 13:28:50  lupe
++# correct field.info
++#
++# Revision 1.4.2.3  2005/01/28 16:24:22  lupe
++# Minor corrections
++#
++# Revision 1.4.2.2  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# Revision 1.3  2004/05/18 22:04:30  jimmyo
++# Use "sed 1d" instead of "tail +2" in df plugins (patch by Olivier Delhomme).
++#
++# Revision 1.2.2.1  2005/01/25 10:32:40  lupe
++# Add support for FreeBSD 4.x ramdisks
++#
++# Revision 1.2  2004/02/01 19:00:29  lupe
++# Ignore devfs,fdescfs,linprocfs in addition to procfs,nfs.
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf
++
++MAXLABEL=20
++
++print_values() {
++	mfs=0
++	/bin/df -P -i -t noprocfs,devfs,fdescfs,linprocfs,nfs | tail +2 | grep -v "//" | while read i; do
++		case $i in
++		mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
++		*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
++		esac
++		echo -n "$name.value "
++		echo $i | awk '{ print $8 }' | cut -f1 -d%
++	done
++}
++
++if [ "$1" = "autoconf" ]; then
++	if [ "`print_values`" = "" ] ; then
++		echo no
++	else
++		echo yes
++	fi
++	exit 0
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title Inode usage (in %)'
++	echo 'graph_args --upper-limit 100 -l 0'
++	echo 'graph_vlabel %'
++	echo 'graph_category disk'
++	echo 'graph_info This graph shows the inode usage for the partitions of types that use inodes.'
++	/bin/df -P -i -t noprocfs,devfs,fdescfs,linprocfs,nfs | tail +2 | grep -v "//" | awk "
++		BEGIN {
++			mfs = 0
++		}
++		{
++			name = \$1
++			dir = \$9
++			if (\$1 ~ /^mfs:/) {
++				name = \"mfs\" mfs
++				mfs = mfs + 1
++			} else {
++				gsub(/[^a-zA-Z0-9_]/, \"_\", name)
++			}
++			if (length(dir) <= $MAXLABEL)
++				print name \".label \" dir
++			else
++				printf (\"%s.label ...%s\n\", name, substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
++			print name \".info \" dir \" -> \" \$1
++			print name \".warning 92\"
++			print name \".critical 98\"
++		}"
++	exit 0
++fi
++
++print_values
+diff -urN node.d.midnightbsd.orig/if_.in node.d.midnightbsd/if_.in
+--- node/node.d.midnightbsd.orig/if_.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/if_.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,102 @@
++#!/bin/sh
++#
++# Wildcard-plugin to monitor network interfaces. To monitor an
++# interface, link if_<interface> to this file. E.g.
++#
++#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
++#
++# ...will monitor eth0.
++#
++# Any device found in /usr/bin/netstat can be monitored.
++#
++# $Log$
++# Revision 1.4.2.3  2005/02/17 10:57:54  lupe
++# Added warning note in if_ output.
++#
++# Revision 1.4.2.2  2005/01/28 16:24:22  lupe
++# Minor corrections
++#
++# Revision 1.4.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.3  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.3  2003/11/07 22:12:50  jimmyo
++# Changed deprecated plugin options
++#
++# Revision 1.2  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf suggest
++
++
++INTERFACE=`basename $0 | sed 's/^if_//g'`
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (/usr/bin/netstat not found)"
++		exit 1
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo "graph_order rbytes obytes" 
++	echo "graph_title $INTERFACE traffic"
++	echo 'graph_args --base 1000'
++	echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)'
++	echo 'graph_category network'
++	echo "graph_info This graph shows the traffic of the $INTERFACE network interface. Please note that the traffic is shown in bits per second, not bytes. IMPORTANT: Since the data source for this plugin use 32bit counters, this plugin is really unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that this plugin is usuitable for most production environments."
++	echo 'rbytes.label received'
++        echo 'rbytes.type COUNTER'
++        echo 'rbytes.graph no'
++        echo 'rbytes.cdef rbytes,8,*'
++        echo 'obytes.label bps'
++	echo 'obytes.type COUNTER'
++	echo 'obytes.negative rbytes'
++	echo 'obytes.cdef obytes,8,*'
++	echo "obytes.info Traffic sent (+) and received (-) on the $INTERFACE network interface."
++	exit 0
++fi;
++
++/usr/bin/netstat -i -b -I $INTERFACE | awk '
++/<Link#[0-9]*>/ {
++	if (NF == 10) { 
++		print "rbytes.value", $6;
++		print "obytes.value", $9;
++	} else {
++		print "rbytes.value", $7;
++		print "obytes.value", $10;
++	}
++}'
+diff -urN node.d.midnightbsd.orig/if_.in.orig node.d.midnightbsd/if_.in.orig
+--- node/node.d.midnightbsd.orig/if_.in.orig	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/if_.in.orig	Fri May  9 22:19:35 2008
+@@ -0,0 +1,102 @@
++#!/bin/sh
++#
++# Wildcard-plugin to monitor network interfaces. To monitor an
++# interface, link if_<interface> to this file. E.g.
++#
++#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
++#
++# ...will monitor eth0.
++#
++# Any device found in /usr/bin/netstat can be monitored.
++#
++# $Log$
++# Revision 1.4.2.3  2005/02/17 10:57:54  lupe
++# Added warning note in if_ output.
++#
++# Revision 1.4.2.2  2005/01/28 16:24:22  lupe
++# Minor corrections
++#
++# Revision 1.4.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.3  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.3  2003/11/07 22:12:50  jimmyo
++# Changed deprecated plugin options
++#
++# Revision 1.2  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf suggest
++
++
++INTERFACE=`basename $0 | sed 's/^if_//g'`
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (/usr/bin/netstat not found)"
++		exit 1
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo "graph_order rbytes obytes" 
++	echo "graph_title $INTERFACE traffic"
++	echo 'graph_args --base 1000'
++	echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)'
++	echo 'graph_category network'
++	echo "graph_info This graph shows the traffic of the $INTERFACE network interface. Please note that the traffic is shown in bits per second, not bytes. IMPORTANT: Since the data source for this plugin use 32bit counters, this plugin is really unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that this plugin is usuitable for most production environments."
++	echo 'rbytes.label received'
++        echo 'rbytes.type COUNTER'
++        echo 'rbytes.graph no'
++        echo 'rbytes.cdef rbytes,8,*'
++        echo 'obytes.label bps'
++	echo 'obytes.type COUNTER'
++	echo 'obytes.negative rbytes'
++	echo 'obytes.cdef obytes,8,*'
++	echo "obytes.info Traffic sent (+) and received (-) on the $INTERFACE network interface."
++	exit 0
++fi;
++
++/usr/bin/netstat -i -b -I $INTERFACE | awk '
++/<Link#[0-9]*>/ {
++	if (NF == 10) { 
++		print "rbytes.value", $6;
++		print "obytes.value", $9;
++	} else {
++		print "rbytes.value", $7;
++		print "obytes.value", $10;
++	}
++}'
+diff -urN node.d.midnightbsd.orig/if_errcoll_.in node.d.midnightbsd/if_errcoll_.in
+--- node/node.d.midnightbsd.orig/if_errcoll_.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/if_errcoll_.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,94 @@
++#!/bin/sh
++#
++# Wildcard-plugin to monitor network interfaces. To monitor an
++# interface, link if_<interface> to this file. E.g.
++#
++#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
++#
++# ...will monitor eth0.
++#
++# Any device found in /usr/bin/netstat can be monitored.
++#
++# $Log$
++# Revision 1.4.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.5  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.3  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf suggest
++
++
++INTERFACE=`basename $0 | sed 's/^if_errcoll_//g'`
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (/usr/bin/netstat not found)"
++		exit 1
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++	echo "graph_order ierrors oerrors collisions"
++	echo "graph_title $INTERFACE Errors & Collisions"
++	echo 'graph_args --base 1000'
++	echo 'graph_vlabel events / ${graph_period}'
++	echo 'graph_category network'
++	echo "graph_info This graph shows the amount of errors and collisions on the $INTERFACE network interface."
++	echo 'ierrors.label Input Errors'
++        echo 'ierrors.type COUNTER'
++        echo 'oerrors.label Output Errors'
++	echo 'oerrors.type COUNTER'
++        echo 'collisions.label Collisions'
++	echo 'collisions.type COUNTER'
++	exit 0
++fi;
++
++/usr/bin/netstat -i -b -I $INTERFACE | awk '
++/<Link#[0-9]*>/ {
++	if (NF == 10) {
++		print "ierrors.value", $5;
++		print "oerrors.value", $8;
++		print "collisions.value", $10;
++	} else {
++		print "ierrors.value", $6;
++		print "oerrors.value", $9;
++		print "collisions.value", $11;
++	}
++}'
+diff -urN node.d.midnightbsd.orig/if_errcoll_.in.orig node.d.midnightbsd/if_errcoll_.in.orig
+--- node/node.d.midnightbsd.orig/if_errcoll_.in.orig	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/if_errcoll_.in.orig	Fri May  9 22:19:34 2008
+@@ -0,0 +1,94 @@
++#!/bin/sh
++#
++# Wildcard-plugin to monitor network interfaces. To monitor an
++# interface, link if_<interface> to this file. E.g.
++#
++#    ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
++#
++# ...will monitor eth0.
++#
++# Any device found in /usr/bin/netstat can be monitored.
++#
++# $Log$
++# Revision 1.4.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.5  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.3  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#
++#%# family=auto
++#%# capabilities=autoconf suggest
++
++
++INTERFACE=`basename $0 | sed 's/^if_errcoll_//g'`
++
++if [ "$1" = "autoconf" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		echo yes
++		exit 0
++	else
++		echo "no (/usr/bin/netstat not found)"
++		exit 1
++	fi
++fi
++
++if [ "$1" = "suggest" ]; then
++	if [ -x /usr/bin/netstat ]; then
++		netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link#[0-9]*>/s/\** .*//p'
++		exit 0
++	else
++		exit 1
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++	echo "graph_order ierrors oerrors collisions"
++	echo "graph_title $INTERFACE Errors & Collisions"
++	echo 'graph_args --base 1000'
++	echo 'graph_vlabel events / ${graph_period}'
++	echo 'graph_category network'
++	echo "graph_info This graph shows the amount of errors and collisions on the $INTERFACE network interface."
++	echo 'ierrors.label Input Errors'
++        echo 'ierrors.type COUNTER'
++        echo 'oerrors.label Output Errors'
++	echo 'oerrors.type COUNTER'
++        echo 'collisions.label Collisions'
++	echo 'collisions.type COUNTER'
++	exit 0
++fi;
++
++/usr/bin/netstat -i -b -I $INTERFACE | awk '
++/<Link#[0-9]*>/ {
++	if (NF == 10) {
++		print "ierrors.value", $5;
++		print "oerrors.value", $8;
++		print "collisions.value", $10;
++	} else {
++		print "ierrors.value", $6;
++		print "oerrors.value", $9;
++		print "collisions.value", $11;
++	}
++}'
+diff -urN node.d.midnightbsd.orig/load.in node.d.midnightbsd/load.in
+--- node/node.d.midnightbsd.orig/load.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/load.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,127 @@
++#!/bin/sh
++# 
++# Plugin to monitor the load average on a system.
++#
++# Usage: Link or copy into /etc/munin/node.d/
++#
++# Magic markers (optional - only used by munin-config and some
++# installation scripts):
++#
++# $Log$
++# Revision 1.3.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.3  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# Revision 1.2  2004/01/15 16:58:10  jimmyo
++# FreeBSD-plugin load bugfix from Robert Lindgren (SF#865928).
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++# If run with the "autoconf"-parameter, give our opinion on wether we
++# should be run on this system or not. This is optinal, and only used by
++# munin-config. In the case of this plugin, we should most probably
++# always be included.
++
++if [ "$1" = "autoconf" ]; then
++    if [ -x /sbin/sysctl ]; then
++        /sbin/sysctl vm.loadavg > /dev/null
++    	if [ $? = "0" ]; then
++	    	echo yes
++    		exit 0
++    	else
++		    echo no
++		    exit 1
++	    fi
++    else
++        echo no
++        exit 1
++    fi
++fi
++
++# If run with the "config"-parameter, give out information on how the
++# graphs should look. 
++ 
++if [ "$1" = "config" ]; then
++	# The host name this plugin is for. (Can be overridden to have
++	# one machine answer for several)
++
++	# The title of the graph
++	echo 'graph_title Load average'
++	# Arguments to "rrdtool graph". In this case, tell it that the
++	# lower limit of the graph is '0', and that 1k=1000 (not 1024)
++	echo 'graph_args --base 1000 -l 0'
++	# The Y-axis label
++	echo 'graph_vlabel load'
++	# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
++	# 420 milliload)
++	echo 'graph_noscale true'
++	# The category of the plugin. Defaults to "other".
++	echo 'graph_category system'
++	# The fields. "label" is used in the legend. "label" is the only
++	# required subfield. 
++	echo 'load.label load'
++	# These two are optional. They are only used if you have
++	# configured your munin to tell a Nagios-server about any
++	# problems
++	echo 'load.warning 10'
++	echo 'load.critical 120'
++	# This one is purely to add an explanation to the web page. The first
++	# one is for the graph itself, while the second one is for the field
++	# "load".
++	echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").'
++	echo 'load.info Average load for the five minutes.'
++
++	# Last, if run with the "config"-parameter, quit here (don't
++	# display any data)
++	exit 0
++fi
++
++# If not run with any parameters at all (or only unknown ones), do the
++# real work - i.e. display the data. Almost always this will be
++# "value" subfield for every data field.
++
++echo -n "load.value "
++/sbin/sysctl vm.loadavg | cut -f3 -d' '
++
++# How could this plugin have been written in its simplest form?
++# Something like this:
++#
++# ---------------------
++# #!/bin/sh
++
++#
++# if [ "$1" = "config" ]; then
++
++# 	echo "graph_title Load average"
++#	echo 'graph_args --base 1000 -l 0'
++#	echo 'graph_vlabel load'
++# 	echo "load.label load"
++# 	exit 0
++# fi
++# echo -n "load.value "
++# cut -f1 -d' ' < /proc/loadavg
++# ---------------------
++#
++# Except for the Nagios-warnings (which most people don't have any need
++# for) and things used by installation scripts and munin-config (which
++# you don't need if you don't plan on submitting your plugin to the
++# pacakge), the two versions will work identically.
+diff -urN node.d.midnightbsd.orig/memory.in node.d.midnightbsd/memory.in
+--- node/node.d.midnightbsd.orig/memory.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/memory.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,95 @@
++#!/bin/sh
++#
++# Plugin to monitor memory usage.
++#
++# Parameters:
++#
++# 	config   (required)
++# 	autoconf (optional - only used by munin-config)
++#
++# $Log$
++# Revision 1.2.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.3  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - only used by munin-config and some
++# installation scripts):
++#%# family=auto
++#%# capabilities=autoconf
++
++if [ "$1" = "autoconf" ]; then
++    if [ -x /sbin/sysctl ]; then
++        /sbin/sysctl vm.stats.vm.v_page_size > /dev/null
++    	if [ $? = "0" ]; then
++	    	echo yes
++    		exit 0
++    	else
++		    echo no
++		    exit 1
++	    fi
++    else
++        echo no
++        exit 1
++    fi
++fi
++
++    PAGESIZE=`/sbin/sysctl -n vm.stats.vm.v_page_size`
++    MEMSIZE=`/sbin/sysctl -n vm.stats.vm.v_page_count`
++    MEMMAX=`echo 'scale=2;' $PAGESIZE*$MEMSIZE | bc -q `
++
++if [ "$1" = "config" ]; then
++
++        echo 'graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit '$MEMMAX
++	echo 'graph_title Memory usage'
++	echo 'graph_category system'
++	echo 'graph_info This graph shows what the machine uses its memory for.';
++	echo 'graph_order active inactive wired buffers cached free'
++	echo 'active.label active'
++	echo 'active.info pages recently statistically used'
++	echo 'active.draw AREA'
++	echo 'inactive.label inactive'
++	echo 'inactive.info pages recently statistically unused'
++	echo 'inactive.draw STACK'
++	echo 'wired.label wired'
++	echo 'wired.info pages that are fixed into memory, usually for kernel purposes, but also sometimes for special use in processes'
++	echo 'wired.draw STACK'
++	echo 'buffers.label buffers'
++	echo 'buffers.info pages used for filesystem buffers'
++	echo 'buffers.draw STACK'
++	echo 'cached.label cache'
++	echo 'cached.info pages that have percolated from inactive to a status where they maintain their data, but can often be immediately reused'
++	echo 'cached.draw STACK'
++	echo 'free.label free'
++	echo 'free.info pages without data content'
++	echo 'free.draw STACK'
++	exit 0
++fi
++
++ACTIVE_COUNT=`/sbin/sysctl -n vm.stats.vm.v_active_count`
++INACTIVE_COUNT=`/sbin/sysctl -n vm.stats.vm.v_inactive_count`
++FREE_COUNT=`/sbin/sysctl -n vm.stats.vm.v_free_count`
++CACHE_COUNT=`/sbin/sysctl -n vm.stats.vm.v_cache_count`
++BUFFERS_COUNT=`/sbin/sysctl -n vfs.bufspace`
++WIRED_COUNT=`/sbin/sysctl -n vm.stats.vm.v_wire_count`
++echo 'print "active.value ";' $ACTIVE_COUNT*$PAGESIZE | bc -q
++echo 'print "inactive.value ";' $INACTIVE_COUNT*$PAGESIZE | bc -q
++echo 'print "cached.value ";' $CACHE_COUNT*$PAGESIZE | bc -q
++echo 'print "free.value ";' $FREE_COUNT*$PAGESIZE | bc -q
++echo 'print "wired.value ";' $WIRED_COUNT*$PAGESIZE | bc -q
++echo buffers.value $BUFFERS_COUNT
+diff -urN node.d.midnightbsd.orig/netstat.in node.d.midnightbsd/netstat.in
+--- node/node.d.midnightbsd.orig/netstat.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/netstat.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,100 @@
++#!/bin/sh
++#
++# Plugin to monitor network connections.
++#
++# Parameters:
++#
++# 	config   (required)
++# 	autoconf (optional - only used by munin-config)
++#
++# $Log$
++# Revision 1.5.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.6  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.5  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.4  2004/12/09 22:12:55  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.3  2004/11/21 00:16:56  jimmyo
++# Changed a lot of plugins so they use DERIVE instead of COUNTER.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (optional - used by munin-config and some installation
++# scripts):
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++if [ "$1" = "autoconf" ]; then
++	if ( netstat -s 2>/dev/null >/dev/null ); then
++		echo yes
++		exit 0
++	else
++		if [ $? -eq 127 ]
++		then
++			echo "no (netstat program not found)"
++			exit 1
++		else
++			echo no
++			exit 1
++		fi
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title Netstat'
++	echo 'graph_args -l 0 --base 1000'
++	echo 'graph_vlabel active connections per ${graph_period}'
++	echo 'graph_category network'
++	echo 'graph_period second'
++	echo 'graph_info This graph shows the TCP activity of all the network interfaces combined.'
++	echo 'active.label active'
++	echo 'active.type DERIVE'
++	echo 'active.min 0'
++	echo 'active.max 50000'
++	echo 'active.info The number of active TCP openings per second.'
++	echo 'passive.label passive'
++	echo 'passive.type DERIVE'
++	echo 'passive.min 0'
++	echo 'passive.max 50000'
++	echo 'passive.info The number of passive TCP openings per second.'
++	echo 'failed.label failed'
++	echo 'failed.type DERIVE'
++	echo 'failed.min 0'
++	echo 'failed.max 50000'
++	echo 'failed.info The number of failed TCP connection attempts per second.'
++	echo 'resets.label resets'
++	echo 'resets.type DERIVE'
++	echo 'resets.min 0'
++	echo 'resets.max 50000'
++	echo 'resets.info The number of TCP connection resets.'
++	echo 'established.label established'
++	echo 'established.type DERIVE'
++	echo 'established.min 0'
++	echo 'established.max 50000'
++	echo 'established.info The number of currently open connections.'
++	exit 0
++fi
++
++netstat -s | awk '/connection requests/ { print "active.value " $1 } /connection accepts/ { print "passive.value " $1 } /bad connection/ { print "failed.value " $1 } /reset/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
++
+diff -urN node.d.midnightbsd.orig/open_files.in node.d.midnightbsd/open_files.in
+--- node/node.d.midnightbsd.orig/open_files.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/open_files.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,74 @@
++#!/bin/sh
++# 
++# Plugin to monitor the number of open files in the system.
++#
++# Parameters:
++# 	
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.2.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.3  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (Used by munin-config and some installation scripts.
++# Optional):
++#
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++if [ "$1" = "autoconf" ]; then
++    if [ -x /sbin/sysctl ]; then
++        /sbin/sysctl kern.openfiles > /dev/null
++    	if [ $? = "0" ]; then
++	    	echo yes
++    		exit 0
++    	else
++		    echo no
++		    exit 1
++	    fi
++    else
++        echo no
++        exit 1
++    fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title File table usage'
++	echo 'graph_args --base 1000 -l 0'
++	echo 'graph_vlabel number of open files'
++	echo 'graph_category system'
++	echo 'graph_info This graph monitors the Linux open files table.'
++	echo 'used.label open files'
++	echo 'used.info The number of currently open files.'
++	echo 'max.label max open files'
++	echo 'max.info The maximum supported number of open files.'
++	/sbin/sysctl -n kern.maxfiles | awk  '{printf "used.warning %d\nused.critical %d\n",$1*0.92,$1*0.98}'
++	exit 0
++fi
++
++#awk '{print "used.value " $1-$2 "\nmax.value " $3}' < /proc/sys/fs/file-nr
++echo -n 'max.value '
++/sbin/sysctl -n kern.maxfiles
++echo -n 'used.value '
++/sbin/sysctl -n kern.openfiles
+diff -urN node.d.midnightbsd.orig/processes.in node.d.midnightbsd/processes.in
+--- node/node.d.midnightbsd.orig/processes.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/processes.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,58 @@
++#!/bin/sh
++#
++# Plugin to monitor the number of processes on the machine. Much linke
++# doing a "ps | wc -l".
++#
++# Parameters:
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.2.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.3  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magick markers (optional - used by munin-config and som installation
++# scripts):
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++if [ "$1" = "autoconf" ]; then
++	echo yes 
++	exit 0
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title Number of Processes'
++	echo 'graph_args --base 1000 -l 0 '
++	echo 'graph_vlabel number of processes'
++	echo 'graph_category processes'
++	echo 'graph_info This graph shows the number of processes in the system.'
++	echo 'processes.label processes'
++	echo 'processes.info The current number of processes.'
++	echo 'processes.draw LINE2'
++	exit 0
++fi
++
++echo -n "processes.value "
++ps ax | wc -l
+diff -urN node.d.midnightbsd.orig/swap.in node.d.midnightbsd/swap.in
+--- node/node.d.midnightbsd.orig/swap.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/swap.in	Fri May  9 22:19:34 2008
+@@ -0,0 +1,90 @@
++#!/bin/sh
++#
++# Plugin to monitor swap IO in number of blocks per second.
++#
++# Parameters:
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.5.2.2  2005/01/28 16:24:22  lupe
++# Minor corrections
++#
++# Revision 1.5.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.5  2004/12/10 10:47:49  jimmyo
++# Change name from ${scale} to ${graph_period}, to be more consistent.
++#
++# Revision 1.4  2004/12/09 22:12:56  jimmyo
++# Added "graph_period" option, to make "graph_sums" usable.
++#
++# Revision 1.3  2004/11/21 00:16:56  jimmyo
++# Changed a lot of plugins so they use DERIVE instead of COUNTER.
++#
++# Revision 1.2  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# 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.4  2003/11/07 22:12:50  jimmyo
++# Changed deprecated plugin options
++#
++# Revision 1.3  2003/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magic markers (used by munin-config and some installation scripts (i.e.
++# optional)):
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++if [ "$1" = "autoconf" ]; then
++    if [ -x /sbin/sysctl ]; then
++        /sbin/sysctl vm.stats.vm.v_swappgsin > /dev/null
++    	if [ $? = "0" ]; then
++	    	echo yes
++    		exit 0
++    	else
++		    echo no
++		    exit 1
++	    fi
++    else
++        echo no
++        exit 1
++    fi
++fi
++
++if [ "$1" = "config" ]; then
++
++	echo 'graph_title Swap in/out'
++	echo 'graph_args -l 0 --base 1000'
++	echo 'graph_vlabel pages per ${graph_period} in (-) / out (+)'
++	echo 'graph_category system'
++	echo 'graph_info This graph shows the swap activity of the system.'
++	echo 'swap_in.label swap'
++	echo 'swap_in.type DERIVE'
++	echo 'swap_in.min 0'
++	echo 'swap_in.max 100000'
++	echo 'swap_in.graph no'
++	echo 'swap_out.label swap'
++	echo 'swap_out.type DERIVE'
++	echo 'swap_out.min 0'
++	echo 'swap_out.max 100000'
++	echo 'swap_out.negative swap_in'
++	exit 0
++fi
++
++#awk '/swap/ { print "swap_in.value " $2 "\nswap_out.value " $3 }' < /proc/stat 
++echo -n 'swap_in.value '
++/sbin/sysctl -n vm.stats.vm.v_swappgsin
++echo -n 'swap_out.value '
++/sbin/sysctl -n vm.stats.vm.v_swappgsout
+diff -urN node.d.midnightbsd.orig/vmstat.in node.d.midnightbsd/vmstat.in
+--- node/node.d.midnightbsd.orig/vmstat.in	Wed Dec 31 19:00:00 1969
++++ node/node.d.midnightbsd/vmstat.in	Fri May  9 22:19:35 2008
+@@ -0,0 +1,108 @@
++#!/bin/sh
++#
++# Plugin to monitor the number of procs in io-sleep and other wait
++# states. Uses `vmstat`.
++#
++# Parameters: 
++#
++# 	config   (required)
++# 	autoconf (optional - used by munin-config)
++#
++# $Log$
++# Revision 1.4.2.1  2005/01/28 14:51:22  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.5  2005/01/28 14:47:31  lupe
++# Add graph_info and some filed.info
++#
++# Revision 1.4  2004/11/28 09:43:54  lupe
++# 6-CURRENT support
++#
++# Revision 1.3  2004/05/20 19:02:36  jimmyo
++# Set categories on a bunch of plugins
++#
++# Revision 1.2  2004/02/01 18:59:54  lupe
++# FreeBSD 5 compatibility.
++#
++# 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/11/07 17:43:16  jimmyo
++# Cleanups and log entries
++#
++#
++#
++# Magick markers (optional):
++#%# family=auto
++#%# capabilities=autoconf
++
++
++
++OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.`
++
++if [ "$1" = "autoconf" ]; then
++	if [ "$OSV" -ge "5" ]; then
++		/sbin/sysctl -n vm.vmtotal 2>/dev/null >/dev/null
++		RESULT=$?
++		NAME=/sbin/sysctl
++	else
++		/usr/bin/vmstat 1 1 2>/dev/null >/dev/null
++		RESULT=$?
++		NAME=/usr/bin/vmstat
++	fi
++	if [ $RESULT -eq 0 ]; then
++		echo yes
++		exit 0
++	else
++		if [ $RESULT -eq 127 ]; then
++			echo "no (could not run \"$NAME\")"
++			exit 1
++		else
++			echo no
++			exit 1
++		fi
++	fi
++fi
++
++if [ "$1" = "config" ]; then
++	echo 'graph_title VMstat'
++	echo 'graph_args --base 1000 -l 0'
++	echo 'graph_vlabel process states'
++	echo 'graph_category processes'
++	echo 'graph_info This graph shows number of processes in each state.'
++	if [ "$OSV" -ge "5" ]; then
++		echo 'running.label running'
++		echo 'running.info processes on CPU or waiting for CPU'
++		echo 'running.type GAUGE'
++		echo 'diskwait.label diskwait'
++		echo 'diskwait.info processes waiting for disk activity'
++		echo 'diskwait.type GAUGE'
++		echo 'pagewait.label pagewait'
++		echo 'pagewait.info processes waiting for page-in'
++		echo 'pagewait.type GAUGE'
++		echo 'sleep.label sleep'
++		echo 'sleep.info processes waiting for some event'
++		echo 'sleep.type GAUGE'
++	else
++		echo 'wait.label wait'
++		echo 'wait.type GAUGE'
++		echo 'sleep.label sleep'
++		echo 'sleep.type GAUGE'
++	fi
++	exit 0
++fi
++
++if [ "$OSV" -ge "5" ]; then
++	/sbin/sysctl -n vm.vmtotal | awk '
++/^Processes:/ {
++	print "running.value", $3;
++	print "diskwait.value", $6;
++	print "pagewait.value", $9;
++	print "sleep.value", $11+0;
++}'
++else
++	vmstat 1 2| awk 'END { print "wait.value " $1 "\nsleep.value " $2 }' 
++fi
--- /dev/null
+++ sysutils/munin-node/files/plugins.conf
@@ -0,0 +1,55 @@
+#
+# This file contains configuration options for the plugins. Three
+# options are understood by munin-node itself:
+#
+#   user <user>         # Set the user to run the plugin as
+#   group <group>       # Set the group to run the plugin as
+#   command <command>   # Run <command> instead of the plugin. %c
+#                         expands to what would normally be run.
+#   env.<variable>      # Sets <variable> in the plugin's environment, see the
+#                         individual plugins to find out which variables they
+#                         care about.
+#
+# Note that many of the environment variables are just guesses
+# because the port maintainer did not bother to install all the
+# software that the Munin plugins can monitor. Please don't hesitate
+# to file a PR against the munin-node port if you find an error.
+
+# The logtail program used by many plugins is installed with the
+# port security/logcheck. The munin-node port has no dependency on
+# that port because most plugins do not require it.
+
+[amavis]
+env.amavislog /var/log/maillog
+env.logtail /usr/local/bin/logtail
+
+[courier_*]
+env.logfile /var/log/maillog
+env.logtail /usr/local/bin/logtail
+
+[dhcp3]
+env.configfile /usr/local/etc/dhcpd.conf
+env.leasefile /var/db/dhcpd.leases
+
+[exim*]
+group mail
+env.exim /usr/local/sbin/exim
+
+[hddtemp_smartctl]
+group operator
+env.smartctl /usr/local/sbin/smartctl
+
+[mbmon*]
+env.mbmon /usr/local/bin/mbmon
+
+[mysql*]
+env.mysqladmin /usr/local/bin/mysqladmin
+env.mysqlshow /usr/local/bin/mysqlshow
+
+[postfix*]
+user root
+env.logfile /var/log/maillog
+
+[sendmail*]
+env.mspqueue /var/spool/clientmqueue
+env.mailstats /usr/sbin/mailstats
--- /dev/null
+++ sysutils/munin-node/files/patch-hddtemp_smartctl.in
@@ -0,0 +1,13 @@
+--- node/node.d/hddtemp_smartctl.in.orig	2006-10-17 14:27:35.000000000 +0200
++++ node/node.d/hddtemp_smartctl.in	2007-10-04 09:29:43.931425624 +0200
+@@ -109,6 +109,10 @@
+     @drives = grep /hd[a-z]/, readdir IDE;
+     closedir(IDE);
+   }
++} elsif ($^O eq 'freebsd') {
++  opendir(DEV, '/dev');
++  @drives = grep /^ad[0-9]+$/, readdir DEV;
++  closedir(DEV);
+ } elsif ($^O eq 'solaris') {
+   @drives = map { s at .*/@@ ; $_ } glob '/dev/rdsk/c*t*d*s2';
+ }
--- /dev/null
+++ sysutils/munin-node/files/pkg-message.in
@@ -0,0 +1,21 @@
+
+********************************************************************
+Unless this file already existed, a sample configuration file
+has been placed in %%PREFIX%%/etc/munin/munin-node.conf.
+
+Please edit it according to your needs.
+
+********************************************************************
+
+The Munin client will *not* be started automatically. To allow it
+to start, put this line in /etc/rc.conf:
+
+munin_node_enable="YES"
+
+Then, it will be started on the next boot. If this line is already
+present, the client will be started now.  Otherwise, edit
+/etc/rc.conf and execute this command:
+
+    %%PREFIX%%/etc/rc.d/munin-node.sh start
+********************************************************************
+
--- /dev/null
+++ sysutils/munin-node/files/munin-node-revive.sh.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#
+# Add the following lines to /etc/rc.conf to enable munin-node:
+# munin_node_enable (bool):      Set to "NO" by default.
+#                                Set it to "YES" to enable munin-node
+# munin_node_config (path):      Set to "%%PREFIX%%/etc/munin/munin-node.conf" by default.
+#
+
+. %%RC_SUBR%%
+
+name="munin_node"
+rcvar=`set_rcvar`
+
+[ -z "$munin_node_enable" ] && munin_node_enable="NO"
+[ -z "$munin_node_config" ] && munin_node_config="%%PREFIX%%/etc/munin/munin-node.conf"
+
+command="%%PREFIX%%/sbin/munin-node"
+pidfile=`awk '$1 == "pid_file" { print $2 }' $munin_node_config`
+
+load_rc_config $name
+
+#set -x
+pid=`check_pidfile $pidfile %%PREFIX%%/sbin/munin-node`
+if [ -z "$pid" ]; then
+  run_rc_command start > /dev/null
+fi
--- /dev/null
+++ sysutils/munin-node/files/patch-munin-node.conf.in
@@ -0,0 +1,11 @@
+--- node/munin-node.conf.in.orig	Thu Jan 15 15:28:57 2004
++++ node/munin-node.conf.in	Sun Jan 25 14:26:15 2004
+@@ -12,7 +12,7 @@
+ # Which port to bind to;
+ host *
+ user root
+-group root
++group wheel
+ setsid yes
+ 
+ # Regexps for files to ignore
--- /dev/null
+++ sysutils/munin-node/files/patch-Makefile.config
@@ -0,0 +1,85 @@
+--- Makefile.config.orig	2005-01-10 11:38:32.000000000 +0100
++++ Makefile.config	2005-02-03 11:55:51.000000000 +0100
+@@ -7,52 +7,56 @@
+ #
+ # the base of the Munin installation.
+ # 
+-PREFIX     = $(DESTDIR)/opt/munin
++ifdef PREFIX
++UPREFIX=$(PREFIX)
++else
++UPREFIX=/usr
++endif
+ 
+ # Where Munin keeps its configurations (server.conf, client.conf, ++)
+-CONFDIR    = $(DESTDIR)/etc/opt/munin
++CONFDIR    = $(PREFIX)/etc/munin
+ 
+ # Server only - where to put munin-cron
+-BINDIR     = $(PREFIX)/bin
++BINDIR     = $(UPREFIX)/bin
+ 
+ # Client only - where to put munin-node, munin-node-configure, and munin-run
+-SBINDIR    = $(PREFIX)/sbin
++SBINDIR    = $(UPREFIX)/sbin
+ 
+ # Where to put text and html documentation
+-DOCDIR     = $(PREFIX)/doc
++DOCDIR     = $(UPREFIX)/doc
+ 
+ # Where to put man pages
+-MANDIR     = $(PREFIX)/man
++MANDIR     = $(UPREFIX)/man
+ 
+ # Where to put internal binaries and plugin repository
+-LIBDIR     = $(PREFIX)/lib
++LIBDIR     = $(DATADIR)
+ 
+ # Server only - Output directory
+-HTMLDIR    = $(PREFIX)/var/www
+-CGIDIR     = $(HTMLDIR)/cgi
++HTMLDIR    = $(PREFIX)/www/munin
++CGIDIR     = $(PREFIX)/www/cgi-bin
+ 
+ # Client only - Where to put RRD files and other intenal data
+-DBDIR      = $(DESTDIR)/var/opt/munin
++DBDIR      = $(PREFIX)/var/munin
+ 
+ # Client only - Where plugins should put their states. Must be writable by
+ # group "munin", and should be preserved between reboots
+ PLUGSTATE  = $(DBDIR)/plugin-state
+ 
+ # Where Munin should place its logs.
+-LOGDIR     = $(DESTDIR)/var/log/munin
++LOGDIR     = /var/log
+ 
+ # Location of PID files and other statefiles. On the server, must be
+ # writable by the user "munin".
+-STATEDIR   = $(DESTDIR)/var/run/munin
++STATEDIR   = /var/run/munin
+ 
+ # The perl interpreter to use
+-PERL       = $(shell which perl)
++# Passed in from FreeBSD port Makefile.
+ 
+ # The python interpreter to use (used by some plugins)
+ PYTHON     = /usr/bin/env python
+ 
+ # Server only - Where to install the perl libraries
+-PERLLIB    = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d= -f2 | sed "s/[\';]//g")
++PERLLIB    = $(PREFIX)/$(SITE_PERL_REL)
+ 
+ # Client only - Install plugins for this architecture
+ OSTYPE     = $(shell uname | tr '[A-Z]' '[a-z]')
+@@ -72,9 +76,8 @@
+ PLUGINUSER = nobody
+ 
+ # Which command to use to check if the USER and GROUP to run Munin as, exists.
+-GETENT = $(shell which getent || which true 2>/dev/null)
+-CHECKUSER  = $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
+-CHECKGROUP = $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
++CHECKUSER:= $(shell /usr/sbin/pw user show $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
++CHECKGROUP:= $(shell /usr/sbin/pw group show $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
+ 
+ CHOWN      = chown
+ CHMOD      = chmod


More information about the Midnightbsd-cvs mailing list