mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2013-06-19 Miguel de Dios <miguel.dedios@artica.es>
* util/pandora_xml_stress.pl: fixed the send across tentacle, now when it can not send the file almost the log have a error entry. And added local send method. * util/pandora_xml_stress.conf: added confs for local send method. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8349 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
f540aa956b
commit
75cf25b665
@ -1,3 +1,11 @@
|
|||||||
|
2013-06-19 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* util/pandora_xml_stress.pl: fixed the send across tentacle, now
|
||||||
|
when it can not send the file almost the log have a error entry.
|
||||||
|
And added local send method.
|
||||||
|
|
||||||
|
* util/pandora_xml_stress.conf: added confs for local send method.
|
||||||
|
|
||||||
2013-06-14 Sergio Martin <sergio.martin@artica.es>
|
2013-06-14 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
* lib/PandoraFMS/Core.pm: Fixed comments addition in the
|
* lib/PandoraFMS/Core.pm: Fixed comments addition in the
|
||||||
|
@ -11,7 +11,7 @@ agent_file /usr/share/pandora_server/util/pandora_xml_stress.agents
|
|||||||
# Directory where XML data files will be placed, by default /tmp.
|
# Directory where XML data files will be placed, by default /tmp.
|
||||||
# When sending files to a local Tentacle server make sure this directory
|
# When sending files to a local Tentacle server make sure this directory
|
||||||
# and Pandora FMS Server's incomingdir are different.
|
# and Pandora FMS Server's incomingdir are different.
|
||||||
temporal /var/spool/pandora/data_in
|
temporal /tmp
|
||||||
|
|
||||||
# Pandora FMS XML Stress log file, logs to stdout by default.
|
# Pandora FMS XML Stress log file, logs to stdout by default.
|
||||||
log_file pandora_xml_stress.log
|
log_file pandora_xml_stress.log
|
||||||
@ -72,7 +72,13 @@ altitude_base 0
|
|||||||
position_radius 10
|
position_radius 10
|
||||||
|
|
||||||
# Address of the Tentacle server where XML files will be sent (optional).
|
# Address of the Tentacle server where XML files will be sent (optional).
|
||||||
# server_ip 192.168.50.1
|
server_ip 127.0.0.1
|
||||||
|
|
||||||
|
# Local copy XML files, by default 0
|
||||||
|
local_copy 1
|
||||||
|
|
||||||
|
# Local dir for to copy XML files in local send method, by defaul /var/spool/pandora/data_in
|
||||||
|
#local_dir /var/spool/pandora/data_in
|
||||||
|
|
||||||
# Port of the Tentacle server, by default 41121.
|
# Port of the Tentacle server, by default 41121.
|
||||||
# server_port 41121
|
# server_port 41121
|
||||||
|
@ -272,12 +272,13 @@ sub generate_xml_files ($$$$$$) {
|
|||||||
|
|
||||||
# Save the XML data file
|
# Save the XML data file
|
||||||
# The temporal dir is normaly the /var/spool/pandora/data_in
|
# The temporal dir is normaly the /var/spool/pandora/data_in
|
||||||
my $xml_file = $temporal . '/' . $agent_name . '_' . $utimestamp . '.data';
|
my $xml_fullpath_file = $temporal . '/' . $agent_name . '_' . $utimestamp . '.data';
|
||||||
open (FILE, ">", $xml_file) || die ("[error] Could not write to '$xml_file': $!.\n\n");
|
my $xml_file = $agent_name . '_' . $utimestamp . '.data';
|
||||||
|
open (FILE, ">", $xml_fullpath_file) || die ("[error] Could not write to '$xml_fullpath_file': $!.\n\n");
|
||||||
print FILE $xml_data;
|
print FILE $xml_data;
|
||||||
close (FILE);
|
close (FILE);
|
||||||
|
|
||||||
copy_xml_file ($conf, $xml_file);
|
copy_xml_file ($conf, $xml_fullpath_file, $xml_file);
|
||||||
$XMLFiles++;
|
$XMLFiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,16 +446,29 @@ sub update_src_pointers ($) {
|
|||||||
# Returns the value of a configuration token.
|
# Returns the value of a configuration token.
|
||||||
################################################################################
|
################################################################################
|
||||||
sub copy_xml_file ($$) {
|
sub copy_xml_file ($$) {
|
||||||
my ($conf, $file) = @_;
|
my ($conf, $fullpath_file, $file) = @_;
|
||||||
|
|
||||||
my $server_ip = get_conf_token ($conf, 'server_ip', '');
|
my $server_ip = get_conf_token ($conf, 'server_ip', '');
|
||||||
|
my $local_copy = get_conf_token($conf, 'local_copy', 0);
|
||||||
|
|
||||||
|
if ($local_copy) {
|
||||||
|
my $local_dir = get_conf_token($conf, 'local_dir', '/var/spool/pandora/data_in');
|
||||||
|
|
||||||
|
move("$fullpath_file", "$local_dir/$file");
|
||||||
|
}
|
||||||
|
else {
|
||||||
return if ($server_ip eq '');
|
return if ($server_ip eq '');
|
||||||
|
|
||||||
my $server_port = get_conf_token ($conf, 'server_port', '41121');
|
my $server_port = get_conf_token ($conf, 'server_port', '41121');
|
||||||
my $tentacle_opts = get_conf_token ($conf, 'tentacle_opts', '');
|
my $tentacle_opts = get_conf_token ($conf, 'tentacle_opts', '');
|
||||||
|
|
||||||
# Send the file and delete it
|
# Send the file and delete it
|
||||||
`tentacle_client -a $server_ip -p $server_port $tentacle_opts "$file" > /dev/null 2>&1`;
|
`tentacle_client -a $server_ip -p $server_port $tentacle_opts "$fullpath_file" > /dev/null 2>&1`;
|
||||||
|
if ($? != 0) {
|
||||||
|
log_message ($conf, "\tERROR:\tTry to send XML file (" . $file . ") with tentacle\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unlink ($file);
|
unlink ($file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user