Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Monitoring openvz resources using nagios and snmp

36 bytes added, 19:11, 8 May 2008
check_vzquota Without SNMP
#!/bin/bash
RET=0
 DATA=`echo;sudo /usr/sbin/vzlist -1 | xargs -I {} bash -c "echo `cat {}:;sudo /procusr/vzsbin/vzquotastat {}"` echo "$DATA" | perl -n -e'
my $vid ;
my $ret=0 ;
while(<STDIN>){
my %vid;
if ( /^(\d+):.*/ ){ $vid=$1; }
if ( /\D*(\d+):.*/ ){ $vid=$1; }
if ( /\s*(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+).*/ ){
$resource=$1 ;
$usage=$2 ;
$softlimit=$3 ;
$hardlimit=$4 ;
$time=$5 ;
$expire=$6 ;
if ( $usage >= $softlimit ){
print "WARNING: VZquota limit exceeded on $vid: $resource usage->$usage, softlimit->$softlimit, hardlimit->$hardlimit, time->$time, expire->$expire " ;
$ret=1;
}
print "$vid:$resource Usage: $usage Softlimit: /$softlimit ";
}
}
echo
exit $RET
 
</source>
 
=== check_ubc Without SNMP ===
<source lang="bash">
2
edits