From 7a7a0b765a986bcbc2969cd48b66bdeee6d5c286 Mon Sep 17 00:00:00 2001 From: szimszon Date: Sat, 12 Mar 2016 22:21:50 +0100 Subject: [PATCH] Handle multiple zabbix servers Handle if multiple servers are specified in zabbix_agent.conf --- zabbix-backuppc.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/zabbix-backuppc.pl b/zabbix-backuppc.pl index d78d381..cc66f1d 100755 --- a/zabbix-backuppc.pl +++ b/zabbix-backuppc.pl @@ -341,9 +341,12 @@ sub zabbix_config { sub zabbix_post { my $key = $_[0]; my $val = $_[1]; - - my $cmd = "zabbix_sender -z $zabbix_server -p 10051 -s '$zabbix_host' -k $key -o '$val'"; - system("$cmd >/dev/null"); + my @servers = split(',', $zabbix_server); + + foreach my $server (@servers) { + my $cmd = "zabbix_sender -z $server -p 10051 -s $zabbix_host -k $key -o '$val'"; + system("$cmd >/dev/null"); + } }