Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
m-lopez-f 2015-04-16 15:18:28 +02:00
commit 036538baa9
5 changed files with 51 additions and 20 deletions

View File

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

View File

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

View File

@ -90,6 +90,7 @@ $time = get_parameter_post ('time', date (TIME_FORMAT, get_system_time ()));
$connection_name = get_parameter('connection_name', ''); $connection_name = get_parameter('connection_name', '');
$interval_length = (int) get_parameter('interval_length', 300); $interval_length = (int) get_parameter('interval_length', 300);
$address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']); $address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']);
$filter_selected = (int) get_parameter('filter_selected', 0);
// Read buttons // Read buttons
$draw = get_parameter('draw_button', ''); $draw = get_parameter('draw_button', '');
@ -317,8 +318,9 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
$sql = "SELECT * $sql = "SELECT *
FROM tnetflow_filter FROM tnetflow_filter
WHERE id_group IN (".implode(',', array_keys ($user_groups)).")"; 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>"; echo "</tr>";
@ -367,8 +369,13 @@ echo '<form method="post" action="' . $config['homeurl'] . 'index.php?sec=netf&s
echo "</tr>"; echo "</tr>";
echo "<tr class='filter_advance' style='display: none;'>"; echo "<tr class='filter_advance' style='display: none;'>";
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>" . 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 "<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>";
echo "<tr>"; echo "<tr>";
@ -411,9 +418,17 @@ echo'</form>';
if ($draw != '') { if ($draw != '') {
// Draw // Draw
echo "<br/>"; 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, echo netflow_draw_item ($start_date, $end_date,
$interval_length, $chart_type, $filter, $interval_length, $chart_type, $filter,
$max_aggregates, $connection_name, 'HTML', $address_resolution); $max_aggregates, $connection_name, 'HTML', $address_resolution);
}
} }
enterprise_hook('close_meta_frame'); enterprise_hook('close_meta_frame');
@ -482,6 +497,7 @@ ui_include_time_picker();
// Check right filter type // Check right filter type
$("#radiobtn0001").attr("checked", "checked"); $("#radiobtn0001").attr("checked", "checked");
$("#hidden-filter_selected").val(0);
$("#text-ip_dst").val(''); $("#text-ip_dst").val('');
$("#text-ip_src").val(''); $("#text-ip_src").val('');
$("#text-dst_port").val(''); $("#text-dst_port").val('');
@ -496,6 +512,7 @@ ui_include_time_picker();
} }
else { else {
// Load fields from DB // Load fields from DB
$("#hidden-filter_selected").val(1);
// Get filter type // Get filter type
<?php <?php

View File

@ -104,6 +104,7 @@ sub pandora_startup () {
pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH); pandora_audit (\%Config, 'Pandora FMS Server Daemon starting', 'SYSTEM', 'System', $DBH);
# Load servers # Load servers
if ($Config{"license_type"} != METACONSOLE_LICENSE) {
pandora_reset_server (\%Config, $DBH); pandora_reset_server (\%Config, $DBH);
push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::DataServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::NetworkServer (\%Config, $DBH));
@ -112,7 +113,12 @@ sub pandora_startup () {
push (@Servers, new PandoraFMS::WMIServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::WMIServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PluginServer (\%Config, $DBH)); push (@Servers, new PandoraFMS::PluginServer (\%Config, $DBH));
push (@Servers, new PandoraFMS::PredictionServer (\%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]); enterprise_hook('load_enterprise_servers', [\@Servers, \%Config, $DBH]);
# Start the netflow daemon if necessary # Start the netflow daemon if necessary

View File

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