2013-04-17 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/WMIServer.pm: Style fix. * lib/PandoraFMS/Core.pm, lib/PandoraFMS/DataServer.pm: Added support for multiple ip addresses. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8001 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
9c91b05353
commit
34516f29bd
|
@ -1,3 +1,11 @@
|
|||
2013-04-17 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* lib/PandoraFMS/WMIServer.pm: Style fix.
|
||||
|
||||
* lib/PandoraFMS/Core.pm,
|
||||
lib/PandoraFMS/DataServer.pm: Added support for multiple ip
|
||||
addresses.
|
||||
|
||||
2013-04-08 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||
|
||||
* util/tentacle_serverd: Tiny improvement. Changed to use
|
||||
|
|
|
@ -2434,11 +2434,9 @@ sub pandora_create_agent ($$$$$$$$$$;$$$$$$$) {
|
|||
##########################################################################
|
||||
# Add an address if not exists and add this address to taddress_agent if not exists
|
||||
##########################################################################
|
||||
sub pandora_add_agent_address ($$$$) {
|
||||
my ($pa_config, $agent_id, $addr, $dbh) = @_;
|
||||
|
||||
my $agent_name = get_agent_name($dbh, $agent_id);
|
||||
|
||||
sub pandora_add_agent_address ($$$$$) {
|
||||
my ($pa_config, $agent_id, $agent_name, $addr, $dbh) = @_;
|
||||
|
||||
# Add the new address if it does not exist
|
||||
my $addr_id = get_addr_id ($dbh, $addr);
|
||||
|
||||
|
|
|
@ -262,8 +262,21 @@ sub process_xml_data ($$$$$) {
|
|||
|
||||
# Get agent address from the XML if available
|
||||
my $address = '' ;
|
||||
$address = $data->{'address'} if (defined ($data->{'address'}));
|
||||
my @address_list;
|
||||
if (defined ($data->{'address'}) && $data->{'address'} ne '') {
|
||||
@address_list = split (',', $data->{'address'});
|
||||
|
||||
# Trim addresses
|
||||
for (my $i = 0; $i <= $#address_list; $i++) {
|
||||
$address_list[$i] =~ s/^\s+|\s+$//g ;
|
||||
}
|
||||
|
||||
# Save the first address as the main address
|
||||
$address = $address_list[0];
|
||||
$address =~ s/^\s+|\s+$//g ;
|
||||
shift (@address_list);
|
||||
}
|
||||
|
||||
# Get agent id
|
||||
my $agent_id = get_agent_id ($dbh, $agent_name);
|
||||
if ($agent_id < 1) {
|
||||
|
@ -294,6 +307,11 @@ sub process_xml_data ($$$$$) {
|
|||
return;
|
||||
}
|
||||
|
||||
# Add the main address to the address list
|
||||
if ($address ne '') {
|
||||
pandora_add_agent_address($pa_config, $agent_id, $agent_name, $address, $dbh);
|
||||
}
|
||||
|
||||
# Process custom fields
|
||||
if(defined($data->{'custom_fields'})) {
|
||||
foreach my $custom_fields (@{$data->{'custom_fields'}}) {
|
||||
|
@ -345,15 +363,16 @@ sub process_xml_data ($$$$$) {
|
|||
}
|
||||
# Learning mode
|
||||
else {
|
||||
|
||||
# Update agent address if necessary
|
||||
|
||||
# Update the main address
|
||||
if ($address ne '' && $address ne $agent->{'direccion'}) {
|
||||
|
||||
# Update the main address
|
||||
pandora_update_agent_address ($pa_config, $agent_id, $agent_name, $address, $dbh);
|
||||
|
||||
# Update the addres list if necessary
|
||||
pandora_add_agent_address($pa_config, $agent_id, $address, $dbh);
|
||||
pandora_add_agent_address($pa_config, $agent_id, $agent_name, $address, $dbh);
|
||||
}
|
||||
|
||||
# Update additional addresses
|
||||
foreach my $address (@address_list) {
|
||||
pandora_add_agent_address($pa_config, $agent_id, $agent_name, $address, $dbh);
|
||||
}
|
||||
|
||||
# Update parent if is allowed and is valid
|
||||
|
|
|
@ -53,7 +53,7 @@ sub new ($$;$) {
|
|||
return undef unless $config->{'wmiserver'} == 1;
|
||||
|
||||
# Check for a WMI client
|
||||
if (system ($config->{'wmi_client'} . ' > /dev/null 2>&1') != 256) {
|
||||
if (system ($config->{'wmi_client'} . ' > /dev/null 2>&1') >> 8 != 1) {
|
||||
logger ($config, ' [E] ' . $config->{'wmi_client'} . " not found. Pandora FMS WMI Server needs a DCOM/WMI client.", 1);
|
||||
print_message ($config, ' [E] ' . $config->{'wmi_client'} . " not found. Pandora FMS WMI Server needs a DCOM/WMI client.", 1);
|
||||
return undef;
|
||||
|
|
Loading…
Reference in New Issue