<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mgual</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mgual"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Mgual"/>
	<updated>2026-05-15T18:38:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Backup_a_running_container_over_the_network_with_ezvzdump&amp;diff=7524</id>
		<title>Backup a running container over the network with ezvzdump</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Backup_a_running_container_over_the_network_with_ezvzdump&amp;diff=7524"/>
		<updated>2009-09-10T12:08:14Z</updated>

		<summary type="html">&lt;p&gt;Mgual: /*Fixed issue with &amp;quot;vzdump -- restore&amp;quot; permissions and user/group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Ezvzdump ==&lt;br /&gt;
&lt;br /&gt;
Ezvzdump (not to be confused with [[vzdump]]) is a shell script that also allows &lt;br /&gt;
you to dump out a running VE container. The key differences are that ezvzdump &lt;br /&gt;
allows you to utilize past dumps to speed things up, and that a remote host can &lt;br /&gt;
be specified to allow backups and tar archiving over the network.&lt;br /&gt;
&lt;br /&gt;
The dump files that are created are compatible with those that vzdump creates, &lt;br /&gt;
so you must still use &amp;lt;code&amp;gt;vzdump --restore&amp;lt;/code&amp;gt; to restore them.&lt;br /&gt;
&lt;br /&gt;
Dependencies: sendEmail package for emailing of statistics&lt;br /&gt;
&lt;br /&gt;
== Cron ==&lt;br /&gt;
I recommend using &amp;lt;code&amp;gt;nice&amp;lt;/code&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ionice&amp;lt;/code&amp;gt; to run this script so it doesn't bring the host to it's knees. Place this example in &amp;lt;code&amp;gt;/etc/cron.d/ezvzdump&amp;lt;/code&amp;gt; and the backups will run at 3:30 AM every day.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# /etc/cron.d/ezvzdump&lt;br /&gt;
SHELL=/bin/bash  #This is necessary on Ubuntu where dash is the default shell and is thus used by cron.&lt;br /&gt;
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin&lt;br /&gt;
&lt;br /&gt;
30 3 * * * root /usr/bin/nice -n19 /usr/bin/ionice -c3 /usr/local/scripts/ezvzdump &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Changes ==&lt;br /&gt;
&lt;br /&gt;
2009/7/24 - JBiel - Added support for GZip compression and backup&lt;br /&gt;
retention/rotation. Also added support for emailing of statistics.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
# ezvzdump &lt;br /&gt;
&lt;br /&gt;
# Copyright (C) 2008 Alex Lance (alla at cyber.com.au)&lt;br /&gt;
# Sponsored by Silverband Pty. Ltd. &lt;br /&gt;
 &lt;br /&gt;
# This program is free software: you can redistribute it and/or modify&lt;br /&gt;
# it under the terms of the GNU General Public License as published by the Free&lt;br /&gt;
# Software Foundation, either version 3 of the License, or (at your option) any&lt;br /&gt;
# later version.&lt;br /&gt;
 &lt;br /&gt;
# This program is distributed in the hope that it will be useful, but&lt;br /&gt;
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or&lt;br /&gt;
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for&lt;br /&gt;
# more details: http://www.gnu.org/licenses/gpl.txt&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
# Instructions &lt;br /&gt;
# ------------&lt;br /&gt;
&lt;br /&gt;
# This script rsyncs a VE to a specified local directory, suspends the running&lt;br /&gt;
# VE, rsyncs again, and then resumes the VE. This creates a stable snapshot of&lt;br /&gt;
# the VE directories with minimal downtime.&lt;br /&gt;
&lt;br /&gt;
# Once the VE has been dumped out locally, it is rsynced to a remote host. When&lt;br /&gt;
# the rsync has completed, a tar archive is created on the remote host. The tar&lt;br /&gt;
# archive is compatible with the vzdump tar format, so the VE tar file may be&lt;br /&gt;
# later restored with the `vzdump --restore` command.&lt;br /&gt;
&lt;br /&gt;
# By tarring the files together on the remote host, the burden of creating&lt;br /&gt;
# the tar archive is taken away from the hardware node, and given to the remote&lt;br /&gt;
# host / backup server. This ensures that minimal additional CPU/disk resources&lt;br /&gt;
# are used on the machine that is running the VE's.&lt;br /&gt;
&lt;br /&gt;
# This script runs slow the first time you use it, but from then on it utilizes&lt;br /&gt;
# the local and remote stored snapshot directories so that the rsyncs happen&lt;br /&gt;
# expediently. The script does not wait for the remote tar process to complete,&lt;br /&gt;
# it simply kicks off the tar archive creation and then immediately continues.&lt;br /&gt;
&lt;br /&gt;
# This script uses rsync and ssh and assumes that you already have ssh keys&lt;br /&gt;
# set up between your hosts. This script was written because vzdump takes too&lt;br /&gt;
# long and does not utilize a local cache, and also does not do network&lt;br /&gt;
# backups. This script also puts less strain on the hardware node by finishing&lt;br /&gt;
# backups more quickly, and making the remote host do the heavy lifting.&lt;br /&gt;
&lt;br /&gt;
# NASTY BUG! Make sure you're not &amp;quot;vzctl enter&amp;quot;ing a VE while it's being&lt;br /&gt;
# suspended. On my machine (Ubuntu 2.6.24-24-openvz) it caused the VE to&lt;br /&gt;
# zombifiy and I had to reboot the host (including killing the VZ shutdown &lt;br /&gt;
# script because it was unable to shutdown the VE/processes.) Just don't do it!&lt;br /&gt;
&lt;br /&gt;
# This section contains variables that require user customisation. &lt;br /&gt;
# NOTE: all directory names *must* end in a forward-slash. &lt;br /&gt;
 &lt;br /&gt;
# This variable contains a space delimited list of VEID's to be backed up.&lt;br /&gt;
# You can use VEIDS=&amp;quot;$(cd /vz/private/ &amp;amp;&amp;amp; echo *)&amp;quot;  to backup all your VE's.&lt;br /&gt;
VEIDS=&amp;quot;101 102 103 104&amp;quot;&lt;br /&gt;
&lt;br /&gt;
VZ_CONF=&amp;quot;/etc/vz/conf/&amp;quot;             # the path to your openvz $VEID.conf files&lt;br /&gt;
VZ_PRIVATE=&amp;quot;/vz/private/&amp;quot;           # the path to the running VE's&lt;br /&gt;
LOCAL_DIR=&amp;quot;/vz/ezvzdump/&amp;quot;           # the local rsync cache / destination directory&lt;br /&gt;
&lt;br /&gt;
# The remote host and path that this script will rsync the VE's to.&lt;br /&gt;
REMOTE_HOST=&amp;quot;somehost.example.com&amp;quot;&lt;br /&gt;
REMOTE_DIR=&amp;quot;/backup/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Default rsync flags (please note the potentially unsafe delete flags).&lt;br /&gt;
# You can also remove the v flag to get less verbose logging.&lt;br /&gt;
RSYNC_DEFAULT=&amp;quot;rsync -ravH --delete-after --delete-excluded&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Exclude these directories from backup (space delimited).&lt;br /&gt;
# I left /var/log in the backup because when doing a full restore&lt;br /&gt;
# it's necessary that this directory structure is present.&lt;br /&gt;
RSYNC_EXCLUDE=&amp;quot;/usr/portage&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Path to vzctl executable&lt;br /&gt;
VZCTL=&amp;quot;vzctl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Nice debugging messages...&lt;br /&gt;
function e {&lt;br /&gt;
  echo -e $(date &amp;quot;+%F %T&amp;quot;):  $1&lt;br /&gt;
}&lt;br /&gt;
function die {&lt;br /&gt;
  e &amp;quot;Error: $1&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
  exit 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Make sure all is sane&lt;br /&gt;
[ ! -d &amp;quot;${VZ_CONF}&amp;quot; ]    &amp;amp;&amp;amp; die &amp;quot;\$VZ_CONF directory doesn't exist. ($VZ_CONF)&amp;quot;&lt;br /&gt;
[ ! -d &amp;quot;${VZ_PRIVATE}&amp;quot; ] &amp;amp;&amp;amp; die &amp;quot;\$VZ_PRIVATE directory doesn't exist. ($VZ_PRIVATE)&amp;quot;&lt;br /&gt;
[ ! -d &amp;quot;${LOCAL_DIR}&amp;quot; ]  &amp;amp;&amp;amp; die &amp;quot;\$LOCAL_DIR directory doesn't exist. ($LOCAL_DIR)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
e &amp;quot;`hostname` - VZ backup for containers $VEIDS started.&amp;quot; &amp;gt; /tmp/vzbackuptimes&lt;br /&gt;
# Loop through each VEID&lt;br /&gt;
for VEID in $VEIDS; do&lt;br /&gt;
&lt;br /&gt;
  VEHOSTNAME=`vzlist -o hostname $VEID -H`&lt;br /&gt;
  echo &amp;quot;&amp;quot;&lt;br /&gt;
  e &amp;quot;Beginning backup of VEID: $VEID&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
  # Build up the --exclude string for the rsync command&lt;br /&gt;
  RSYNC=&amp;quot;${RSYNC_DEFAULT}&amp;quot;&lt;br /&gt;
  for path in $RSYNC_EXCLUDE; do&lt;br /&gt;
    RSYNC+=&amp;quot; --exclude=${VEID}${path}&amp;quot;&lt;br /&gt;
  done;&lt;br /&gt;
&lt;br /&gt;
  e &amp;quot;Commencing initial ${RSYNC} ${VZ_PRIVATE}${VEID} ${LOCAL_DIR}&amp;quot;&lt;br /&gt;
  [ ! -d &amp;quot;${VZ_PRIVATE}${VEID}&amp;quot; ] &amp;amp;&amp;amp; die &amp;quot;\$VZ_PRIVATE\$VEID directory doesn't exist. (${VZ_PRIVATE}${VEID})&amp;quot;&lt;br /&gt;
  ${RSYNC} ${VZ_PRIVATE}${VEID} ${LOCAL_DIR}&lt;br /&gt;
&lt;br /&gt;
  # If the VE is running, suspend, re-rsync and then resume it ...&lt;br /&gt;
  if [ -n &amp;quot;$(${VZCTL} status ${VEID} | grep running)&amp;quot; ]; then&lt;br /&gt;
&lt;br /&gt;
    e &amp;quot;Suspending VEID: $VEID&amp;quot;&lt;br /&gt;
    before=&amp;quot;$(date +%s)&amp;quot;&lt;br /&gt;
    ${VZCTL} chkpnt $VEID --suspend&lt;br /&gt;
&lt;br /&gt;
    e &amp;quot;Commencing second pass rsync ...&amp;quot;&lt;br /&gt;
    ${RSYNC} ${VZ_PRIVATE}${VEID} ${LOCAL_DIR}&lt;br /&gt;
&lt;br /&gt;
    e &amp;quot;Resuming VEID: $VEID&amp;quot;&lt;br /&gt;
    ${VZCTL} chkpnt $VEID --resume&lt;br /&gt;
    after=&amp;quot;$(date +%s)&amp;quot;&lt;br /&gt;
    elapsed_seconds=&amp;quot;$(expr $after - $before)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    e &amp;quot;Done.&amp;quot;&lt;br /&gt;
    e &amp;quot;Container ${VEID} ($VEHOSTNAME) was down $elapsed_seconds seconds during backup process.&amp;quot; &amp;gt;&amp;gt; /tmp/vzbackuptimes&lt;br /&gt;
&lt;br /&gt;
  else&lt;br /&gt;
    e &amp;quot;# # # Skipping suspend/re-rsync/resume, as the VEID: ${VEID} is not curently running.&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  # Copy VE config files over into the VE storage/cache area&lt;br /&gt;
  if [ ! -d &amp;quot;${LOCAL_DIR}${VEID}/etc/vzdump&amp;quot; ]; then&lt;br /&gt;
    e &amp;quot;Creating directory for openvz config files: mkdir ${LOCAL_DIR}${VEID}/etc/vzdump&amp;quot;&lt;br /&gt;
    mkdir ${LOCAL_DIR}${VEID}/etc/vzdump&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  e &amp;quot;Copying main config file: cp ${VZ_CONF}${VEID}.conf ${LOCAL_DIR}${VEID}/etc/vzdump/vps.conf&amp;quot;&lt;br /&gt;
  [ ! -f &amp;quot;${VZ_CONF}${VEID}.conf&amp;quot; ] &amp;amp;&amp;amp; die &amp;quot;Unable to find ${VZ_CONF}${VEID}.conf&amp;quot;&lt;br /&gt;
  cp ${VZ_CONF}${VEID}.conf ${LOCAL_DIR}${VEID}/etc/vzdump/vps.conf&lt;br /&gt;
&lt;br /&gt;
  for ext in start stop mount umount; do&lt;br /&gt;
    if [ -f &amp;quot;${VZ_CONF}${VEID}.${ext}&amp;quot; ]; then&lt;br /&gt;
      e &amp;quot;Copying other config file: cp ${VZ_CONF}${VEID}.${ext} ${LOCAL_DIR}${VEID}/etc/vzdump/vps.${ext}&amp;quot;&lt;br /&gt;
      cp ${VZ_CONF}${VEID}.${ext} ${LOCAL_DIR}${VEID}/etc/vzdump/vps.${ext}&lt;br /&gt;
    fi&lt;br /&gt;
  done;&lt;br /&gt;
&lt;br /&gt;
  # Run the remote rsync&lt;br /&gt;
  if [ -n &amp;quot;${REMOTE_HOST}&amp;quot; ] &amp;amp;&amp;amp; [ -n &amp;quot;${REMOTE_DIR}&amp;quot; ]; then&lt;br /&gt;
    e &amp;quot;Commencing remote ${RSYNC} ${LOCAL_DIR}${VEID} ${REMOTE_HOST}:${REMOTE_DIR}${VEID}&amp;quot;&lt;br /&gt;
    ${RSYNC} ${LOCAL_DIR}${VEID}/ ${REMOTE_HOST}:${REMOTE_DIR}${VEID}/&lt;br /&gt;
&lt;br /&gt;
    # Rotate older tar.gz backups if they exist. You can comment out these lines if you wish to have only one copy.&lt;br /&gt;
    e &amp;quot;Checking for existing files ${REMOTE_HOST}:${REMOTE_DIR}${VEID}.X.tar and rotating them&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.6.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.6.tar.gz ${REMOTE_DIR}${VEID}.7.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.5.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.5.tar.gz ${REMOTE_DIR}${VEID}.6.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.4.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.4.tar.gz ${REMOTE_DIR}${VEID}.5.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.3.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.3.tar.gz ${REMOTE_DIR}${VEID}.4.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.2.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.2.tar.gz ${REMOTE_DIR}${VEID}.3.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.1.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.1.tar.gz ${REMOTE_DIR}${VEID}.2.tar.gz&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;[ -f ${REMOTE_DIR}${VEID}.0.tar.gz ] &amp;amp;&amp;amp; mv -f ${REMOTE_DIR}${VEID}.0.tar.gz ${REMOTE_DIR}${VEID}.1.tar.gz&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    # Create a remote tar archive - note you can remove the ampersand from the end if you&lt;br /&gt;
    # don't want multiple tar processes running on the remote host simultaneously.&lt;br /&gt;
    e &amp;quot;Making a g-zip compresssed tar archive on remote host (this process will run in the background on the remote host).&amp;quot;&lt;br /&gt;
    ssh ${REMOTE_HOST} &amp;quot;tar czf ${REMOTE_DIR}${VEID}.0.tar.gz --numeric-owner -C ${REMOTE_DIR}${VEID} ./ 2&amp;gt;/dev/null &amp;quot; &amp;amp;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  e &amp;quot;Done.&amp;quot;&lt;br /&gt;
done;&lt;br /&gt;
e &amp;quot;`hostname` - VZ backup for containers $VEIDS complete!&amp;quot; &amp;gt;&amp;gt; /tmp/vzbackuptimes&lt;br /&gt;
# Email a log of the backup process to some email address. Can be modified slightly to use native &amp;quot;mail&amp;quot; command&lt;br /&gt;
# if sendmail is installed and configured locally.&lt;br /&gt;
cat /tmp/vzbackuptimes | sendEmail -f root@`hostname` -t someuser@example.com -u &amp;quot;`hostname` VZ backup statistics.&amp;quot; -s mail.example.com #(put your open relay here)&lt;br /&gt;
echo&lt;br /&gt;
cat /tmp/vzbackuptimes&lt;br /&gt;
rm /tmp/vzbackuptimes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6333</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6333"/>
		<updated>2008-08-14T06:14:57Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This script gives a warning if any parameter in a virtual environment (VZ) exceeds 80% of resources.&lt;br /&gt;
&lt;br /&gt;
== packages basic installation ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
  Configures   &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt; files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== configuration ==&lt;br /&gt;
&lt;br /&gt;
Copy the script and configure the &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script resource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v2&lt;br /&gt;
# v0.1 2008-08-13&lt;br /&gt;
# Ajuntament de Benicarló&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
gawk ' BEGIN {&lt;br /&gt;
                printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, &amp;quot;ID&amp;quot;, &amp;quot;Parameter&amp;quot;, &amp;quot;%bar&amp;quot;, &amp;quot;%lim&amp;quot; &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Warning &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use Disc%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse Disc%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s &amp;quot;Server:resource.sh Warning &amp;quot; user@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6330</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6330"/>
		<updated>2008-08-13T12:17:08Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This script gives a warning if any parameter in a virtual environment (VZ) exceeds 80% of resources.&lt;br /&gt;
&lt;br /&gt;
== packages basic installation ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
  Configures   &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt; files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== configuration ==&lt;br /&gt;
&lt;br /&gt;
Copy the script and configure the &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script resource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.1 2008-08-13&lt;br /&gt;
# Ajuntament de Benicarló&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6329</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6329"/>
		<updated>2008-08-13T12:12:41Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This script gives a warning if any parameter in a virtual environment (VZ) exceed 80% of resources.&lt;br /&gt;
&lt;br /&gt;
== packages basic installation ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
  Configures   &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt; files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== configuration ==&lt;br /&gt;
&lt;br /&gt;
Copy the script and configure the &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script resource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.1 2008-08-13&lt;br /&gt;
# Ajuntament de Benicarló&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6328</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6328"/>
		<updated>2008-08-13T12:07:01Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This script gives a warning if any parameter in a virtual environment (VZ) exceed 80% of resources.&lt;br /&gt;
&lt;br /&gt;
== packages basic installation ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
  Configures   &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt; files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== configuration ==&lt;br /&gt;
&lt;br /&gt;
Copy the script and configure &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script resource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.1 2008-08-13&lt;br /&gt;
# Ajuntament de Benicarló&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6327</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6327"/>
		<updated>2008-08-13T12:04:02Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This script gives a warning if any parameter in a virtual environment (VZ) exceed 80% of resources.&lt;br /&gt;
&lt;br /&gt;
== packages basic installation ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
  Configures   &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt; files.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== configuration ==&lt;br /&gt;
&lt;br /&gt;
Copy the script and configure &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script resource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.1 2008-08-13&lt;br /&gt;
# Ajuntament de Benicarló&lt;br /&gt;
# Miquel Gual Torner&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6326</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6326"/>
		<updated>2008-08-13T10:54:18Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To be added locally on the VZ HN to &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt; to script &amp;lt;code&amp;gt; resource.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Package Install base ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
 To configure file &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script eesource ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.2 2008-08-13&lt;br /&gt;
# Miquel Gual Torner&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6325</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6325"/>
		<updated>2008-08-13T10:53:48Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
To be added locally on the VZ HN to &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt; to script &amp;lt;code&amp;gt; resource.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Package Install base ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  aptitude install nail gawk &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== nail configuration ==&lt;br /&gt;
 To configure file &amp;lt;code&amp;gt; /etc/nailrc &amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt; ~/.mailrc &amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set smtp=smtp.server.org&lt;br /&gt;
set from=nail@smtp.server.org&lt;br /&gt;
set charset=iso-8859-1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Script Alarm ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash resource.sh&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.2 2008-08-13&lt;br /&gt;
# Miquel Gual Torner&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6324</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6324"/>
		<updated>2008-08-13T10:44:55Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
To be added locally on the VZ HN to &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt; to script &amp;lt;code&amp;gt; resource.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=bash&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under to GNU General Public License v3&lt;br /&gt;
# v0.2 2008-08-13&lt;br /&gt;
# Miquel Gual Torner&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '&lt;br /&gt;
                {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s %3s %3s \n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT  &amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
gawk '&lt;br /&gt;
        /dummy/||/Version/||/uid/ { next }&lt;br /&gt;
        ! /:/ {&lt;br /&gt;
                RESOURCE=$1&lt;br /&gt;
                MAXHELD=$3&lt;br /&gt;
                BARRIER=$4&lt;br /&gt;
                LIMIT=$5&lt;br /&gt;
              }&lt;br /&gt;
        /:/  {  gsub(/:/, &amp;quot;&amp;quot;, $1)&lt;br /&gt;
                printf &amp;quot;------- %s ------- \n&amp;quot;,$1&lt;br /&gt;
                VZ=$1&lt;br /&gt;
                RESOURCE=$2&lt;br /&gt;
                MAXHELD=$4&lt;br /&gt;
                BARRIER=$5&lt;br /&gt;
                LIMIT=$6&lt;br /&gt;
              }&lt;br /&gt;
        {&lt;br /&gt;
                #printf &amp;quot;R=%s M=%s B=%s L=%s &amp;quot;, RESOURCE, MAXHELD, BARRIER, LIMIT&lt;br /&gt;
                if (BARRIER&amp;gt;0) {&lt;br /&gt;
                        PBARRIER=MAXHELD*100/BARRIER&lt;br /&gt;
                } else {&lt;br /&gt;
                        PBARRIER=0&lt;br /&gt;
                }&lt;br /&gt;
                if (LIMIT&amp;gt;0) {&lt;br /&gt;
                        PLIMIT=MAXHELD*100/LIMIT&lt;br /&gt;
                } else {&lt;br /&gt;
                        PLIMIT=0&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;%-20s %3d %3d &amp;quot;, RESOURCE , PBARRIER, PLIMIT&lt;br /&gt;
                if (PBARRIER&amp;gt;=80)  {&lt;br /&gt;
                        printf &amp;quot; Perill &amp;quot;&lt;br /&gt;
                        printf &amp;quot;%3d %-20s %3d %3d Perill\n&amp;quot;, VZ, RESOURCE , PBARRIER, PLIMIT &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
                printf &amp;quot;\n&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
        ' /proc/user_beancounters&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='Use%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Quota Disc&lt;br /&gt;
&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -h |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;---------------------------------------------------&amp;quot; &amp;gt;&amp;gt; /tmp/beancounters&lt;br /&gt;
echo &amp;quot;&amp;quot; | gawk -vVZ='ID' -vRESOURCE='IUse%' '&lt;br /&gt;
               {&lt;br /&gt;
                        printf &amp;quot;%3s %-20s \n&amp;quot;, VZ, RESOURCE  &amp;gt;&amp;gt; &amp;quot;/tmp/beancounters&amp;quot;&lt;br /&gt;
                }&lt;br /&gt;
        '&lt;br /&gt;
for i in $(vzlist | cut -d&amp;quot; &amp;quot; -f 8)&lt;br /&gt;
do&lt;br /&gt;
        vzctl exec $i df -i |  gawk -vVEID=$i '/^simfs/ { if ($5 &amp;gt; &amp;quot;80%&amp;quot;) { printf &amp;quot;%s %s\n&amp;quot;, VEID, $5 }  }' &amp;gt;&amp;gt;/tmp/beancounters&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if [[ &amp;quot;$(cat /tmp/beancounters | wc -l)&amp;quot; != &amp;quot;5&amp;quot;  ]] ; then&lt;br /&gt;
        cat /tmp/beancounters   |  nail -s Server:resource.sh perill@smtp-server.org&lt;br /&gt;
fi&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6323</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6323"/>
		<updated>2008-08-13T10:40:13Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
To be added locally on the VZ HN to &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt; to script &amp;lt;code&amp;gt; resource.sh &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shell&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under GNU General Public License v3&lt;br /&gt;
# v0.2 2008-04-04&lt;br /&gt;
# Christian Benke &amp;lt;benkokakao  gmail  com&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import string&lt;br /&gt;
import pickle&lt;br /&gt;
import sys&lt;br /&gt;
import getopt&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
veid=''&lt;br /&gt;
current_data=dict()&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6322</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6322"/>
		<updated>2008-08-13T10:39:42Z</updated>

		<summary type="html">&lt;p&gt;Mgual: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
To be added locally on the VZ HN to &amp;lt;code&amp;gt; /etc/crontab &amp;lt;/code&amp;gt; to script &amp;lt;code&amp;gt; resource.sh &amp;lt;code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=shell&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# Copyright (C) 2008 Mgual&lt;br /&gt;
# Distributed under GNU General Public License v3&lt;br /&gt;
# v0.2 2008-04-04&lt;br /&gt;
# Christian Benke &amp;lt;benkokakao  gmail  com&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import string&lt;br /&gt;
import pickle&lt;br /&gt;
import sys&lt;br /&gt;
import getopt&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
veid=''&lt;br /&gt;
current_data=dict()&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6321</id>
		<title>Talk:Monitoring /proc/user beancounters with nagios</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Monitoring_/proc/user_beancounters_with_nagios&amp;diff=6321"/>
		<updated>2008-08-13T10:36:45Z</updated>

		<summary type="html">&lt;p&gt;Mgual: New page: {{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}} To be added locally on the VZ HN to   Works as nagios-plugin with option '-f' or reports an increase of a failcnt-value by ma...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:Monitoring /proc/user_beancounters with email}}&lt;br /&gt;
To be added locally on the VZ HN to &lt;br /&gt;
&lt;br /&gt;
Works as nagios-plugin with option '-f' or reports an increase of a failcnt-value by mail if run e.g. as a cronjob with option '-t'. We use it with both cases to be sure that we see a peak in case it happened between the nagios-checks.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=python&amp;gt;&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
# Copyright (C) 2008 Christian Benke&lt;br /&gt;
# Distributed under the terms of the GNU General Public License v2&lt;br /&gt;
# v0.2 2008-04-04&lt;br /&gt;
# Christian Benke &amp;lt;benkokakao  gmail  com&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import string&lt;br /&gt;
import pickle&lt;br /&gt;
import sys&lt;br /&gt;
import getopt&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
veid=''&lt;br /&gt;
current_data=dict()&lt;/div&gt;</summary>
		<author><name>Mgual</name></author>
		
	</entry>
</feed>