Support reporting max errors accepted for one host

This commit is contained in:
Daniel Berteaud 2013-04-14 22:59:45 +02:00
parent 59adef4377
commit fc8cd89ead
2 changed files with 6 additions and 1 deletions

View File

@ -9,5 +9,5 @@ UserParameter=backuppc.host.discovery,/usr/bin/sudo /var/lib/zabbix/bin/disco_ba
# Item prototypes
# key: backuppc.host.info[{#BPCHOST},item]
# Valide item are: errors, size, duration, age, notify
# Valide item are: errors, max_errors, size, duration, age, notify
UserParameter=backuppc.host.info[*],/usr/bin/sudo /var/lib/zabbix/bin/check_backuppc_sudo $1 $2

View File

@ -24,6 +24,7 @@ my $conf = { %$mainConf, %$hostConf };
my $fullCnt = $incrCnt = 0;
my $fullAge = $incrAge = $lastAge = -1;
my $lastXferErrors = 0;
my $maxErrors = 0;
for ( my $i = 0 ; $i < @backups ; $i++ ) {
if ( $backups[$i]{type} eq "full" ) {
@ -54,10 +55,14 @@ else {
$lastAge = sprintf("%.1f", (time - $lastAge) / (24 * 3600));
}
$lastXferErrors = $backups[@backups-1]{xferErrs} if ( @backups );
$maxErrors = $conf->{MaxXferError} if (defined $conf->{MaxXferError});
if ($what eq 'errors'){
print $lastXferErrors;
}
elsif ($what eq 'max_errors'){
print $maxErrors;
}
elsif ($what eq 'age'){
print $lastAge;
}