...
 
Commits (3)
#!/usr/bin/perl
# backstep-traceback - Client software for the AWIT Backstep server
# Copyright (c) 2010-2017, AllWorldIT
# Copyright (c) 2010-2018, AllWorldIT
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -57,7 +57,7 @@ use Sys::Hostname;
our $VERSION = "1.3.3";
our $VERSION = "1.3.4";
# Constants
sub LOG_DEBUG { return 5; }
......@@ -2678,29 +2678,39 @@ sub zabbixReport
}
# Check result of close
my ($res,@data) = runCommand(
"zabbix_sender",
"--config",$globalConfig{'zabbix-config'},
"--with-timestamps",
"--input-file","-",
@extraArgs,
{'pipe_array' => [ @zabbixData ]}
);
if ($res) {
if ($res == -1) {
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender could not be spawned: %s",$!);
} elsif (my $signal = $res & 127) {
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender died with signal %s",$signal);
my $res;
for (my $try = 1; $try < 4; $try++) {
($res,my @data) = runCommand(
"zabbix_sender",
"--config",$globalConfig{'zabbix-config'},
"--with-timestamps",
"--input-file","-",
@extraArgs,
{'pipe_array' => [ @zabbixData ]}
);
if ($res) {
if ($res == -1) {
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender could not be spawned: %s",$!);
} elsif (my $signal = $res & 127) {
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender died with signal %s",$signal);
} else {
my $exitcode = $? >> 8;
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender died with exit code %s",$exitcode);
}
# If we have something in our stdout buffer, return it
if (defined($data[1]) && $data[1] ne "") {
printLog(LOG_ERROR,"ZABBIX: - STDERR log below\n- - - - - - - - - -\n%s\n- - - - - - - - - -\n",$data[1]);
}
if (defined($data[0]) && $data[0] ne "") {
printLog(LOG_ERROR,"ZABBIX: - STDOUT log below\n- - - - - - - - - -\n%s\n- - - - - - - - - -\n",$data[0]);
}
# Retry
printLog(LOG_ERROR,"ZABBIX: - Retrying... #$try");
sleep(10);
# Success
} else {
my $exitcode = $? >> 8;
printLog(LOG_ERROR,"ZABBIX: - Zabbix sender died with exit code %s",$exitcode);
}
# If we have something in our stdout buffer, return it
if (defined($data[1]) && $data[1] ne "") {
printLog(LOG_ERROR,"ZABBIX: - STDERR log below\n- - - - - - - - - -\n%s\n- - - - - - - - - -\n",$data[1]);
}
if (defined($data[0]) && $data[0] ne "") {
printLog(LOG_ERROR,"ZABBIX: - STDOUT log below\n- - - - - - - - - -\n%s\n- - - - - - - - - -\n",$data[0]);
last;
}
}
......