Rebranding open server

This commit is contained in:
fermin831 2018-05-17 16:12:44 +02:00
parent d8f63e9963
commit cc26124289
11 changed files with 38 additions and 37 deletions

View File

@ -55,7 +55,7 @@ my $MainThread = threads->self;
sub pandora_shutdown () {
my $signal = shift;
logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Caught SIG' . $signal . ' by thread(' . threads->self()->tid() . ')', 10);
logger (\%Config, $Config{'rb_product_name'} . ' Server \'' . $Config{'servername'} . '\' Caught SIG' . $signal . ' by thread(' . threads->self()->tid() . ')', 10);
if (!threads->self->equal($MainThread)) {
# deliver signal to the main thread since no other threads than main thread
@ -63,7 +63,7 @@ sub pandora_shutdown () {
$MainThread->kill($signal);
return;
}
logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' Shutdown by signal ', 1);
logger (\%Config, $Config{'rb_product_name'} . ' Server \'' . $Config{'servername'} . '\' Shutdown by signal ', 1);
# Stop servers
foreach my $server (@Servers) {
@ -103,7 +103,7 @@ sub pandora_startup () {
# Update the agent cache.
threads->create('enterprise_hook', ('update_agent_cache', [\%Config]))->detach() if ($Config{'node_metaconsole'} == 1);
pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH);
pandora_audit (\%Config, $Config{'rb_product_name'} . ' Server Daemon starting', 'SYSTEM', 'System', $DBH);
# Load servers
if (!is_metaconsole(\%Config)) {
@ -197,7 +197,7 @@ sub pandora_crash () {
$full_error .= $error_line;
}
logger (\%Config, 'Pandora FMS Server \'' . $Config{'servername'} . '\' unhandled error.', 1);
logger (\%Config, $Config{'rb_product_name'} . ' Server \'' . $Config{'servername'} . '\' unhandled error.', 1);
# It's interesting show by console problems, not only in logs. This helps
# to solve stupid problems like Database credential problems for example
@ -634,7 +634,7 @@ sub main() {
$server->restartEvent ($@);
}
logger (\%Config, 'Pandora FMS Server restarting (' . $@ . ') in ' . $Config{'restart_delay'} . ' seconds.', 1);
logger (\%Config, $Config{'rb_product_name'} . ' Server restarting (' . $@ . ') in ' . $Config{'restart_delay'} . ' seconds.', 1);
pandora_restart ();
}
elsif (($Config{'auto_restart'} > 0) && (time () - $time_ref > $Config{'auto_restart'})) {
@ -660,7 +660,7 @@ sub main() {
$server->restartEvent ($@);
}
logger (\%Config, 'Pandora FMS Server restarting (' . $@ . ') in 5 seconds.', 1);
logger (\%Config, $Config{'rb_product_name'} . ' Server restarting (' . $@ . ') in 5 seconds.', 1);
pandora_load_config (\%Config);
pandora_restart (5);
}

View File

@ -178,6 +178,12 @@ sub pandora_get_sharedconfig ($$) {
$pa_config->{'include_agents'} = 0;
}
# PandoraFMS product name
$pa_config->{'rb_product_name'} = enterprise_hook(
'pandora_get_product_name',
[$dbh]
);
$pa_config->{'rb_product_name'} = 'Pandora FMS' unless (defined ($pa_config->{'rb_product_name'}) && $pa_config->{'rb_product_name'} ne '');
}
##########################################################################

View File

@ -605,13 +605,13 @@ sub pandora_process_alert ($$$$$$$$;$) {
pandora_event ($pa_config, "Alert ceased (" .
safe_output($alert->{'name'}) . ")", 0, 0, $alert->{'priority'}, $id,
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
"alert_ceased", 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
} else {
pandora_event ($pa_config, "Alert ceased (" .
safe_output($alert->{'name'}) . ")", $agent->{'id_grupo'},
$agent->{'id_agente'}, $alert->{'priority'}, $id,
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0),
"alert_ceased", 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
"alert_ceased", 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
}
return;
}
@ -844,7 +844,7 @@ sub pandora_execute_alert ($$$$$$$$$;$) {
pandora_event ($pa_config, "Alert $text (" . safe_output($alert->{'name'}) . ") " . (defined ($module) ? 'assigned to ('. safe_output($module->{'nombre'}) . ")" : ""),
(defined ($agent) ? $agent->{'id_grupo'} : 0), (defined ($agent) ? $agent->{'id_agente'} : 0), $severity, (defined ($alert->{'id_template_module'}) ? $alert->{'id_template_module'} : 0),
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), $event, 0, $dbh, 'Pandora', '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
(defined ($alert->{'id_agent_module'}) ? $alert->{'id_agent_module'} : 0), $event, 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $critical_instructions, $warning_instructions, $unknown_instructions);
}
}
@ -1395,7 +1395,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
# Field 5 (Ticket name)
my $ticket_name = $field5;
if ($ticket_name eq "") {
$ticket_name = "Pandora FMS alert action created by API";
$ticket_name = $pa_config->{'rb_product_name'} . " alert action created by API";
}
# Field 6 (Ticket group ID)
@ -1715,8 +1715,6 @@ sub pandora_planned_downtime_disabled_once_start($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_disabled_once_start\n";
pandora_event ($pa_config,
"(Created by " . $downtime->{'id_user'} . ") Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
@ -2191,7 +2189,6 @@ sub pandora_planned_downtime_weekly_start($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 1
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_weekly_start\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." started planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
@ -2306,8 +2303,6 @@ sub pandora_planned_downtime_weekly_stop($$) {
db_do($dbh, 'UPDATE tplanned_downtime
SET executed = 0
WHERE id = ?', $downtime->{'id'});
print"pandora_planned_downtime_weekly_stop\n";
pandora_event ($pa_config,
"Server ".$pa_config->{'servername'}." stopped planned downtime: ".safe_output($downtime->{'name'}), 0, 0, 1, 0, 0, 'system', 0, $dbh);
@ -3151,7 +3146,7 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
# Set default values for optional parameters
$source = 'Pandora' unless defined ($source);
$source = $pa_config->{'rb_product_name'} unless defined ($source);
$comment = '' unless defined ($comment);
$id_extra = '' unless defined ($id_extra);
$user_name = '' unless defined ($user_name);
@ -4165,11 +4160,11 @@ sub generate_status_event ($$$$$$$$) {
# Generate the event
if ($status != 0){
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
} else {
# Self validate this event if has "normal" status
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 1, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
}
}
@ -4692,7 +4687,7 @@ sub pandora_self_monitoring ($$) {
my $xml_output = "";
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='Pandora FMS Server version " . $pa_config->{'version'} . "' agent_name='".$pa_config->{'servername'} . "' agent_alias='".$pa_config->{'servername'} . "' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
$xml_output = "<agent_data os_name='$OS' os_version='$OS_VERSION' version='" . $pa_config->{'version'} . "' description='" . $pa_config->{'rb_product_name'} . " Server version " . $pa_config->{'version'} . "' agent_name='".$pa_config->{'servername'} . "' agent_alias='".$pa_config->{'servername'} . "' interval='".$pa_config->{"self_monitoring_interval"}."' timestamp='".$timestamp."' >";
$xml_output .=" <module>";
$xml_output .=" <name>Status</name>";
$xml_output .=" <type>generic_proc</type>";
@ -4924,7 +4919,7 @@ sub pandora_module_unknown ($$) {
# Are unknown events enabled?
if ($pa_config->{'unknown_events'} == 1) {
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
}
}
# Regular module
@ -4990,7 +4985,7 @@ sub pandora_module_unknown ($$) {
$description = subst_alert_macros ($description, \%macros, $pa_config, $dbh, $agent, $module);
pandora_event ($pa_config, $description, $agent->{'id_grupo'}, $module->{'id_agente'},
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, 'Pandora', '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
$severity, 0, $module->{'id_agente_modulo'}, $event_type, 0, $dbh, $pa_config->{'rb_product_name'}, '', '', '', '', $module->{'critical_instructions'}, $module->{'warning_instructions'}, $module->{'unknown_instructions'});
}
}
}
@ -5444,7 +5439,7 @@ sub pandora_create_integria_ticket ($$$$$$$$$$$) {
$integria_user = "admin";
}
if ($ticket_name eq "") {
$ticket_name = "Ticket created by Pandora FMS";
$ticket_name = "Ticket created by " . $pa_config->{'rb_product_name'};
}
if ($group_id eq "") {
$group_id = 1;

View File

@ -88,7 +88,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS Data Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Data Server.", 1);
$self->setNumThreads ($pa_config->{'dataserver_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}
@ -346,7 +346,7 @@ sub process_xml_data ($$$$$) {
return;
}
} else {
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the pandora_server.conf file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
pandora_event ($pa_config, "Unable to create agent '" . safe_output($agent_name) . "': autocreate_group $group_id does not exist. Edit the server configuration file and change it.", 0, 0, 0, 0, 0, 'error', 0, $dbh);
logger($pa_config, "Group id $group_id does not exist (check autocreate_group config token).", 3);
return;
}

View File

@ -55,8 +55,8 @@ sub new ($$$) {
return undef unless $config->{'networkserver'} == 1;
if (! -e $config->{'snmpget'}) {
logger ($config, ' [E] ' . $config->{'snmpget'} . " needed by Pandora FMS Network Server not found.", 1);
print_message ($config, ' [E] ' . $config->{'snmpget'} . " needed by Pandora FMS Network Server not found.", 1);
logger ($config, ' [E] ' . $config->{'snmpget'} . " needed by " . $config->{'rb_product_name'} . " Network Server not found.", 1);
print_message ($config, ' [E] ' . $config->{'snmpget'} . " needed by " . $config->{'rb_product_name'} . " Network Server not found.", 1);
return undef;
}
@ -80,7 +80,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS Network Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Network Server.", 1);
$self->setNumThreads ($pa_config->{'network_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}

View File

@ -81,7 +81,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS Plugin Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Plugin Server.", 1);
$self->setNumThreads ($pa_config->{'plugin_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}

View File

@ -77,7 +77,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS Prediction Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Prediction Server.", 1);
$self->setNumThreads ($pa_config->{'prediction_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}

View File

@ -65,8 +65,8 @@ sub new ($$$$$$) {
return undef unless $config->{'reconserver'} == 1;
if (! -e $config->{'nmap'}) {
logger ($config, ' [E] ' . $config->{'nmap'} . " needed by Pandora FMS Recon Server not found.", 1);
print_message ($config, ' [E] ' . $config->{'nmap'} . " needed by Pandora FMS Recon Server not found.", 1);
logger ($config, ' [E] ' . $config->{'nmap'} . " needed by " . $config->{'rb_product_name'} . " Recon Server not found.", 1);
print_message ($config, ' [E] ' . $config->{'nmap'} . " needed by " . $config->{'rb_product_name'} . " Recon Server not found.", 1);
return undef;
}
@ -98,7 +98,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS Recon Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " Recon Server.", 1);
$self->setNumThreads ($pa_config->{'recon_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}

View File

@ -115,7 +115,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS SNMP Console.", 2);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " SNMP Console.", 2);
# Set the initial date for storm protection.
$pa_config->{"__storm_ref__"} = time();

View File

@ -445,7 +445,7 @@ sub pandora_sendmail {
my %mail = ( To => $to_address,
Message => $message,
Subject => encode('MIME-Header', $subject),
'X-Mailer' => "Pandora FMS",
'X-Mailer' => $pa_config->{"rb_product_name"},
Smtp => $pa_config->{"mta_address"},
Port => $pa_config->{"mta_port"},
From => $pa_config->{"mta_from"},

View File

@ -54,8 +54,8 @@ sub new ($$;$) {
# Check for a WMI client
if (system ($config->{'wmi_client'} . " >$DEVNULL 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);
logger ($config, ' [E] ' . $config->{'wmi_client'} . " not found. " . $config->{'rb_product_name'} . " WMI Server needs a DCOM/WMI client.", 1);
print_message ($config, ' [E] ' . $config->{'wmi_client'} . " not found. " . $config->{'rb_product_name'} . " WMI Server needs a DCOM/WMI client.", 1);
return undef;
}
@ -79,7 +79,7 @@ sub run ($) {
my $self = shift;
my $pa_config = $self->getConfig ();
print_message ($pa_config, " [*] Starting Pandora FMS WMI Server.", 1);
print_message ($pa_config, " [*] Starting " . $pa_config->{'rb_product_name'} . " WMI Server.", 1);
$self->setNumThreads ($pa_config->{'wmi_threads'});
$self->SUPER::run (\@TaskQueue, \%PendingTasks, $Sem, $TaskSem);
}