Author: baggins                      Date: Thu Dec  3 23:36:58 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- old fixes no longer necessary (plugins in main munin distribution)
- added vserver_jiffies plugin (cumulative cpu usage by vservers)

---- Files affected:
packages/munin-plugins-muninexchange:
   munin-plugins-muninexchange-vserver.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: 
packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch
diff -u 
packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch:1.1
 
packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch:1.2
--- 
packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch:1.1
  Sat Nov 29 01:41:27 2008
+++ 
packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch  
    Fri Dec  4 00:36:52 2009
@@ -1,236 +1,94 @@
-diff -ur munin-plugins-muninexchange-20081128/vserver/vserver_cpu_ 
munin/vserver/vserver_cpu_
---- munin-plugins-muninexchange-20081128/vserver/vserver_cpu_  2008-11-28 
18:36:19.000000000 +0100
-+++ munin/vserver/vserver_cpu_ 2008-11-29 01:39:40.000000000 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
+--- /dev/null  2009-11-24 13:50:34.796667044 +0100
++++ munin/vserver/vserver_jiffies      2008-12-06 02:00:43.000000000 +0100
+@@ -0,0 +1,91 @@
 +#!/bin/bash
- #
- # Copyright (C) 2006-2008 Holger Levsen and Micah Anderson
- #
-diff -ur munin-plugins-muninexchange-20081128/vserver/vserver_loadavg 
munin/vserver/vserver_loadavg
---- munin-plugins-muninexchange-20081128/vserver/vserver_loadavg       
2008-11-28 18:36:21.000000000 +0100
-+++ munin/vserver/vserver_loadavg      2008-11-29 01:39:40.000000000 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- #
- # Copyright (C) 2007 Andrei Morgan
- # Copyright (C) 2008 Micah Anderson
-diff -ur munin-plugins-muninexchange-20081128/vserver/vserver_resources 
munin/vserver/vserver_resources
---- munin-plugins-muninexchange-20081128/vserver/vserver_resources     
2008-11-28 18:36:22.000000000 +0100
-+++ munin/vserver/vserver_resources    2008-11-29 01:39:40.000000000 +0100
-@@ -1,4 +1,4 @@
--#!/bin/sh
-+#!/bin/bash
- #
- # Copyright (C) 2006-2008 Holger Levsen, Micah Anderson
- #
-@@ -188,6 +188,12 @@
-           echo 'graph_vlabel ANON pages'
-           echo 'graph_info Shows anonymous memory (human readable) used by 
each vserver.'
-           ;;
-+      RMAP)
-+          echo 'graph_title Mapped memory used by vserver'
-+          echo 'graph_args --base 1024k -l 0'
-+          echo 'graph_vlabel RMAP pages'
-+          echo 'graph_info Shows mapped memory (human readable) used by each 
vserver.'
-+          ;;
-       FILES)
-           echo 'graph_title Files used by vserver'
-           echo 'graph_args --base 1024k -l 0'
-@@ -224,6 +230,30 @@
-           echo 'graph_vlabel SHM pages'
-           echo 'graph_info Shows shared memory (human readable) used by each 
vserver.'
-           ;;
-+      SEMA)
-+          echo 'graph_title Semaphore arrays used by vserver'
-+          echo 'graph_args --base 1024k -l 0'
-+          echo 'graph_vlabel Semaphore arrays'
-+          echo 'graph_info Shows semaphore arrays used by each vserver.'
-+          ;;
-+      SEMS)
-+          echo 'graph_title Semaphores used by vserver'
-+          echo 'graph_args --base 1024k -l 0'
-+          echo 'graph_vlabel Semaphores'
-+          echo 'graph_info Shows semaphores used by each vserver.'
-+          ;;
-+      DENT)
-+          echo 'graph_title dentry structs used by vserver'
-+          echo 'graph_args --base 1024k -l 0'
-+          echo 'graph_vlabel dentry structs'
-+          echo 'graph_info Shows dentry structs used by each vserver.'
-+          ;;
-+      ALL)
-+          echo 'graph_title Resources used by vserver'
-+          echo 'graph_args --base 1024k -l 0'
-+          echo 'graph_vlabel Resources'
-+          echo 'graph_info Shows rsources used by each vserver.'
-+          ;;
-       *)
-           echo "$RESOURCE not defined."
-           exit 1
-@@ -242,53 +272,108 @@
- 
-       case "$RESOURCE" in
-           PROC)
--              echo "$NAME.label $LABEL: processes"
--              echo "$NAME.info Number of processes used by $LABEL."
-+              echo "${NAME}_PROC.label $LABEL: processes"
-+              echo "${NAME}_PROC.info Number of processes used by $LABEL."
-               ;;
-           VM)
--              echo "$NAME.label $LABEL: Virtual memory"
--              echo "$NAME.info Size of virtual memory used by $LABEL. (Number 
multipled by $pagesize to make it human readable)"
--              echo "$NAME.cdef $NAME,$pagesize,*"
-+              echo "${NAME}_VM.label $LABEL: Virtual memory"
-+              echo "${NAME}_VM.info Size of virtual memory used by $LABEL. 
(Number multipled by $pagesize to make it human readable)"
-+              echo "${NAME}_VM.cdef ${NAME}_VM,$pagesize,*"
-               ;;
-           VML)
--              echo "$NAME.label $LABEL: Locked memory"
--              echo "$NAME.info Size of locked memory used by $LABEL. (Number 
multipled by $pagesize to make it human readable)"
--              echo "$NAME.cdef $NAME,$pagesize,*"
-+              echo "${NAME}_VML.label $LABEL: Locked memory"
-+              echo "${NAME}_VML.info Size of locked memory used by $LABEL. 
(Number multipled by $pagesize to make it human readable)"
-+              echo "${NAME}_VML.cdef ${NAME}_VML,$pagesize,*"
-               ;;
-           RSS)
--              echo "$NAME.label $LABEL: Resident set size"
--              echo "$NAME.info Size of resident set size used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
--              echo "$NAME.cdef $NAME,$pagesize,*"
-+              echo "${NAME}_RSS.label $LABEL: Resident set size"
-+              echo "${NAME}_RSS.info Size of resident set size used by 
$LABEL. (Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_RSS.cdef ${NAME}_RSS,$pagesize,*"
-               ;;
-           ANON)
--              echo "$NAME.label $LABEL: Anonymous memory"
--              echo "$NAME.info Size of anonymous memory used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
--              echo "$NAME.cdef $NAME,$pagesize,*"
-+              echo "${NAME}_ANON.label $LABEL: Anonymous memory"
-+              echo "${NAME}_ANON.info Size of anonymous memory used by 
$LABEL. (Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_ANON.cdef ${NAME}_ANON,$pagesize,*"
-+              ;;
-+          RMAP)
-+              echo "${NAME}_RMAP.label $LABEL: Mapped memory"
-+              echo "${NAME}_RMAP.info Size of mapped memory used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_RMAP.cdef ${NAME}_RMAP,$pagesize,*"
-               ;;
-           FILES)
--              echo "$NAME.label $LABEL: Files"
--              echo "$NAME.info Number of files used by $LABEL."
-+              echo "${NAME}_FILES.label $LABEL: Files"
-+              echo "${NAME}_FILES.info Number of files used by $LABEL."
-               ;;
-           OFD)
--              echo "$NAME.label $LABEL: Open filedescriptors"
--              echo "$NAME.info Number of open filedescriptors used by $LABEL."
-+              echo "${NAME}_OFD.label $LABEL: Open filedescriptors"
-+              echo "${NAME}_OFD.info Number of open filedescriptors used by 
$LABEL."
-               ;;
-           LOCKS)
--              echo "$NAME.label $LABEL: Locks"
--              echo "$NAME.info Number of locks used by $LABEL."
-+              echo "${NAME}_LOCKS.label $LABEL: Locks"
-+              echo "${NAME}_LOCKS.info Number of locks used by $LABEL."
-               ;;
-           SOCK)
--              echo "$NAME.label $LABEL: Sockets"
--              echo "$NAME.info Number of sockets used by $LABEL."
-+              echo "${NAME}_SOCK.label $LABEL: Sockets"
-+              echo "${NAME}_SOCK.info Number of sockets used by $LABEL."
-               ;;
-           MSGQ)
--              echo "$NAME.label $LABEL: Message queues"
--              echo "$NAME.info Number of message queues used by $LABEL."
-+              echo "${NAME}_MSGQ.label $LABEL: Message queues"
-+              echo "${NAME}_MSGQ.info Number of message queues used by 
$LABEL."
-               ;;
-           SHM)
--              echo "$NAME.label $LABEL: Shared memory"
--              echo "$NAME.info Size of shared memory used by $LABEL. (Number 
multiplied by $pagesize to make it human readable)"
--              echo "$NAME.cdef $1,$pagesize,*"
-+              echo "${NAME}_SHM.label $LABEL: Shared memory"
-+              echo "${NAME}_SHM.info Size of shared memory used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_SHM.cdef ${NAME}_SHM,$pagesize,*"
-+              ;;
-+          SEMA)
-+              echo "${NAME}_SEMA.label $LABEL: Semaphore arrays"
-+              echo "${NAME}_SEMA.info Number of semaphore arrays used by 
$LABEL."
-+              ;;
-+          SEMS)
-+              echo "${NAME}_SEMS.label $LABEL: Semaphores"
-+              echo "${NAME}_SEMS.info Number of semaphores used by $LABEL."
-+              ;;
-+          DENT)
-+              echo "${NAME}_DENT.label $LABEL: dentry structs"
-+              echo "${NAME}_DENT.info Number of dentries used by $LABEL."
-+              ;;
-+          ALL)
-+              echo "${NAME}_PROC.label $LABEL: processes"
-+              echo "${NAME}_PROC.info Number of processes used by $LABEL."
-+              echo "${NAME}_VM.label $LABEL: Virtual memory"
-+              echo "${NAME}_VM.info Size of virtual memory used by $LABEL. 
(Number multipled by $pagesize to make it human readable)"
-+              echo "${NAME}_VM.cdef ${NAME}_VM,$pagesize,*"
-+              echo "${NAME}_VML.label $LABEL: Locked memory"
-+              echo "${NAME}_VML.info Size of locked memory used by $LABEL. 
(Number multipled by $pagesize to make it human readable)"
-+              echo "${NAME}_VML.cdef ${NAME}_VML,$pagesize,*"
-+              echo "${NAME}_RSS.label $LABEL: Resident set size"
-+              echo "${NAME}_RSS.info Size of resident set size used by 
$LABEL. (Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_RSS.cdef ${NAME}_RSS,$pagesize,*"
-+              echo "${NAME}_ANON.label $LABEL: Anonymous memory"
-+              echo "${NAME}_ANON.info Size of anonymous memory used by 
$LABEL. (Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_ANON.cdef ${NAME}_ANON,$pagesize,*"
-+              echo "${NAME}_RMAP.label $LABEL: Mapped memory"
-+              echo "${NAME}_RMAP.info Size of mapped memory used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_RMAP.cdef ${NAME}_RMAP,$pagesize,*"
-+              echo "${NAME}_FILES.label $LABEL: Files"
-+              echo "${NAME}_FILES.info Number of files used by $LABEL."
-+              echo "${NAME}_OFD.label $LABEL: Open filedescriptors"
-+              echo "${NAME}_OFD.info Number of open filedescriptors used by 
$LABEL."
-+              echo "${NAME}_LOCKS.label $LABEL: Locks"
-+              echo "${NAME}_LOCKS.info Number of locks used by $LABEL."
-+              echo "${NAME}_SOCK.label $LABEL: Sockets"
-+              echo "${NAME}_SOCK.info Number of sockets used by $LABEL."
-+              echo "${NAME}_MSGQ.label $LABEL: Message queues"
-+              echo "${NAME}_MSGQ.info Number of message queues used by 
$LABEL."
-+              echo "${NAME}_SHM.label $LABEL: Shared memory"
-+              echo "${NAME}_SHM.info Size of shared memory used by $LABEL. 
(Number multiplied by $pagesize to make it human readable)"
-+              echo "${NAME}_SHM.cdef ${NAME}_SHM,$pagesize,*"
-+              echo "${NAME}_SEMA.label $LABEL: Semaphore arrays"
-+              echo "${NAME}_SEMA.info Number of semaphore arrays used by 
$LABEL."
-+              echo "${NAME}_SEMS.label $LABEL: Semaphores"
-+              echo "${NAME}_SEMS.info Number of semaphores used by $LABEL."
-+              echo "${NAME}_DENT.label $LABEL: dentry structs"
-+              echo "${NAME}_DENT.info Number of dentries used by $LABEL."
-               ;;
-           *)
-               echo "$RESOURCE not defined."
-@@ -299,7 +384,7 @@
-       if [ ! -z "$LIMITS" -a "$LIMITS" = 1 ]; then
-           LIMIT=`cat /proc/virtual/$xid/limit | grep $RESOURCE | cut -f4`
-           if [ ${LIMIT:-0} -gt 0 ]; then
--              echo "$NAME.critical $LIMIT"
-+              echo "${NAME}_${RESOURCE}.critical $LIMIT"
-           fi
-       fi
-     done
-@@ -310,8 +395,15 @@
- for xid in $XIDS ; do
-     LABEL=`cat /proc/virtual/$xid/$NAMELOC |grep NodeName |cut -f2`
-     NAME=`echo $LABEL | cut -d. -f1 |  tr '-' '_'`
--    cat /proc/virtual/$xid/limit | awk -v name="${NAME}" -v 
resource="${RESOURCE}:" \
--      '{ if ( $1 == resource )
--            printf "%s.value %d\n", name, $2 }'
-+    if [ $RESOURCE = "ALL" ]; then
-+    cat /proc/virtual/$xid/limit | awk -v name="${NAME}" \
-+      '{ if ( $1 ~ /[A-Z]*:/ ) {
-+            resource = $1 ; gsub(/:/, "", resource);
-+            printf "%s_%s.value %d\n", name, resource, $2
-+           }}'
-+    else
-+    cat /proc/virtual/$xid/limit | awk -v name="${NAME}" -v 
resource="${RESOURCE}" \
-+      '{ if ( $1 ~ resource )
-+            printf "%s_%s.value %d\n", name, resource, $2 }'
-+    fi
- done
--
++#
++# Copyright (C) 2006-2008 Holger Levsen and Micah Anderson
++#
++# 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.
++
++# Graph Vserver 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
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/munin-plugins-muninexchange/munin-plugins-muninexchange-vserver.patch?r1=1.1&r2=1.2&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to