Don't count vm as an entity in BackupPC's entities discovery

tags/zabbix-agent-addons-0.2.69-1
Daniel Berteaud 5 years ago
parent ce3946344f
commit e51f0065a0
  1. 16
      zabbix_scripts/disco_backuppc_sudo

@ -31,26 +31,26 @@ my $json;
if ($entities) {
my %entities = ();
foreach my $host (keys %$hosts){
if ($host =~ m/^(?:vm_)?([^_]+)_.*/) {
foreach my $host ( keys %$hosts ){
if ( $host =~ m/^(?:vm_)?([^_]+)_.*/ and $1 ne 'vm' ) {
$entities{$1}= 1;
}
}
push @{$json->{data}}, { '{#BPC_ENTITY}' => $_ } foreach ( keys %entities );
} elsif ($hosts){
foreach my $host (keys %$hosts){
foreach my $host ( keys %$hosts ){
my $hostConf = $bpc->ConfigDataRead($host);
my $conf = { %$mainConf, %$hostConf };
my $warning = $conf->{EMailNotifyOldBackupDays};
my $errors = (defined $conf->{MaxXferError}) ? $conf->{MaxXferError}: '0';
my $errors = ( defined $conf->{MaxXferError} ) ? $conf->{MaxXferError}: '0';
my $monitoring = $conf->{ZabbixMonitoring} || 1;
my $status = ($conf->{BackupsDisable} gt 0 or $monitoring eq '0') ? '0' : '1';
my $status = ( $conf->{BackupsDisable} gt 0 or $monitoring eq '0' ) ? '0' : '1';
push @{$json->{data}},
{
"{#BPCHOST}" => $host,
"{#BPCHOST}" => $host,
"{#BPCNOBACKUPWARNING}" => $warning,
"{#BPCMAXERROR}" => $errors,
"{#BPCSTATUS}" => $status,
"{#BPCMAXERROR}" => $errors,
"{#BPCSTATUS}" => $status,
};
}
}

Loading…
Cancel
Save