2
edits
Changes
→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 ;
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">