1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

More housekeeping.

This commit is contained in:
Diego Elio Pettenò 2012-08-06 22:20:20 -07:00
parent 038c3ce96b
commit e5ce74926d
43 changed files with 0 additions and 0 deletions

View file

@ -1,77 +0,0 @@
#!/bin/bash
#
# Created by Jan Rękorajski <baggins@pld-linux.org> based on vserver_cpu_ plugin.
#
# Graph Vserver cumulative cpu usage stats
#
# Configuration variables
# vservers - specify the vservers to include in the graph (default: all)
#
# NOTE: If no configuration variable is set, the default will be used
#
# see vserver_resources for example uses of configuration files
VSERVERS="$vservers"
INFO=(`sed 's/.*:\t//' /proc/virtual/info 2>/dev/null || echo '<none>'`)
KCIN="$[ 16#${INFO[2]} ]";
# If this is 1, then VCI_SPACES is present in the kernel (new in 2.6.19)
if [ $[ (KCIN >> 10) & 1 ] -eq 1 ]
then
NAMELOC="nsproxy"
else
NAMELOC="cvirt"
fi
if [ -z "$VSERVERS" ] ; then
XIDS=`find /proc/virtual/* -type d -exec basename {} \;`
else
# it's really more performant to specify vservers by ids or by linking but not in the configuration-file by name
XIDS=""
for i in $VSERVERS ; do
if [ -d /proc/virtual/$i ] ; then
XIDS="${XIDS}${i} "
else
for j in `find /proc/virtual/* -type d -exec basename {} \;` ; do
if [ "$i" = "`cat /proc/virtual/$j/$NAMELOC |grep NodeName |cut -f2`" ] ; then
XIDS="${XIDS}${j} "
fi
done
fi
done
fi
if [ "$1" = "config" ]; then
echo 'graph_category vserver'
echo 'graph_args --base 1000'
echo 'graph_title Vserver cpu usage'
echo 'graph_vlabel jiffies used per ${graph_period}'
echo 'graph_info Shows jiffies used on each vserver.'
for i in $XIDS ; do
LABEL=`grep NodeName /proc/virtual/$i/$NAMELOC | cut -f2`
NAME=`echo $LABEL | tr '-' '_'`
echo "${NAME}_hold.label on hold for cpu on $LABEL"
echo "${NAME}_hold.info on hold for cpu on $LABEL."
echo "${NAME}_hold.type COUNTER"
echo "${NAME}_scpu.label system cpu usage for $LABEL"
echo "${NAME}_scpu.info system cpu usage for $LABEL."
echo "${NAME}_scpu.type COUNTER"
echo "${NAME}_ucpu.label user cpu usage for $LABEL"
echo "${NAME}_ucpu.info user cpu usage for $LABEL."
echo "${NAME}_ucpu.type COUNTER"
done
exit 0
fi
for i in $XIDS ; do
NAME=`grep NodeName /proc/virtual/$i/$NAMELOC | cut -f2 | tr '-' '_'`
awk -v name=$NAME -v u=0 -v s=0 -v h=0 '
/^cpu [0-9]+:/ { u+=$3; s+=$4; h+=$5}
END {
print name "_hold.value " h
print name "_scpu.value " s
print name "_ucpu.value " u
}' /proc/virtual/$i/sched
done

View file

@ -1,120 +0,0 @@
#!/bin/sh
#
# Copyright (C) 2008 Chris Wilson
# 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
# version 0.4 - 2006 Jun 22 - Micah Anderson <micah@riseup.net>
# - Fix error that results if NodeName is set to include a domain name
# version 0.5 - 2008 Apr 12 - Chris Wilson <chris+munin@qwirx.com>
# - Changed to display limit hits instead of resource usage
# - Adapt to latest vserver kernel (lack of some variables in /proc/virtual)
# Note that your vserver names may change if the contents of
# /etc/vservers/* do not match the nodenames. Also you must specify
# the vservers variable with context IDs (XIDs) rather than names.
scriptname=`basename $0`
resource=`echo $scriptname | sed -e 's/.*_//'`
vservers="$vservers"
if [ -z "$vservers" ]; then
vservers=`ls -1 /proc/virtual | grep -v info | grep -v status`
fi
if [ "$1" = "config" ]; then
echo "graph_title Vserver $resource limit hits"
# echo 'graph_args --base 1024k -l 0'
echo "graph_vlabel $resource limit hits"
echo 'graph_category vserver'
echo "graph_info Shows number of hits on $resource limits by each vserver.'"
for vserver_xid in $vservers ; do
longname=`/usr/sbin/vuname --xid $vserver_xid NODENAME | cut -f2`
name=`echo $longname | cut -d. -f1`
echo "$vserver_xid.label $name"
echo "$vserver_xid.info $resource limit hits by $longname"
echo "$vserver_xid.critical 1"
echo "$vserver_xid.min 0"
echo "$vserver_xid.type DERIVE"
done
exit 0
elif [ "$1" = "suggest" ]; then
if [ -z "$vservers" ]; then
echo "No vservers running, cannot suggest!" >&2
exit 2
fi
vserver1=`echo $vservers | sed -e 's/ .*//'`
tail -n +2 /proc/virtual/$vserver1/limit | sed -e 's/:.*//'
else
for vserver_xid in $vservers; do
cat /proc/virtual/$vserver_xid/limit \
| awk -v xid="$vserver_xid" -v res="$resource:" \
'{ if ( $1 == res )
printf "%s.value %d\n", xid, $7 }'
done
fi

View file

@ -1,96 +0,0 @@
#!/bin/sh
#
# Copyright (C) 2008 Chris Wilson
# 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
#
# [vserver_limits_RSS]
# user root
# env.vservers 7 18 20 42
#
# Graph Vserver resource limits. Useful to help you know when and how often
# you changed the limits of each vserver, e.g. because customer needed more
# RAM.
#
# 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
# version 0.4 - 2006 Jun 22 - Micah Anderson <micah@riseup.net>
# - Fix error that results if NodeName is set to include a domain name
# version 0.5 - 2008 Apr 12 - Chris Wilson <chris+munin@qwirx.com>
# - Changed to display limits instead of resource usage
# - Adapt to latest vserver kernel (lack of some variables in /proc/virtual)
# Note that your vserver names may change if the contents of
# /etc/vservers/* do not match the nodenames. Also you must specify
# the vservers variable with context IDs (XIDs) rather than names.
scriptname=`basename $0`
resource=`echo $scriptname | sed -e 's/.*_//'`
vservers="$vservers"
if [ -z "$vservers" ]; then
vservers=`ls -1 /proc/virtual | grep -v info | grep -v status`
fi
if [ "$1" = "config" ]; then
echo "graph_title Vserver $resource limits"
# echo 'graph_args --base 1024k -l 0'
echo "graph_vlabel $resource limits"
echo 'graph_category vserver'
echo "graph_info Shows current $resource limits for each vserver.'"
for vserver_xid in $vservers ; do
longname=`/usr/sbin/vuname --xid $vserver_xid NODENAME | cut -f2`
name=`echo $longname | cut -d. -f1`
echo "$vserver_xid.label $name"
echo "$vserver_xid.info $resource limits for $longname"
echo "$vserver_xid.min 0"
echo "$vserver_xid.type GAUGE"
done
exit 0
elif [ "$1" = "suggest" ]; then
if [ -z "$vservers" ]; then
echo "No vservers running, cannot suggest!" >&2
exit 2
fi
vserver1=`echo $vservers | sed -e 's/ .*//'`
tail -n +2 /proc/virtual/$vserver1/limit | sed -e 's/:.*//'
else
for vserver_xid in $vservers; do
cat /proc/virtual/$vserver_xid/limit \
| awk -v xid="$vserver_xid" -v res="$resource:" \
'{ if ( $1 == res )
printf "%s.value %d\n", xid, $6 }'
done
fi