diff --git a/zabbix_conf/backuppc.conf b/zabbix_conf/backuppc.conf index 46388d5..a5d12ac 100644 --- a/zabbix_conf/backuppc.conf +++ b/zabbix_conf/backuppc.conf @@ -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] diff --git a/zabbix_scripts/disco_backuppc_sudo b/zabbix_scripts/disco_backuppc_sudo index bce56d5..86b15dc 100644 --- a/zabbix_scripts/disco_backuppc_sudo +++ b/zabbix_scripts/disco_backuppc_sudo @@ -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};