aboutsummaryrefslogtreecommitdiff
path: root/net/analyzer
diff options
context:
space:
mode:
authorrudson <rudson@370017ae-e619-0410-ac65-c121f96126d4>2006-11-15 23:33:50 +0000
committerrudson <rudson@370017ae-e619-0410-ac65-c121f96126d4>2006-11-15 23:33:50 +0000
commit4c047569a7fb213df74643e7e92d8b82be8f25c8 (patch)
tree86d2886ceea65b7c5f3740172c9b77e4b4ad9bcf /net/analyzer
parent36dfae9b5a58be5a5ad46c4741c0565eebc352d5 (diff)
downloadslackbuilds-4c047569a7fb213df74643e7e92d8b82be8f25c8.tar.gz
slackbuilds-4c047569a7fb213df74643e7e92d8b82be8f25c8.tar.bz2
movendo...
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@684 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'net/analyzer')
-rwxr-xr-xnet/analyzer/munin/munin.SlackBuild30
-rwxr-xr-xnet/analyzer/munin/munin.build145
-rw-r--r--net/analyzer/munin/munin.conf.sample71
-rw-r--r--net/analyzer/munin/plugins/hddtemp-simple31
-rw-r--r--net/analyzer/munin/plugins/icecast59
-rw-r--r--net/analyzer/munin/plugins/vserver_rmemory134
-rw-r--r--net/analyzer/munin/plugins/vserver_vmemory135
-rwxr-xr-xnet/analyzer/munin/rc.munin-node30
8 files changed, 635 insertions, 0 deletions
diff --git a/net/analyzer/munin/munin.SlackBuild b/net/analyzer/munin/munin.SlackBuild
new file mode 100755
index 00000000..4b3d6686
--- /dev/null
+++ b/net/analyzer/munin/munin.SlackBuild
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# SlackBuild script to call munin.build with correct settings
+#
+
+CWD="`pwd`"
+
+if [ -f ~/.slackbuildrc ]; then
+ source ~/.slackbuildrc
+elif [ -f /etc/slackbuildrc ]; then
+ source /etc/slackbuildrc
+fi
+
+# default settings
+PACKAGE="munin"
+VERSION=${VERSION:=1.2.4}
+ARCH="noarch"
+BUILD=${BUILD:=3rha}
+SRC_DIR=${SRC:=$CWD}
+TMP=${TMP:=/tmp}
+REPOS=${REPOS:=$TMP}
+
+rm -rf $TMP/$PACKAGE
+mkdir -p $SRC_DIR/$PACKAGE $TMP/$PACKAGE
+
+slacktrack -b $REPOS -x $TMP,$SRC_DIR,/dev,/tmp -jefkzp "$PACKAGE-$VERSION-$ARCH-$BUILD.tgz" "./$PACKAGE.build"
+
+if [ "$CLEANUP" == "yes" ]; then
+ rm -rf $TMP/$PACKAGE
+fi
diff --git a/net/analyzer/munin/munin.build b/net/analyzer/munin/munin.build
new file mode 100755
index 00000000..2dd27f7e
--- /dev/null
+++ b/net/analyzer/munin/munin.build
@@ -0,0 +1,145 @@
+#!/bin/bash
+#
+# build script for munin
+# by rhatto at riseup.net by rhatto | gpl
+# build it with slacktrack, example:
+#
+# ARCH=x86_64 slacktrack -jefkzp "munin-1.2.4-x86_64-2rha.tgz" "./munin.build"
+#
+
+#
+# TODO: criacao de configuracoes padroes no /etc/munin
+# pegar mais plugins de vserver em http://svn.debian.org/wsvn/pkg-vserver/people/holger/munin-plugins/plugins/?rev=0&sc=0
+#
+
+CWD="`pwd`"
+
+if [ -f "/etc/slackbuildrc" ]; then
+ source /etc/slackbuildrc
+fi
+
+if [ -f "~/.slackbuildrc" ]; then
+ source ~/.slackbuildrc
+fi
+
+# default settings
+PACKAGE="munin"
+TMP=${TMP:=/tmp}
+VERSION=${VERSION:=1.2.4}
+ARCH=${ARCH:=i386}
+BUILD=${BUILD:=3rha}
+SRC_DIR=${SRC:=$CWD}
+
+if ! grep -qe "^$PACKAGE:" /etc/passwd || ! grep -qe "^$PACKAGE:" /etc/group; then
+ echo "WARNING: user and/or group $PACKAGE does not exist"
+ echo "Create it manually with \"groupadd $PACKAGE ; useradd $PACKAGE -g $PACKAGE\" and run this script again."
+ exit 1
+fi
+
+cat << EOCAT
+Attention: be sure that theres no munin installed on this system, otherwiser installation
+procedure will fail to copy plugins to their right place. Please uninstall any munin packages
+before continue.
+
+Hit enter to proceed.
+EOCAT
+
+read garbage
+
+if [ "$ARCH" == "x86_64" ]; then
+ LIBDIR=/usr/lib64
+else
+ LIBDIR=/usr/lib
+fi
+
+RTOOL="wget"
+PACKAGE_EXT="gz"
+SRC="$PACKAGE"_"$VERSION.tar.$PACKAGE_EXT"
+URL="http://easynews.dl.sourceforge.net/sourceforge/$PACKAGE/$SRC"
+
+SRC_DIR="$SRC_DIR/$PACKAGE"
+
+if [ ! -d "$SRC_DIR" ]; then
+ mkdir -p $SRC_DIR
+fi
+
+if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
+ rm -f $SRC_DIR/$SRC
+ wget "$URL" -O "$SRC_DIR/$SRC"
+fi
+
+if [ "$PACKAGE_EXT" == "bz2" ]; then
+ tarflag="j"
+else
+ tarflag="z"
+fi
+
+TMP="$TMP/$PACKAGE"
+
+if [ ! -d "$TMP" ]; then
+ mkdir -p $TMP
+fi
+
+cd $TMP
+
+tar xvf$tarflag $SRC_DIR/$SRC
+cd $PACKAGE-$VERSION
+
+# config and install!
+
+mkdir -p /install
+
+sed -e 's/PREFIX = $(DESTDIR)\/opt\/munin/PREFIX = $(DESTDIR)\/usr/' \
+ -e 's/CONFDIR = $(DESTDIR)\/etc\/opt\/munin/CONFDIR = $(DESTDIR)\/etc\/munin/' \
+ -e 's/DBDIR = $(DESTDIR)\/var\/opt\/munin/DBDIR = $(DESTDIR)\/var\/munin/' \
+ -e 's/LIBDIR = $(PREFIX)\/lib/LIBDIR = $(PREFIX)\/lib\/munin/' \
+ -e 's/HTMLDIR = $(PREFIX)\/var\/www/HTMLDIR = \/var\/www/' \
+ -e 's/CGIDIR = $(HTMLDIR)\/cgi/CGIDIR = $(HTMLDIR)\/cgi-bin/' Makefile.config > Makefile.config.new
+
+mv Makefile.config.new Makefile.config
+
+make install-main
+make install-doc install-man
+make install-node install-node-plugins
+
+# make the package
+
+cp $CWD/plugins/* /usr/lib/munin/plugins/
+chmod 755 /usr/lib/munin/plugins/*
+
+mkdir -p /etc/munin/plugin{s,-conf.d}
+mv /etc/munin/munin.conf /etc/munin/munin.conf.sample
+mv /etc/munin-node.conf /etc/munin-node.conf.sample
+
+mkdir -p /etc/rc.d
+cp $CWD/rc.munin-node /etc/rc.d/rc.munin-node.new
+
+cat << EOF > /install/slack-desc
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler-----------------------------------------------------|
+munin: munin (system to gather and graph all sorts of information)
+munin:
+munin: Munin the tool surveys all your computers and remembers what it saw.
+munin: It presents all the information in in graphs through a web interface.
+munin: Its emphasis is on plug and play capabilities. After completing a
+munin: installation a high number of monitoring plugins will be playing with
+munin: no more effort. Using Munin you can easily monitor the performance of
+munin: your computers, networks, SANs, and quite possibly applications as
+munin: well. It makes it easy to determine "what's different today" when
+munin: a performance problem crops up. It makes it easy to see how you're
+munin: doing capacity wise on all limited resources.
+EOF
+
+echo '( chroot . /sbin/ldconfig )' > /install/doinst.sh
+echo '( if ! grep -qe "^munin:" etc/group; then echo creating group munin ; chroot . /usr/sbin/groupadd munin; fi )' >> /install/doinst.sh
+echo '( if ! grep -qe "^munin:" etc/passwd; then echo creating user munin ; chroot . /usr/sbin/useradd munin -g munin; fi )' >> /install/doinst.sh
+echo '( if [ ! -f "etc/rc.d/rc.munin-node" ]; then mv etc/rc.d/rc.munin-node.new etc/rc.d/rc.munin-node; fi )' >> /install/doinst.sh
+echo '( mkdir -p var/log/munin var/run/munin var/munin )' >> /install/doinst.sh
+echo '( chroot . /usr/bin/chown munin.munin /var/log/munin /var/run/munin /var/munin )' >> /install/doinst.sh
+
diff --git a/net/analyzer/munin/munin.conf.sample b/net/analyzer/munin/munin.conf.sample
new file mode 100644
index 00000000..743a003a
--- /dev/null
+++ b/net/analyzer/munin/munin.conf.sample
@@ -0,0 +1,71 @@
+# Example configuration file for Munin, generated by 'make build'
+
+# The next three variables specifies where the location of the RRD
+# databases, the HTML output, and the logs, severally. They all
+# must be writable by the user running munin-cron.
+dbdir /var/munin
+htmldir /var/www
+logdir /var/log/munin
+rundir /var/run/munin
+
+# Where to look for the HTML templates
+tmpldir /etc/munin/templates
+
+# Make graphs show values per minute instead of per second
+#graph_period minute
+
+# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime
+# something changes (OK -> WARNING, CRITICAL -> OK, etc)
+#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
+#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm
+#
+# For those with Nagios, the following might come in handy. In addition,
+# the services must be defined in the Nagios server as well.
+#contact.nagios.command /usr/sbin/send_nsca -H nagios.host.com -c /etc/send_nsca.cfg
+
+# a simple host tree
+[localhost]
+ address 127.0.0.1
+ use_node_name yes
+
+#
+# A more complex example of a host tree
+#
+## First our "normal" host.
+# [fii.foo.com]
+# address foo
+#
+## Then our other host...
+# [fay.foo.com]
+# address fay
+#
+## Then we want totals...
+# [foo.com;Totals] #Force it into the "foo.com"-domain...
+# update no # Turn off data-fetching for this "host".
+#
+# # The graph "load1". We want to see the loads of both machines...
+# # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
+# load1.graph_title Loads side by side
+# load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+#
+# # The graph "load2". Now we want them stacked on top of each other.
+# load2.graph_title Loads on top of each other
+# load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
+# load2.dummy_field.draw AREA # We want area instead the default LINE2.
+# load2.dummy_field.label dummy # This is needed. Silly, really.
+#
+# # The graph "load3". Now we want them summarised into one field
+# load3.graph_title Loads summarised
+# load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
+# load3.combined_loads.label Combined loads # Must be set, as this is
+# # not a dummy field!
+#
+## ...and on a side note, I want them listen in another order (default is
+## alphabetically)
+#
+# # Since [foo.com] would be interpreted as a host in the domain "com", we
+# # specify that this is a domain by adding a semicolon.
+# [foo.com;]
+# node_order Totals fii.foo.com fay.foo.com
+#
+
diff --git a/net/analyzer/munin/plugins/hddtemp-simple b/net/analyzer/munin/plugins/hddtemp-simple
new file mode 100644
index 00000000..bc13e013
--- /dev/null
+++ b/net/analyzer/munin/plugins/hddtemp-simple
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# hddtemp munin plugin
+# feedback: rhatto at riseup.net | gpl
+#
+# configuration example:
+#
+# [hddtemp]
+# user root
+# env.devices hda hdb
+# env.hddtemp /path/to/hddtemp
+#
+
+if [ "$1" == "config" ]; then
+ cat << EOF
+graph_title HDD Temperatures
+graph_vlabel Celsius
+graph_category sensors
+EOF
+ for dev in $devices; do
+ echo $dev.label $dev
+ done
+ exit 0
+else
+ if [ -z "$hddtemp" ]; then
+ hddtemp="/usr/sbin/hddtemp"
+ fi
+ for device in $devices; do
+ echo $device.value `$hddtemp -n /dev/$device`
+ done
+fi
diff --git a/net/analyzer/munin/plugins/icecast b/net/analyzer/munin/plugins/icecast
new file mode 100644
index 00000000..b5fea517
--- /dev/null
+++ b/net/analyzer/munin/plugins/icecast
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# icecast munin plugin
+# feedback: rhatto at riseup.net | gpl
+#
+# configuration example:
+#
+# [icecast]
+# env.host localhost
+# evn.port 8000
+# env.stats /munin.xsl
+# env.lynx /usr/bin/lynx
+#
+# munin.xsl example:
+#
+# <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
+# <xsl:output omit-xml-declaration="no" method="xml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+# doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="yes" encoding="UTF-8" />
+# <xsl:template match = "/icestats" >
+# <xsl:for-each select="source">
+# <xsl:value-of select="@mount" />.value, <xsl:value-of select="listeners" /><br />
+# </xsl:for-each>
+# </xsl:template>
+# </xsl:stylesheet>
+#
+
+if [ -z "$host" ]; then
+ host="localhost"
+fi
+
+if [ -z "$port" ]; then
+ port="8000"
+fi
+
+if [ -z "$stats" ]; then
+ stats="munin.xsl"
+fi
+
+if [ -z "$lynx" ]; then
+ lynx="/usr/bin/lynx"
+fi
+
+if [ "$1" == "config" ]; then
+ cat << EOF
+graph_title Icecast usage
+graph_vlabel Listeners
+graph_category other
+EOF
+
+for mount in `$lynx http://$host:$port/$stats -dump | cut -d , -f 1 | sed -e 's/\///g' -e 's/^ //' -e 's/.value//' -e 's/\./_/g' `; do
+ echo $mount.label $mount
+done
+
+exit 0
+else
+
+ $lynx http://$host:$port/$stats -dump | sed -e 's/,//g' -e 's/\///g' -e 's/^ //' -e 's/\.ogg/_ogg/'
+
+fi
diff --git a/net/analyzer/munin/plugins/vserver_rmemory b/net/analyzer/munin/plugins/vserver_rmemory
new file mode 100644
index 00000000..a71d50c9
--- /dev/null
+++ b/net/analyzer/munin/plugins/vserver_rmemory
@@ -0,0 +1,134 @@
+#!/bin/sh
+#
+# Copyright (C) 2006 Holger Levsen
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 dated June,
+# 1991.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Configuration variables
+# vservers - specify the vservers to include in the graph (default: all)
+# limits - if true, turn on limit graphing (default: false)
+#
+# NOTE: If no configuration variables are set, the defaults will be used
+
+# Example /etc/munin/plugin-conf.d/munin-node
+#
+# The first group monitors the vservers named "vserver1 vserver2
+# vserver3 vserver4" and looks to see if the resource limit has been
+# breached, if so it sends a message to nagios via send_nsca, and
+# sends an email to notify that this has happened.
+#
+# The second monitors the vservers "vserver5 vserver6 vserver7" and
+# has no limit notifications turned on.
+#
+# The third monitors all vservers on the system, in one graph, and it has
+# no limit notifications defined.
+#
+# You can use any combination of these to fit your needs.
+#
+#
+# [vsrmem_group1]
+# user root
+# env.vservers vserver1 vserver2 vserver3 vserver4
+# env.limits 1
+# contacts nagios email
+# contact.nagios.command /usr/bin/send_nsca -H your.nagios-host.here -c /etc/send_nsca.cfg
+# contact.email.command mail -s "Munin-notification for ${var:group} :: ${var:host}" your@email.address.here
+#
+# [vsrmem_group2]
+# user root
+# env.vservers vserver5 vserver6 vserver7
+# env.limits 0
+#
+# [vserver_rmemory]
+# user root
+#
+# Graph Vserver RSS usage and limits
+#
+# Changelog
+# version 0.1 - 2006 April xx - Holger Levsen
+# - initial author
+# version 0.2 - 2006 April 24 - Micah Anderson <micah@riseup.net>
+# - Add dynamic arch page size determination
+# - Some cleanup and clarification
+# version 0.3 - 2006 May 3 - Micah Anderson <micah@riseup.net>
+# - Add ability to group vservers via environment vars
+# - Fix missing close quotes and standardize indents
+# - Add limit notification
+# - Update documentation to include info on groups and limits
+
+VSERVERS="$vservers"
+LIMITS="$limits"
+
+if [ "$1" = "config" ]; then
+ echo 'graph_title Real memory used by vservers'
+ echo 'graph_args --base 1024k -l 0'
+ echo 'graph_vlabel Size of RSS pages'
+ echo 'graph_category vserver'
+ echo 'graph_info Shows page size used in RAM by each vserver.'
+
+ # do not assume we are on i386 where pagesize is 4096...
+ pagesize=`perl -MPOSIX -e 'print POSIX::sysconf(_SC_PAGESIZE), "\n";'`
+
+ if [ -z "$VSERVERS" ]; then
+ for i in `find /proc/virtual/* -type d -exec basename {} \;` ; do
+ NAME=`cat /proc/virtual/$i/cvirt |grep NodeName |cut -f2`
+ echo "$NAME.label $NAME"
+ echo "$NAME.info Size of pages in RAM used by $NAME. (Number multiplied by $pagesize to make human)"
+ echo "$NAME.cdef $NAME,$pagesize,*"
+ if [ ! -z "$LIMITS" -a "$LIMITS" = 1 ]; then
+ cat /proc/virtual/$i/limit | awk -v name="$NAME" \
+ '{ if ( $1 == "RSS:" )
+ {
+ if ( $2 >= $3 )
+ {
+ printf "%s.critical %d\n", name, $2
+ }
+ }
+ }'
+ fi
+ done
+ else
+ for vserver in $vservers ; do
+ echo "$vserver.label $vserver"
+ echo "$vserver.info Size of pages in RAM used by $vserver. (Number multiplied by $pagesize to make human)"
+ echo "$vserver.cdef $vserver,$pagesize,*"
+ if [ ! -z "$LIMITS" -a "$LIMITS" = 1 ]; then
+ XID=`/usr/sbin/vserver-info $vserver CONTEXT`
+ LIMIT=`cat /proc/virtual/$XID/limit | grep RSS: | cut -f4`
+ if [ ${LIMIT:-0} -gt 0 ]; then
+ echo "$NAME.critical $LIMIT"
+ fi
+ fi
+ done
+ fi
+ exit 0
+fi
+
+if [ -z "$VSERVERS" ]; then
+ for i in `find /proc/virtual/* -type d -exec basename {} \;` ; do
+ NAME=`cat /proc/virtual/$i/cvirt | grep NodeName | cut -f2`
+ cat /proc/virtual/$i/limit | awk -v name="$NAME" \
+ '{ if ( $1 == "RSS:" )
+ printf "%s.value %d\n", name, $2 }'
+ done
+else
+ for vserver in $VSERVERS ; do
+ XID=`/usr/sbin/vserver-info $vserver CONTEXT`
+ cat /proc/virtual/$XID/limit | awk -v name="$vserver" \
+ '{ if ( $1 == "RSS:" )
+ printf "%s.value %d\n", name, $2 }'
+ done
+fi
+
diff --git a/net/analyzer/munin/plugins/vserver_vmemory b/net/analyzer/munin/plugins/vserver_vmemory
new file mode 100644
index 00000000..008fb395
--- /dev/null
+++ b/net/analyzer/munin/plugins/vserver_vmemory
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+# Copyright (C) 2006 Holger Levsen
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2 dated June,
+# 1991.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Configuration variables
+# vservers - specify the vservers to include in the graph (default: all)
+# limits - if true, turn on limit graphing (default: false)
+#
+# NOTE: If no configuration variables are set, the defaults will be used
+
+# Example /etc/munin/plugin-conf.d/munin-node
+#
+# The first group monitors the vservers named "vserver1 vserver2
+# vserver3 vserver4" and looks to see if the resource limit has been
+# breached, if so it sends a message to nagios via send_nsca, and
+# sends an email to notify that this has happened.
+#
+# The second monitors the vservers "vserver5 vserver6 vserver7" and
+# has no limit notifications turned on.
+#
+# The third monitors all vservers on the system, in one graph, and it has
+# no limit notifications defined.
+#
+# You can use any combination of these to fit your needs.
+#
+#
+# [vsrmem_group1]
+# user root
+# env.vservers vserver1 vserver2 vserver3 vserver4
+# env.limits 1
+# contacts nagios email
+# contact.nagios.command /usr/bin/send_nsca -H your.nagios-host.here -c /etc/send_nsca.cfg
+# contact.email.command mail -s "Munin-notification for ${var:group} :: ${var:host}" your@email.address.here
+#
+# [vsrmem_group2]
+# user root
+# env.vservers vserver5 vserver6 vserver7
+# env.limits 0
+#
+# [vserver_rmemory]
+# user root
+#
+# Graph Vserver RSS usage and limits
+#
+# Changelog
+# version 0.1 - 2006 April xx - Holger Levsen
+# - initial author
+# version 0.2 - 2006 April 24 - Micah Anderson <micah@riseup.net>
+# - Add dynamic arch page size determination
+# - Some cleanup and clarification
+# version 0.3 - 2006 May 3 - Micah Anderson <micah@riseup.net>
+# - Add ability to group vservers via environment vars
+# - Fix missing close quotes and standardize indents
+# - Add limit notification
+# - Update documentation to include info on groups and limits
+
+
+VSERVERS="$vservers"
+LIMITS="$limits"
+
+if [ "$1" = "config" ]; then
+ echo 'graph_title Virtual memory used by vservers'
+ echo 'graph_title Vserver virtual memory'
+ echo 'graph_args --base 1024k -l 0'
+ echo 'graph_vlabel Size of VM pages'
+ echo 'graph_category vserver'
+ echo 'graph_info Shows virtual page size used by each vserver.'
+
+ # do not assume we are on i386 where pagesize is 4096...
+ pagesize=`perl -MPOSIX -e 'print POSIX::sysconf(_SC_PAGESIZE), "\n";'`
+
+ if [ -z "$VSERVERS" ]; then
+ for i in `find /proc/virtual/* -type d -exec basename {} \;` ; do
+ NAME=`cat /proc/virtual/$i/cvirt |grep NodeName |cut -f2`
+ echo "$NAME.label $NAME"
+ echo "$NAME.info Size of virtual pages used by $NAME. (Number multipled by $pagesize to make human)"
+ echo "$NAME.cdef $NAME,$pagesize,*"
+ if [ ! -z "$LIMITS" -a "$LIMITS" = 1 ]; then
+ cat /proc/virtual/$i/limit | awk -v name="$NAME" \
+ '{ if ( $1 == "VM:" )
+ {
+ if ( $2 >= $3 )
+ {
+ printf "%s.critical %d\n", name, $2
+ }
+ }
+ }'
+ fi
+ done
+ else
+ for vserver in $vservers ; do
+ echo "$vserver.label $vserver"
+ echo "$vserver.info Size of virtual pages by $vserver. (Number multiplied by $pagesize to make human)"
+ echo "$vserver.cdef $vserver,$pagesize,*"
+ if [ ! -z "$LIMITS" -a "$LIMITS" = 1 ]; then
+ XID=`/usr/sbin/vserver-info $vserver CONTEXT`
+ LIMIT=`cat /proc/virtual/$XID/limit | grep RSS: | cut -f4`
+ if [ ${LIMIT:-0} -gt 0 ]; then
+ echo "$NAME.critical $LIMIT"
+ fi
+ fi
+ done
+ fi
+ exit 0
+fi
+
+if [ -z "$VSERVERS" ]; then
+ for i in `find /proc/virtual/* -type d -exec basename {} \;` ; do
+ NAME=`cat /proc/virtual/$i/cvirt | grep NodeName | cut -f2`
+ cat /proc/virtual/$i/limit | awk -v name="$NAME" \
+ '{ if ( $1 == "VM:" )
+ printf "%s.value %d\n", name, $2 }'
+ done
+else
+ for vserver in $VSERVERS ; do
+ XID=`/usr/sbin/vserver-info $vserver CONTEXT`
+ cat /proc/virtual/$XID/limit | awk -v name="$vserver" \
+ '{ if ( $1 == "VM:" )
+ printf "%s.value %d\n", name, $2 }'
+ done
+fi
diff --git a/net/analyzer/munin/rc.munin-node b/net/analyzer/munin/rc.munin-node
new file mode 100755
index 00000000..f7cec18d
--- /dev/null
+++ b/net/analyzer/munin/rc.munin-node
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# startup script for munin-node
+#
+
+PID_FILE="/var/run/munin/munin-node.pid"
+
+if [ -a "/var/run/munin/munin-node.pid" ]; then
+ NODE_PID="`cat $PID_FILE`"
+fi
+
+function munin_start {
+ /usr/sbin/munin-node
+}
+
+function munin_stop {
+ if [ "$NODE_PID" == "`pidof munin-node`" ]; then
+ kill $NODE_PID
+ fi
+}
+
+if [ "$1" == "start" ]; then
+ munin_start
+elif [ "$1" == "stop" ]; then
+ munin_stop
+elif [ "$1" == "restart" ]; then
+ munin_stop
+ munin_start
+fi
+