Merge branch 'develop' into feature/NewView

This commit is contained in:
m-lopez-f 2015-04-16 16:00:56 +02:00
commit 44128e3570
48 changed files with 62938 additions and 53831 deletions

View File

@ -18,17 +18,14 @@ if ((! file_exists("include/config.php")) || (! is_readable("include/config.php"
exit;
}
// Real start
session_start();
require_once ('include/config.php');
require_once ('include/functions.php');
require_once ('include/functions_db.php');
require_once ('include/auth/mysql.php');
// Real start
if (session_id() == '') {
session_start();
}
// Hash login process
if (isset ($_GET["loginhash"])) {

View File

@ -29,6 +29,8 @@ $id = (int) get_parameter ('id');
$update = (string)get_parameter('update', 0);
$create = (string)get_parameter('create', 0);
$strict_user = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
if ($id) {
$permission = events_check_event_filter_group ($id);
if (!$permission) { // User doesn't have permissions to see this filter
@ -179,15 +181,12 @@ $table->data = array ();
$table->data[0][0] = '<b>'.__('Filter name').'</b>';
$table->data[0][1] = html_print_input_text ('id_name', $id_name, false, 20, 80, true);
$table->data[1][0] = '<b>'.__('Filter group').'</b>' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
$table->data[1][1] = html_print_select_groups($config['id_user'], "EW",
$own_info['is_admin'], 'id_group_filter', $id_group_filter, '', '', -1, true,
false, false);
$table->data[1][0] = '<b>'.__('Save in group').'</b>' . ui_print_help_tip(__('This group will be use to restrict the visibility of this filter with ACLs'), true);
$table->data[1][1] = html_print_select_groups($config['id_user'], "ER", users_can_manage_group_all(), "id_group_filter", $id_group_filter, '', '', -1, true, false, false, '', false, '', false, false, 'id_group_filter', $strict_user);
$table->data[2][0] = '<b>'.__('Group').'</b>';
$table->data[2][1] = html_print_select_groups($config['id_user'], "EW",
users_can_manage_group_all(), 'id_group', $id_group, '', '', -1, true,
false, false);
$table->data[2][1] = html_print_select_groups($config["id_user"], "ER", true,
'id_group', $id_group, '', '', -1, true, false, false, '', false, false, false, false, 'id_group', $strict_user);
$types = get_event_types ();
// Expand standard array to add not_normal (not exist in the array, used only for searches)
@ -236,11 +235,14 @@ $table->data[9][1] = html_print_input_text ('event_view_hr', $event_view_hr, '',
$table->data[10][0] = '<b>' . __('User ack.') . '</b>'. ' ' . ui_print_help_tip (__('Choose between the users who have validated an event. '), true);
# Fix : Only admin user can see all users
$users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all(0));
$table->data[10][1] = html_print_select ($users, "id_user_ack", $id_user_ack, '', __('Any'), 0, true);
if ($strict_user) {
$users = array($config['id_user']=>$config['id_user']);
} else {
$users = users_get_user_users($config['id_user'], "ER", users_can_manage_group_all(0));
}
$table->data[10][1] = html_print_select($users, "id_user_ack", $id_user_ack, '', __('Any'), 0, true);
$repeated_sel[0] = __("All events");
$repeated_sel[1] = __("Group events");
$table->data[11][0] = '<b>' . __('Repeated') . '</b>';
@ -279,6 +281,7 @@ foreach ($tags as $id_tag => $tag) {
$tag_without_temp[$id_tag] = $tag;
}
}
$add_with_tag_disabled = empty($tags_select_with);
$remove_with_tag_disabled = empty($tag_with_temp);
$add_without_tag_disabled = empty($tags_select_without);

View File

@ -101,7 +101,7 @@ if(defined("METACONSOLE"))
$table->width = '100%';
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Filter group');
$table->head[1] = __('Group');
$table->head[2] = __('Event type');
$table->head[3] = __('Event status');
$table->head[4] = __('Severity');

View File

@ -38,7 +38,7 @@ $buttons['view'] = array('active' => false,
$buttons['filter'] = array('active' => false,
'text' => '<a href="index.php?sec=eventos&sec2=godmode/events/events&amp;section=filter&amp;pure='.$config['pure'].'">' .
html_print_image("images/filter_mc.png", true, array ("title" => __('Create filter'))) . '</a>');
html_print_image("images/filter_mc.png", true, array ("title" => __('Filter list'))) . '</a>');
if (check_acl ($config["id_user"], 0, "PM")) {
$buttons['responses'] = array('active' => false,

View File

@ -1555,10 +1555,14 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
//$colors = array(COL_CRITICAL, COL_WARNING, COL_NORMAL, COL_UNKNOWN);
$colors[__('Critical')] = COL_CRITICAL;
$colors[__('Warning')] = COL_WARNING;
$colors[__('Normal')] = COL_NORMAL;
$colors[__('Unknown')] = COL_UNKNOWN;
if ($show_not_init) {
$colors[] = COL_NOTINIT;
$colors[__('Not init')] = COL_NOTINIT;
}
if (array_sum($data) == 0) {

View File

@ -1645,6 +1645,23 @@ function modules_get_agentmodule_data ($id_agent_module, $period,
$values[$key]["agent_name"] = $agent_name;
}
if ($search_in_history_db) {
$datos = array();
foreach ($values as $key => $value) {
$utimestamp[$key] = $value['utimestamp'];
}
array_multisort($utimestamp, SORT_DESC, $values);
foreach ($utimestamp as $key => $utimes) {
$datos[$key] = array('utimestamp'=>$utimes,
'data'=>$values[$key]["data"],
'module_name'=>$values[$key]["module_name"],
'agent_id'=>$values[$key]["agent_id"],
'agent_name'=>$values[$key]["agent_name"]
);
}
$values = $datos;
}
return $values;
}

View File

@ -1103,6 +1103,12 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
$aggregate = $filter['aggregate'];
$unit = $filter['output'];
$interval = $end_date - $start_date;
if (defined ('METACONSOLE')) {
$width = 950;
} else {
$width = 850;
}
$height = 320;
// Process item
switch ($type) {
@ -1119,7 +1125,8 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
if ($interval_length != 0) {
$html .= "&nbsp;<b>" . _('Resolution') . ":</b> $interval_length " . __('seconds');
}
$html .= graph_netflow_aggregate_area ($data, $interval, 850, 320, netflow_format_unit ($unit));
$html .= graph_netflow_aggregate_area ($data, $interval, $width, $height, netflow_format_unit ($unit));
return $html;
}
else if ($output == 'PDF') {
@ -1128,7 +1135,7 @@ function netflow_draw_item ($start_date, $end_date, $interval_length, $type, $fi
if ($interval_length != 0) {
$html .= "&nbsp;<b>" . _('Resolution') . ":</b> $interval_length " . __('seconds');
}
$html .= graph_netflow_aggregate_area ($data, $interval, 850, 320, netflow_format_unit ($unit), 2, true);
$html .= graph_netflow_aggregate_area ($data, $interval, $width, $height, netflow_format_unit ($unit), 2, true);
return $html;
}
else if ($output == 'XML') {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -234,7 +234,7 @@ if (check_acl ($config["id_user"], 0, "EW") || check_acl ($config["id_user"], 0,
$data[0] = __('Filter name') . $jump;
$data[0] .= html_print_input_text ('id_name', '', '', 15, 255, true);
if(defined('METACONSOLE'))
$data[1] = __('Group') . $jump;
$data[1] = __('Save in Group') . $jump;
else
$data[1] = __('Filter group') . $jump;
# Fix : Only admin users can see group ALL

View File

@ -90,6 +90,7 @@ $time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ()));
$connection_name = get_parameter('connection_name', '');
$interval_length = (int) get_parameter('interval_length', 300);
$address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']);
$filter_selected = (int) get_parameter('filter_selected', 0);
// Read buttons
$draw = get_parameter('draw_button', '');
@ -317,8 +318,9 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
$sql = "SELECT *
FROM tnetflow_filter
WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
echo "<td colspan='3'>" . html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('none'), 0, true) . "</td>";
echo "<td colspan='3'>" . html_print_select_from_sql ($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
html_print_input_hidden("filter_selected", $filter_selected, false);
echo "</td>";
echo "</tr>";
@ -367,8 +369,13 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
echo "</tr>";
echo "<tr class='filter_advance' style='display: none;'>";
echo "<td>" . ui_print_help_icon ('pcap_filter', true, ui_get_full_url(false, false, false, false)) . "</td>";
echo "<td colspan='5'>" . html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true) . "</td>";
if ($netflow_disable_custom_lvfilters) {
echo "<td></td>";
echo "<td></td>";
} else {
echo "<td>" . ui_print_help_icon ('pcap_filter', true, ui_get_full_url(false, false, false, false)) . "</td>";
echo "<td colspan='5'>" . html_print_textarea ('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true) . "</td>";
}
echo "</tr>";
echo "<tr>";
@ -411,9 +418,17 @@ echo'</form>';
if ($draw != '') {
// Draw
echo "<br/>";
// No filter selected
if ($netflow_disable_custom_lvfilters && $filter_selected == 0) {
ui_print_error_message(__('No filter selected'));
}
// Draw the netflow chart
else {
echo netflow_draw_item ($start_date, $end_date,
$interval_length, $chart_type, $filter,
$max_aggregates, $connection_name, 'HTML', $address_resolution);
}
}
enterprise_hook('close_meta_frame');
@ -482,6 +497,7 @@ ui_include_time_picker();
// Check right filter type
$("#radiobtn0001").attr("checked", "checked");
$("#hidden-filter_selected").val(0);
$("#text-ip_dst").val('');
$("#text-ip_src").val('');
$("#text-dst_port").val('');
@ -496,6 +512,7 @@ ui_include_time_picker();
}
else {
// Load fields from DB
$("#hidden-filter_selected").val(1);
// Get filter type
<?php

View File

@ -104,15 +104,21 @@ sub pandora_startup () {
pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH);
# Load servers
pandora_reset_server (\%Config, $DBH);
push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::ReconServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::SNMPServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::WMIServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PluginServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PredictionServer (\%Config, $DBH));
if ($Config{"license_type"} != METACONSOLE_LICENSE) {
pandora_reset_server (\%Config, $DBH);
push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::ReconServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::SNMPServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::WMIServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PluginServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PredictionServer (\%Config, $DBH));
} else {
# Metaconsole service modules are run by the prediction server
push (@Servers, new PandoraFMS::PredictionServer (\%Config, $DBH));
}
# There are enterprise metaconsole servers!
enterprise_hook('load_enterprise_servers', [\@Servers, \%Config, $DBH]);
# Start the netflow daemon if necessary

View File

@ -56,6 +56,7 @@ our @EXPORT = qw(
EVENTSERVER
ICMPSERVER
SNMPSERVER
METACONSOLE_LICENSE
$DEVNULL
cron_get_closest_in_range
cron_next_execution
@ -106,6 +107,9 @@ use constant EVENTSERVER => 10;
use constant ICMPSERVER => 11;
use constant SNMPSERVER => 12;
# Value for a metaconsole license type
use constant METACONSOLE_LICENSE => 0x01;
# /dev/null
our $DEVNULL = ($^O eq 'MSWin32') ? '/Nul' : '/dev/null';