Update zabbix-backuppc.pl

Corrected so the values for hosts with spaces in their names are correctly proceeded. And escaped print for verification function.
This commit is contained in:
MJ Antipode 2020-04-14 23:29:53 +02:00
parent 1eefaa5dc6
commit 2b3440a429

View File

@ -36,7 +36,7 @@ foreach my $key (keys %Val) {
if ($Var{$key}) if ($Var{$key})
{ {
zabbix_post($Var{$key},$Val{$key}); zabbix_post($Var{$key},$Val{$key});
print "$Var{$key} | $Val{$key}\n"; #print "$Var{$key} | $Val{$key}\n";
} }
} }
print "1"; print "1";
@ -344,7 +344,7 @@ sub zabbix_post {
my @servers = split(',', $zabbix_server); my @servers = split(',', $zabbix_server);
foreach my $server (@servers) { foreach my $server (@servers) {
my $cmd = "zabbix_sender -z $server -p 10051 -s $zabbix_host -k $key -o '$val'"; my $cmd = "zabbix_sender -z $server -p 10051 -s $zabbix_host -k '$key' -o '$val'";
system("$cmd >/dev/null"); system("$cmd >/dev/null");
} }
} }