Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop
This commit is contained in:
commit
69bc104b99
|
@ -982,7 +982,7 @@ class Tree {
|
|||
$sql = $this->getSql($item_for_count);
|
||||
if (empty($sql))
|
||||
return array();
|
||||
|
||||
|
||||
$data = db_process_sql($sql);
|
||||
if (empty($data))
|
||||
return array();
|
||||
|
@ -1141,6 +1141,16 @@ class Tree {
|
|||
if (defined("METACONSOLE") && !empty($server)) {
|
||||
$processed_item['serverID'] = $server['id'];
|
||||
}
|
||||
|
||||
// Get the counters of the group (special case)
|
||||
if ($processed_item['type'] == 'group') {
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$counters = array();
|
||||
if (isset($item['total_unknown_count']))
|
||||
|
@ -1158,8 +1168,8 @@ class Tree {
|
|||
if (isset($item['total_fired_count']))
|
||||
$counters['alerts'] = $item['total_fired_count'];
|
||||
|
||||
// Get the children of the group (special case)
|
||||
if ($processed_item['type'] == 'group') {
|
||||
|
||||
$children = $this->getGroupsChildren($items, $items_tmp, $item['id'], $server, $remove_empty);
|
||||
if (!empty($children)) {
|
||||
$processed_item['children'] = $children;
|
||||
|
@ -1960,13 +1970,6 @@ class Tree {
|
|||
foreach ($items as $key => $item) {
|
||||
if (empty($item['parent'])) {
|
||||
|
||||
$counters = $this->getCounters($item['id']);
|
||||
if (!empty($counters)) {
|
||||
foreach ($counters as $type => $value) {
|
||||
$item[$type] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
unset($items[$key]);
|
||||
$items_tmp = array();
|
||||
$processed_item = $this->getProcessedItem($item, false, $items, $items_tmp, true);
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -8,14 +8,14 @@ msgstr ""
|
|||
"Project-Id-Version: pandora-el\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-05-26 09:46+0200\n"
|
||||
"PO-Revision-Date: 2012-03-15 17:08+0000\n"
|
||||
"PO-Revision-Date: 2015-06-29 18:38+0000\n"
|
||||
"Last-Translator: Minas Salapatas <msalap@gmail.com>\n"
|
||||
"Language-Team: Greek <el@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2015-05-26 07:58+0000\n"
|
||||
"X-Generator: Launchpad (build 17514)\n"
|
||||
"X-Launchpad-Export-Date: 2015-06-30 14:01+0000\n"
|
||||
"X-Generator: Launchpad (build 17578)\n"
|
||||
"Language: el\n"
|
||||
|
||||
#: ../../godmode/groups/configure_group.php:68
|
||||
|
@ -20237,171 +20237,3 @@ msgstr ""
|
|||
#: ../../include/get_file.php:54
|
||||
msgid "File is missing in disk storage. Please contact the administrator."
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Id"
|
||||
#~ msgstr "Ταυτότητα (ID)"
|
||||
|
||||
#~ msgid "Settings"
|
||||
#~ msgstr "Ρυθμίσεις"
|
||||
|
||||
#~ msgid "Development"
|
||||
#~ msgstr "Ανάπτυξη εφαρμογών"
|
||||
|
||||
#~ msgid "preview"
|
||||
#~ msgstr "Προεπισκόπηση"
|
||||
|
||||
#~ msgid "Factor"
|
||||
#~ msgstr "Συντελεστής"
|
||||
|
||||
#~ msgid "Up"
|
||||
#~ msgstr "Επάνω"
|
||||
|
||||
#~ msgid "Master"
|
||||
#~ msgstr "Πρωτεύων"
|
||||
|
||||
#~ msgid "hour"
|
||||
#~ msgstr "ώρα"
|
||||
|
||||
#~ msgid "day"
|
||||
#~ msgstr "ημέρα"
|
||||
|
||||
#~ msgid "week"
|
||||
#~ msgstr "εβδομάδα"
|
||||
|
||||
#~ msgid "month"
|
||||
#~ msgstr "μήνας"
|
||||
|
||||
#~ msgid "Del"
|
||||
#~ msgstr "Del"
|
||||
|
||||
#~ msgid "Oper"
|
||||
#~ msgstr "Oper"
|
||||
|
||||
#~ msgid "S"
|
||||
#~ msgstr "Σ"
|
||||
|
||||
#~ msgid "Info"
|
||||
#~ msgstr "Πληροφορίες"
|
||||
|
||||
#~ msgid "Load"
|
||||
#~ msgstr "Φόρτος"
|
||||
|
||||
#~ msgid "SNMP server"
|
||||
#~ msgstr "Εξυπηρετητής SNMP"
|
||||
|
||||
#~ msgid "Seconds"
|
||||
#~ msgstr "Δευτερόλεπτα"
|
||||
|
||||
#~ msgid "from"
|
||||
#~ msgstr "από"
|
||||
|
||||
#~ msgid " to "
|
||||
#~ msgstr " με "
|
||||
|
||||
#~ msgid "minute"
|
||||
#~ msgstr "λεπτό"
|
||||
|
||||
#~ msgid "Group name"
|
||||
#~ msgstr "Όνομα ομάδας"
|
||||
|
||||
#~ msgid "Last name"
|
||||
#~ msgstr "Επώνυμο:"
|
||||
|
||||
#~ msgid "First name"
|
||||
#~ msgstr "Όνομα:"
|
||||
|
||||
#, php-format
|
||||
#~ msgid "%d hour"
|
||||
#~ msgstr "%d ώρα"
|
||||
|
||||
#, php-format
|
||||
#~ msgid "%d weeks"
|
||||
#~ msgstr "%d εβδομάδες"
|
||||
|
||||
#, php-format
|
||||
#~ msgid "%d week"
|
||||
#~ msgstr "%d εβδομάδα"
|
||||
|
||||
#, php-format
|
||||
#~ msgid "%d day"
|
||||
#~ msgstr "%d ημέρα"
|
||||
|
||||
#~ msgid "Autorefresh"
|
||||
#~ msgstr "Αυτόματη ανανέωση"
|
||||
|
||||
#~ msgid "No news articles at this moment"
|
||||
#~ msgstr "Δεν υπάρχουν νέα άρθρα για την ώρα"
|
||||
|
||||
#~ msgid "Your IP"
|
||||
#~ msgstr "Η διευθυνση IP σας"
|
||||
|
||||
#~ msgid "Users defined"
|
||||
#~ msgstr "Καθορίστηκαν χρήστες"
|
||||
|
||||
#~ msgid "Visual map wizard"
|
||||
#~ msgstr "Βοηθός οπτικού χάρτη"
|
||||
|
||||
#~ msgid "Image size (px)"
|
||||
#~ msgstr "Μέγεθος εικόνας"
|
||||
|
||||
#~ msgid "Image range (px)"
|
||||
#~ msgstr "Εύρος εικόνας"
|
||||
|
||||
#~ msgid "There was a problem creating reporting"
|
||||
#~ msgstr "Υπήρξε πρόβλημα στην δημιουργία της αναφοράς"
|
||||
|
||||
#~ msgid "Reporting successfully created"
|
||||
#~ msgstr "Η αναφορά δημιουργήθηκε επιτυχώς"
|
||||
|
||||
#~ msgid ""
|
||||
#~ "This is the Web Management System for Pandora FMS. From here you can manage "
|
||||
#~ "its agents, alerts and incidents. Session is open while activity exists."
|
||||
#~ msgstr ""
|
||||
#~ "Αυτο είναι το Σύστημα ηλεκτρονικής διαχείρησης για την Pandora FMS. Από εδώ "
|
||||
#~ "μπορείτε να διαχειριστείτε τους πράκτορες, τις προειδοποιησεις και τα "
|
||||
#~ "συμβάντα. Η συνεδρία είναι ενεργή όσο υπάρχει δραστηριότητα."
|
||||
|
||||
#~ msgid "Alerts defined"
|
||||
#~ msgstr "Ορίστηκαν οι προειδοποιήσεις"
|
||||
|
||||
#~ msgid "Map builder"
|
||||
#~ msgstr "Σχεδιαστής χάρτη"
|
||||
|
||||
#~ msgid "No layout with this id found"
|
||||
#~ msgstr "Δε βρέθηκε διάταξη με αυτή την ταυτότητα"
|
||||
|
||||
#~ msgid "There was a problem creating SLA"
|
||||
#~ msgstr "Παρουσιάστηκε πρόβλημα στη δημιουργία του SLA"
|
||||
|
||||
#~ msgid "SLA was successfully created"
|
||||
#~ msgstr "το SLA δημιουργήθηκε επιτυχώς"
|
||||
|
||||
#~ msgid "SLA was successfully delete"
|
||||
#~ msgstr "To SLA διαγράφθηκε επιτυχώς"
|
||||
|
||||
#~ msgid "SLAs defined"
|
||||
#~ msgstr "Τα SLAs δημιοργήθηκαν"
|
||||
|
||||
#~ msgid "There was a problem deleting SLA"
|
||||
#~ msgstr "Παρουσιάστηκε πρόβλημα κατά τη διαγραφή του SLA"
|
||||
|
||||
#~ msgid "Label color"
|
||||
#~ msgstr "Χρώμα ετικέτας"
|
||||
|
||||
#~ msgid "Older"
|
||||
#~ msgstr "Παλαιότερο"
|
||||
|
||||
#~ msgid "You are"
|
||||
#~ msgstr "Είστε"
|
||||
|
||||
#~ msgid "Monitors critical"
|
||||
#~ msgstr "Κρίσιμες Παρακολουθήσεις"
|
||||
|
||||
#~ msgid "Monitors normal"
|
||||
#~ msgstr "κανονικές Οθόνες"
|
||||
|
||||
#~ msgid "Monitors warning"
|
||||
#~ msgstr "Οθόνες προειδοποίησης"
|
||||
|
||||
#~ msgid "Monitors unknown"
|
||||
#~ msgstr "Αγνωστες οθόνες"
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -42,7 +42,7 @@ if ($add_networkmap) {
|
|||
// $networkmap_read = check_acl ($config['id_user'], 0, "MR");
|
||||
$networkmap_write = check_acl ($config['id_user'], 0, "MW");
|
||||
$networkmap_manage = check_acl ($config['id_user'], 0, "MM");
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to accessnode graph builder");
|
||||
|
@ -151,7 +151,7 @@ else if ($delete_networkmap || $save_networkmap || $update_networkmap) {
|
|||
$networkmap_write = check_acl ($config['id_user'], $store_group, "MW");
|
||||
if (!isset($networkmap_manage))
|
||||
$networkmap_manage = check_acl ($config['id_user'], $store_group, "MM");
|
||||
|
||||
|
||||
if (!$networkmap_write && !$networkmap_manage) {
|
||||
db_pandora_audit("ACL Violation",
|
||||
"Trying to accessnode graph builder");
|
||||
|
|
|
@ -213,25 +213,30 @@ if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != E
|
|||
|
||||
// Metaconsole fitlers
|
||||
if ($meta) {
|
||||
$enabled_nodes = db_get_all_rows_sql('
|
||||
SELECT id
|
||||
FROM tmetaconsole_setup
|
||||
WHERE disabled = 0');
|
||||
|
||||
if (empty($enabled_nodes)) {
|
||||
$sql_post .= ' AND 1 = 0';
|
||||
}
|
||||
else {
|
||||
$enabled_nodes_id = array();
|
||||
foreach ($enabled_nodes as $en) {
|
||||
$enabled_nodes_id[] = $en['id'];
|
||||
}
|
||||
$sql_post .= ' AND server_id IN (' .
|
||||
implode(',',$enabled_nodes_id) . ')';
|
||||
}
|
||||
|
||||
if ($server_id) {
|
||||
$sql_post .= " AND server_id = " . $server_id;
|
||||
} else {
|
||||
$enabled_nodes = db_get_all_rows_sql('
|
||||
SELECT id
|
||||
FROM tmetaconsole_setup
|
||||
WHERE disabled = 0');
|
||||
|
||||
if (empty($enabled_nodes)) {
|
||||
$sql_post .= ' AND 1 = 0';
|
||||
}
|
||||
else {
|
||||
if ($strict_user == 1) {
|
||||
$enabled_nodes_id = array();
|
||||
} else {
|
||||
$enabled_nodes_id = array(0);
|
||||
}
|
||||
foreach ($enabled_nodes as $en) {
|
||||
$enabled_nodes_id[] = $en['id'];
|
||||
}
|
||||
$sql_post .= ' AND server_id IN (' .
|
||||
implode(',',$enabled_nodes_id) . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -48,31 +48,31 @@ if (!$strict_acl) {
|
|||
html_print_image("images/tag.png", true,
|
||||
array("title" => __('Tags'))) . "</a>",
|
||||
'active' => ($tab == "tag"));
|
||||
|
||||
|
||||
$tabs['os'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "os") . "'>" .
|
||||
html_print_image("images/operating_system.png", true,
|
||||
array("title" => __('OS'))) . "</a>",
|
||||
'active' => ($tab == "os"));
|
||||
|
||||
|
||||
$tabs['group'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "group") . "'>" .
|
||||
html_print_image("images/group.png", true,
|
||||
array("title" => __('Groups'))) . "</a>",
|
||||
'active' => ($tab == "group"));
|
||||
|
||||
|
||||
$tabs['module_group'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "module_group") . "'>" .
|
||||
html_print_image("images/module_group.png", true,
|
||||
array("title" => __('Module groups'))) . "</a>",
|
||||
'active' => ($tab == "module_group"));
|
||||
|
||||
|
||||
$tabs['module'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "module") . "'>" .
|
||||
html_print_image("images/brick.png", true,
|
||||
array("title" => __('Modules'))) . "</a>",
|
||||
'active' => ($tab == "module"));
|
||||
|
||||
|
||||
if ($enterpriseEnable) {
|
||||
$tabs['policies'] = array(
|
||||
'text' => "<a href='" . sprintf($url, "policies") . "'>" .
|
||||
|
@ -111,7 +111,7 @@ switch ($tab) {
|
|||
if (!defined('METACONSOLE')) {
|
||||
if (!$strict_acl)
|
||||
$header_title = $header_title ." - ". $header_sub_title;
|
||||
|
||||
|
||||
ui_print_page_header($header_title, "images/extensions.png", false, "", false, $tabs);
|
||||
}
|
||||
// ---------------------Tabs -------------------------------------------
|
||||
|
@ -142,7 +142,7 @@ if (defined('METACONSOLE'))
|
|||
$row[] = html_print_input_text("search_agent", $search_agent, '', 70, 30, true);
|
||||
else
|
||||
$row[] = html_print_input_text("search_agent", $search_agent, '', 40, 30, true);
|
||||
|
||||
|
||||
// Button
|
||||
$row[] = html_print_submit_button(__('Filter'), "uptbutton", false, 'class="sub search"', true);
|
||||
$table->rowspan[][count($row)-1] = 2;
|
||||
|
@ -158,13 +158,13 @@ if (!defined('METACONSOLE')) {
|
|||
$module_status_arr[AGENT_MODULE_STATUS_CRITICAL_BAD] = __('Critical');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_UNKNOWN] = __('Unknown');
|
||||
$module_status_arr[AGENT_MODULE_STATUS_NOT_INIT] = __('Not init');
|
||||
|
||||
|
||||
$row = array();
|
||||
$row[] = __('Module status');
|
||||
$row[] = html_print_select($module_status_arr, "status_module", $status_module, '', '', 0, true);
|
||||
$row[] = __('Search module');
|
||||
$row[] = html_print_input_text("search_module", $search_module, '', 40, 30, true);
|
||||
|
||||
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ enterprise_hook('close_meta_frame');
|
|||
// Clear the tree
|
||||
if (typeof treeController.recipient != 'undefined' && treeController.recipient.length > 0)
|
||||
treeController.recipient.empty();
|
||||
|
||||
|
||||
$(".loading_tree").show();
|
||||
|
||||
var parameters = {};
|
||||
|
@ -315,14 +315,14 @@ enterprise_hook('close_meta_frame');
|
|||
dataType: "json"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Show the modal window of an module
|
||||
var moduleDetailsWindow = $("<div></div>");
|
||||
moduleDetailsWindow
|
||||
.hide()
|
||||
.prop("id", "module_details_window")
|
||||
.appendTo('body');
|
||||
|
||||
|
||||
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
|
||||
var params = {};
|
||||
var f = new Date();
|
||||
|
@ -401,7 +401,7 @@ enterprise_hook('close_meta_frame');
|
|||
secondText: '<?php echo __('Second');?>',
|
||||
currentText: '<?php echo __('Now');?>',
|
||||
closeText: '<?php echo __('Close');?>'});
|
||||
|
||||
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
|
@ -423,5 +423,5 @@ enterprise_hook('close_meta_frame');
|
|||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
|
|
@ -658,6 +658,7 @@ CREATE TABLE IF NOT EXISTS `tmodule_group` (
|
|||
-- ----------------------------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `tmodule_relationship` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_rt` int(10) unsigned NOT NULL DEFAULT 0,
|
||||
`module_a` int(10) unsigned NOT NULL,
|
||||
`module_b` int(10) unsigned NOT NULL,
|
||||
`disable_update` tinyint(1) unsigned NOT NULL default '0',
|
||||
|
@ -665,6 +666,8 @@ CREATE TABLE IF NOT EXISTS `tmodule_relationship` (
|
|||
FOREIGN KEY (`module_a`) REFERENCES tagente_modulo(`id_agente_modulo`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`module_b`) REFERENCES tagente_modulo(`id_agente_modulo`)
|
||||
ON DELETE CASCADE,
|
||||
FOREIGN KEY (`id_rt`) REFERENCES trecon_task(`id_rt`)
|
||||
ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ sub pandora_startup () {
|
|||
pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH);
|
||||
|
||||
# Load servers
|
||||
if (!defined($Config{"license_type"}) || $Config{"license_type"} != METACONSOLE_LICENSE) {
|
||||
if (!is_metaconsole(\%Config)) {
|
||||
pandora_reset_server (\%Config, $DBH);
|
||||
push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH));
|
||||
push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH));
|
||||
|
|
|
@ -2856,9 +2856,10 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
$id_alert_am, $id_agentmodule, $event_type, $event_status, $dbh,
|
||||
$source, $user_name, $comment, $id_extra, $tags,
|
||||
$critical_instructions, $warning_instructions, $unknown_instructions, $custom_data) = @_;
|
||||
|
||||
my $event_table = is_metaconsole($pa_config) ? 'tmetaconsole_event' : 'tevento';
|
||||
|
||||
my $agent = undef;
|
||||
if ($id_agente != 0) {
|
||||
if (defined($id_agente) && $id_agente != 0) {
|
||||
$agent = get_db_single_row ($dbh, 'SELECT * FROM tagente WHERE id_agente = ?', $id_agente);
|
||||
if (defined ($agent) && $agent->{'quiet'} == 1) {
|
||||
logger($pa_config, "Generate Event. The agent '" . $agent->{'nombre'} . "' is in quiet mode.", 10);
|
||||
|
@ -2867,7 +2868,7 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
}
|
||||
|
||||
my $module = undef;
|
||||
if ($id_agentmodule != 0) {
|
||||
if (defined($id_agentmodule) && $id_agentmodule != 0) {
|
||||
$module = get_db_single_row ($dbh, 'SELECT * FROM tagente_modulo WHERE id_agente_modulo = ?', $id_agentmodule);
|
||||
if (defined ($module) && $module->{'quiet'} == 1) {
|
||||
logger($pa_config, "Generate Event. The module '" . $module->{'nombre'} . "' is in quiet mode.", 10);
|
||||
|
@ -2912,12 +2913,12 @@ sub pandora_event ($$$$$$$$$$;$$$$$$$$$) {
|
|||
# Validate events with the same event id
|
||||
if (defined ($id_extra) && $id_extra ne '') {
|
||||
logger($pa_config, "Updating events with extended id '$id_extra'.", 10);
|
||||
db_do ($dbh, 'UPDATE tevento SET estado = 1, ack_utimestamp = ? WHERE estado = 0 AND id_extra=?', $utimestamp, $id_extra);
|
||||
db_do ($dbh, 'UPDATE ' . $event_table . ' SET estado = 1, ack_utimestamp = ? WHERE estado = 0 AND id_extra=?', $utimestamp, $id_extra);
|
||||
}
|
||||
|
||||
# Create the event
|
||||
logger($pa_config, "Generating event '$evento' for agent ID $id_agente module ID $id_agentmodule.", 10);
|
||||
db_do ($dbh, 'INSERT INTO tevento (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data)
|
||||
db_do ($dbh, 'INSERT INTO ' . $event_table . ' (id_agente, id_grupo, evento, timestamp, estado, utimestamp, event_type, id_agentmodule, id_alert_am, criticity, user_comment, tags, source, id_extra, id_usuario, critical_instructions, warning_instructions, unknown_instructions, ack_utimestamp, custom_data)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', $id_agente, $id_grupo, safe_input ($evento), $timestamp, $event_status, $utimestamp, $event_type, $id_agentmodule, $id_alert_am, $severity, $comment, $module_tags, $source, $id_extra, $user_name, $critical_instructions, $warning_instructions, $unknown_instructions, $ack_utimestamp, $custom_data);
|
||||
|
||||
# Do not write to the event file
|
||||
|
|
|
@ -71,6 +71,7 @@ our @EXPORT = qw(
|
|||
float_equal
|
||||
sqlWrap
|
||||
is_numeric
|
||||
is_metaconsole
|
||||
clean_blank
|
||||
pandora_sendmail
|
||||
pandora_trash_ascii
|
||||
|
@ -1375,6 +1376,19 @@ sub valid_regex ($) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
# Returns 1 if a valid metaconsole license is configured, 0 otherwise.
|
||||
###############################################################################
|
||||
sub is_metaconsole ($) {
|
||||
my ($pa_config) = @_;
|
||||
|
||||
if (defined($pa_config->{"license_type"}) && $pa_config->{"license_type"} == METACONSOLE_LICENSE) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
# End of function declaration
|
||||
# End of defined Code
|
||||
|
||||
|
|
|
@ -89,6 +89,9 @@ my %SWITCH_TO_SWITCH;
|
|||
# MAC addresses.
|
||||
my %MAC;
|
||||
|
||||
# Parent-child relationships (in Pandora).
|
||||
my %PARENTS;
|
||||
|
||||
# Entry router.
|
||||
my $ROUTER;
|
||||
|
||||
|
@ -461,6 +464,8 @@ sub arp_cache_discovery {
|
|||
foreach my $line (@output) {
|
||||
next unless ($line =~ /^$IPNETTOMEDIAPHYSADDRESS.\d+.(\S+)\s+=\s+\S+:\s+(.*)$/);
|
||||
my ($ip_addr, $mac_addr) = ($1, $2);
|
||||
next if ($ip_addr =~ m/\.255$|\.0$|127\.0\.0\.1$/);
|
||||
|
||||
$mac_addr = parse_mac($mac_addr);
|
||||
|
||||
# Save the mac to connect hosts to switches/routers.
|
||||
|
@ -497,6 +502,8 @@ sub find_synonyms($$$) {
|
|||
# Get ARP cache.
|
||||
my @ip_addresses = snmp_get_value_array($device, $community, $IPENTADDR);
|
||||
foreach my $ip_address (@ip_addresses) {
|
||||
next if ($ip_address =~ m/\.255$|\.0$|127\.0\.0\.1$/);
|
||||
|
||||
$VISITED_DEVICES{$device}->{'addr'}->{$ip_address} = '';
|
||||
|
||||
# Link the two addresses.
|
||||
|
@ -737,7 +744,6 @@ sub host_connectivity($) {
|
|||
next unless ($device_if_name ne '');
|
||||
my $host_if_name = defined($COMMUNITIES{$host}) ? get_if_from_mac($host, $COMMUNITIES{$host}, $mac) : '';
|
||||
if ($VISITED_DEVICES{$device}->{'type'} eq 'router') {
|
||||
next if defined ($SWITCH_TO_SWITCH{"$device$device_if_name"}); # The switch is probably connected to another router/switch.
|
||||
message("Host $host " . ($host_if_name ne '' ? "(if $host_if_name)" : '') . " is connected to router $device (if $device_if_name).");
|
||||
}
|
||||
elsif ($VISITED_DEVICES{$device}->{'type'} eq 'switch') {
|
||||
|
@ -792,7 +798,7 @@ sub create_pandora_agent($) {
|
|||
# Assign the new address to the agent
|
||||
my $agent_addr_id = get_agent_addr_id ($DBH, $addr_id, $agent_id);
|
||||
if ($agent_addr_id <= 0) {
|
||||
db_do ($DBH, 'INSERT INTO taddress_agent (id_a, id_agent)
|
||||
db_do ($DBH, 'INSERT INTO taddress_agent (`id_a`, `id_agent`)
|
||||
VALUES (?, ?)', $addr_id, $agent_id);
|
||||
}
|
||||
}
|
||||
|
@ -881,12 +887,34 @@ sub create_pandora_agent($) {
|
|||
return $agent_id;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Check for switches that are connected to other switches/routers and show
|
||||
# up in a switche/router's port.
|
||||
##########################################################################
|
||||
sub switch_already_connected ($$$$) {
|
||||
my ($dev_1, $if_1, $dev_2, $if_2) = @_;
|
||||
|
||||
if ($VISITED_DEVICES{$dev_1}->{'type'} eq 'router' ||
|
||||
$VISITED_DEVICES{$dev_1}->{'type'} eq 'switch') {
|
||||
return 1 if defined ($SWITCH_TO_SWITCH{"$dev_1$if_1"}); # The switch is probably connected to another router/switch.
|
||||
}
|
||||
elsif ($VISITED_DEVICES{$dev_2}->{'type'} eq 'router' ||
|
||||
$VISITED_DEVICES{$dev_2}->{'type'} eq 'switch') {
|
||||
return 1 if defined ($SWITCH_TO_SWITCH{"$dev_2$if_2"}); # The switch is probably connected to another router/switch.
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
##########################################################################
|
||||
# Connect the given devices in the Pandora FMS database.
|
||||
##########################################################################
|
||||
sub connect_pandora_agents($$$$) {
|
||||
my ($dev_1, $if_1, $dev_2, $if_2) = @_;
|
||||
|
||||
# Check switch connectivy.
|
||||
return if (switch_already_connected($dev_1, $if_1, $dev_2, $if_2) == 1);
|
||||
|
||||
# Get the agent for the first device.
|
||||
my $agent_1 = get_agent_from_addr($DBH, $dev_1);
|
||||
if (!defined($agent_1)) {
|
||||
|
@ -901,7 +929,7 @@ sub connect_pandora_agents($$$$) {
|
|||
}
|
||||
return unless defined($agent_2);
|
||||
|
||||
# Check wether the modules exists.
|
||||
# Check whether the modules exists.
|
||||
my $module_name_1 = safe_input($if_1 eq '' ? 'ping' : "ifOperStatus_$if_1");
|
||||
my $module_name_2 = safe_input($if_2 eq '' ? 'ping' : "ifOperStatus_$if_2");
|
||||
my $module_id_1 = get_agent_module_id($DBH, $module_name_1, $agent_1->{'id_agente'});
|
||||
|
@ -915,6 +943,13 @@ sub connect_pandora_agents($$$$) {
|
|||
return;
|
||||
}
|
||||
|
||||
# Make sure the modules are not already connected.
|
||||
if (defined($CONNECTIONS{"${module_id_1}_${module_id_2}"}) ||
|
||||
defined($CONNECTIONS{"${module_id_2}_${module_id_1}"})) {
|
||||
message("Devices $dev_1 and $dev_2 are already connected.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Mark the two devices as connected.
|
||||
$CONNECTIONS{"${module_id_1}_${module_id_2}"} = 1;
|
||||
if (ref($VISITED_DEVICES{$dev_1}) eq 'HASH') {
|
||||
|
@ -935,7 +970,13 @@ sub connect_pandora_agents($$$$) {
|
|||
}
|
||||
|
||||
# Update parents.
|
||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'});
|
||||
if (!defined($PARENTS{$agent_2->{'id_agente'}})) {
|
||||
$PARENTS{$agent_2->{'id_agente'}} = $agent_1->{'id_agente'};
|
||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_1->{'id_agente'}, $agent_2->{'id_agente'});
|
||||
} elsif (!defined($PARENTS{$agent_1->{'id_agente'}})) {
|
||||
$PARENTS{$agent_1->{'id_agente'}} = $agent_2->{'id_agente'};
|
||||
db_do($DBH, 'UPDATE tagente SET id_parent=? WHERE id_agente=?', $agent_2->{'id_agente'}, $agent_1->{'id_agente'});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1059,7 +1100,7 @@ pandora_load_config(\%CONF);
|
|||
pandora_start_log(\%CONF);
|
||||
|
||||
# Connect to the DB
|
||||
$DBH = db_connect ($CONF{'dbengine'}, $CONF{'dbname'}, $CONF{'dbhost'}, $CONF{'dbport'}, $CONF{'dbuser'}, $CONF{'dbpass'});
|
||||
$DBH = db_connect ('mysql', $CONF{'dbname'}, $CONF{'dbhost'}, $CONF{'dbport'}, $CONF{'dbuser'}, $CONF{'dbpass'});
|
||||
|
||||
# 0%
|
||||
update_recon_task($DBH, $TASK_ID, 1);
|
||||
|
@ -1131,12 +1172,35 @@ for (my $i = 0; defined($ROUTERS[$i]); $i++) {
|
|||
update_recon_task($DBH, $TASK_ID, 75);
|
||||
|
||||
# Find switch/router to host connections.
|
||||
my @hosts = (@ROUTERS, @SWITCHES, @HOSTS);
|
||||
message("[6/6] Finding switch/router to end host connectivity...");
|
||||
foreach my $device (@ROUTERS, @SWITCHES, @HOSTS) {
|
||||
foreach my $device (@hosts) {
|
||||
host_connectivity($device);
|
||||
}
|
||||
foreach my $host (@HOSTS) {
|
||||
next unless (ref($VISITED_DEVICES{$host}) eq 'HASH'); # Skip aliases.
|
||||
|
||||
# Retry all known connectivity methods by brute force.
|
||||
for (my $i = 0; defined($hosts[$i]); $i++) {
|
||||
my $switch_1 = $hosts[$i];
|
||||
for (my $j = $i + 1; defined($hosts[$j]); $j++) {
|
||||
my $switch_2 = $hosts[$j];
|
||||
switch_to_switch_connectivity($switch_1, $switch_2) if ($switch_1 ne $switch_2);
|
||||
}
|
||||
}
|
||||
foreach my $router (@hosts) {
|
||||
foreach my $switch (@hosts) {
|
||||
router_to_switch_connectivity($router, $switch) if ($router ne $switch);
|
||||
}
|
||||
}
|
||||
for (my $i = 0; defined($hosts[$i]); $i++) {
|
||||
my $router_1 = $hosts[$i];
|
||||
for (my $j = $i + 1; defined($hosts[$j]); $j++) {
|
||||
my $router_2 = $hosts[$j];
|
||||
router_to_router_connectivity($router_1, $router_2) if ($router_1 ne $router_2);
|
||||
}
|
||||
}
|
||||
|
||||
# Connect hosts that are still unconnected using traceroute.
|
||||
foreach my $host (@hosts) {
|
||||
next if ($VISITED_DEVICES{$host}->{'connected'} == 1); # Skip already connected hosts.
|
||||
traceroute_connectivity($host);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue