Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Talk:Monitoring /proc/user beancounters with nagios

97 bytes removed, 06:14, 14 August 2008
no edit summary
#!/bin/bash resource.sh
# Copyright (C) 2008 Mgual
# Distributed under to GNU General Public License v3v2
# v0.1 2008-08-13
# Ajuntament de Benicarló
#!/bin/bash
echo "" | gawk -vVZ='ID' -vRESOURCE='Parametre' -vPBARRIER='%bar' -vPLIMIT='%lim' '
{
printf "%3s %-20s %3s %3s \n", VZ, RESOURCE , PBARRIER, PLIMIT > "/tmp/beancounters"
}
'
 gawk 'BEGIN { printf "%3s %-20s %3s %3s \n", "ID", "Parameter", "%bar", "%lim" > "/tmp/beancounters" } 
/dummy/||/Version/||/uid/ { next }
! /:/ {
printf "%-20s %3d %3d ", RESOURCE , PBARRIER, PLIMIT
if (PBARRIER>=80) {
printf " Perill Warning "
printf "%3d %-20s %3d %3d Perill\n", VZ, RESOURCE , PBARRIER, PLIMIT >> "/tmp/beancounters"
}
echo "---------------------------------------------------" >> /tmp/beancounters
echo "" | gawk -vVZ='ID' -vRESOURCE='UseDisc%' '
{
printf "%3s %-20s \n", VZ, RESOURCE >> "/tmp/beancounters"
echo "---------------------------------------------------" >> /tmp/beancounters
echo "" | gawk -vVZ='ID' -vRESOURCE='IUseDisc%' '
{
printf "%3s %-20s \n", VZ, RESOURCE >> "/tmp/beancounters"
if [[ "$(cat /tmp/beancounters | wc -l)" != "5" ]] ; then
cat /tmp/beancounters | nail -s "Server:resource.sh perillWarning " user@smtp-server.org
fi
12
edits