Pass a regex to backuppc discovery. Default is .*, so every hosts are returned. You can use this to selectively ignore hosts

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 12 years ago
parent c9cc8235c4
commit 34ef6daf64
  1. 2
      zabbix_conf/backuppc.conf
  2. 8
      zabbix_scripts/disco_backuppc_sudo

@ -5,7 +5,7 @@
# Other available macros:
# {#BPCPERIOD}: Max age (in day) the oldest backup should be
# {#BPCHOST}: name of the backup host
UserParameter=backuppc.host.discovery,/usr/bin/sudo /var/lib/zabbix/bin/disco_backuppc_sudo
UserParameter=backuppc.host.discovery[*],/usr/bin/sudo /var/lib/zabbix/bin/disco_backuppc_sudo --regex=$1
# Item prototypes
# key: backuppc.host.info[{#BPCHOST},item]

@ -5,6 +5,13 @@ use BackupPC::Lib;
use BackupPC::CGI::Lib;
use POSIX;
use JSON;
use Getopt::Long;
my $regex = '.*';
GetOptions(
"regex=s" => \$regex
);
# We need to switch to backuppc UID/GID
my $uid = getuid();
@ -19,6 +26,7 @@ my $mainConf = $bpc->ConfigDataRead();
my $json;
foreach my $host (keys %$hosts){
next unless ($host =~ m!$regex!);
my $hostConf = $bpc->ConfigDataRead($host);
my $conf = { %$mainConf, %$hostConf };
my $period = ($conf->{FullPeriod} >= $conf->{IncrPeriod}) ? $conf->{IncrPeriod} : $conf->{FullPeriod};

Loading…
Cancel
Save