Merge branch 'develop' into feature/#1978-REESCRITURA_DEL_MOTOR_DE_INFORMES

Conflicts:
	pandora_console/include/functions_reporting.php
This commit is contained in:
mdtrooper 2015-03-24 10:50:13 +01:00
commit bd607c0e61
38 changed files with 473 additions and 342 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 6.0dev-150320
Version: 6.0dev-150324
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150320"
pandora_version="6.0dev-150324"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '6.0dev';
use constant AGENT_BUILD => '150320';
use constant AGENT_BUILD => '150324';
# Commands to retrieve total memory information in kB
use constant TOTALMEMORY_CMDS => {

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150320
%define release 150324
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 6.0dev
%define release 150320
%define release 150324
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{150320}
{150324}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("6.0dev(Build 150320)")
#define PANDORA_VERSION ("6.0dev(Build 150324)")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(6.0dev(Build 150320))"
VALUE "ProductVersion", "(6.0dev(Build 150324))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 6.0dev-150320
Version: 6.0dev-150324
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150320"
pandora_version="6.0dev-150324"
package_pear=0
package_pandora=1

View File

@ -239,6 +239,7 @@ if ($create_modules) {
else
$module_type = 15;
$values['unit'] = "";
if (preg_match("/Octets/", $name_array[1])) {
$values['unit'] = "Bytes";
}

View File

@ -28,10 +28,6 @@ if (! check_acl($config['id_user'], 0, "EW")) {
$update = get_parameter('upd_button', '');
$default = (int) get_parameter('default', 0);
$fields_selected = array();
$event_fields = '';
$fields_selected = explode (',', $config['event_fields']);
if ($default != 0) {
$event_fields = io_safe_input('evento,id_agente,estado,timestamp');
$fields_selected = explode (',', $event_fields);
@ -52,9 +48,15 @@ else if ($update != '') {
'value' => $event_fields
);
//update 'event_fields' in tconfig table to keep the value at update.
$result = db_process_sql_update('tconfig', $values, array ('token' => 'event_fields'));
$result = db_process_sql_update('tconfig', $values,
array ('token' => 'event_fields'));
$config['event_fields'] = $event_fields;
}
$fields_selected = array();
$event_fields = '';
$fields_selected = explode (',', $config['event_fields']);
$result_selected = array();
//show list of fields selected.

View File

@ -74,11 +74,23 @@ if ($multiple_delete) {
__('Not deleted. Error deleting data'));
}
$strict_acl = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
$own_info = get_user_info ($config['id_user']);
// Get group list that user has access
$groups_user = users_get_groups ($config['id_user'], "EW", users_can_manage_group_all(), true);
if ($strict_acl) {
$groups_user = users_get_strict_mode_groups($config['id_user'],
users_can_manage_group_all());
}
else {
$groups_user = users_get_groups ($config['id_user'], "EW",
users_can_manage_group_all(), true);
}
$sql = "SELECT * FROM tevent_filter WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")";
$sql = "
SELECT *
FROM tevent_filter
WHERE id_group_filter IN (".implode(',', array_keys ($groups_user)).")";
$filters = db_get_all_rows_sql($sql);
if ($filters === false)

View File

@ -436,9 +436,10 @@ if (defined("METACONSOLE")){
echo "<div style='text-align: right; width:100%'>";
else
echo "<div style='padding-bottom: 20px; text-align: right; width:100%'>";
if (check_acl ($config['id_user'], 0, "RM")) {
html_print_input_hidden('ids_items_to_delete', '');
html_print_submit_button(__('Delete'), 'delete_btn', false, 'class="sub delete"');
}
echo "</div>";
echo "</form>";
}

View File

@ -451,7 +451,7 @@ switch ($action) {
$reports = reports_get_reports ($filter,
array ('name', 'id_report', 'description', 'private',
'id_user', 'id_group', 'non_interactive'), $return_all_group, 'RR', $group);
'id_user', 'id_group', 'non_interactive'), $return_all_group, 'RR', $group, $strict_user);
$table->width = '0px';
if (sizeof ($reports)) {
@ -490,8 +490,10 @@ switch ($action) {
$table->head[$next] = __('Group');
$table->align[$next] = 'center';
$next++;
if(!defined('METACONSOLE'))
$table->head[$next] = '<span title="Operations">' .
__('Op.') . '</span>';
$table->size = array ();
$table->size[$next] = '80px';
$table->style[$next] = 'text-align:center;';
@ -570,10 +572,7 @@ switch ($action) {
if ($config['id_user'] == $report['id_user'] || is_user_admin ($config["id_user"])) {
$delete = true; //owner can delete
} else {
$delete = check_acl($config['id_user'],
$report['id_group'], "RM")
&&
users_can_manage_group_all($report["id_group"], "RM");
$delete = false;
}
break;
case 'group_edit':

View File

@ -46,6 +46,7 @@ class Tree {
global $config;
include_once($config['homedir']."/include/functions_servers.php");
include_once($config['homedir']."/include/functions_modules.php");
if (defined("METACONSOLE"))
enterprise_include_once("meta/include/functions_ui_meta.php");
@ -1306,31 +1307,35 @@ class Tree {
$module['serverTypeHTML'] = servers_show_type($module['server_type']);
// Link to the Module graph
$group_id = (int) modules_get_agent_group($module['id']);
$module["showGraphs"] = 0;
// ACL
if (!empty($group_id)) {
$module["showGraphs"] = (int) check_acl($config['id_user'], $group_id, "RR");
}
if ($module["showGraphs"]) {
$graphType = return_graphtype($module['id_module_type']);
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
$winHandle = dechex(crc32($module['id'].$module['name']));
if (!defined('METACONSOLE')) {
$moduleGraphURL = $config['homeurl'] .
"/operation/agentes/stat_win.php?" .
"type=$graphType&" .
"period=" . SECONDS_1DAY . "&" .
"id=" . $module['id'] . "&" .
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
"refresh=" . SECONDS_10MINUTES;
}
else if (!empty($server)) {
$moduleGraphURL = ui_meta_get_url_console_child(
$server, null, null, null, null,
"operation/agentes/stat_win.php?" .
"type=$graphType&" .
"period=" . SECONDS_1DAY . "&" .
"id=" . $module["id"] . "&" .
"label=" . rawurlencode(urlencode(base64_encode($module['name']))) . "&" .
"refresh=" . SECONDS_10MINUTES . "&" .
"avg_only=1");
$graph_params = array(
"type" => $graphType,
"period" => SECONDS_1DAY,
"id" => $module['id'],
"label" => rawurlencode(urlencode(base64_encode($module['name']))),
"refresh" => SECONDS_10MINUTES
);
if (defined('METACONSOLE') && !empty($server)) {
// Set the server id
$graph_params["server"] = $module['serverID'];
}
if (!empty($moduleGraphURL)) {
$graph_params_str = http_build_query($graph_params);
$moduleGraphURL = "$url?$graph_params_str";
$module['moduleGraph'] = array(
'url' => $moduleGraphURL,
'handle' => $winHandle

View File

@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC150320';
$build_version = 'PC150324';
$pandora_version = 'v6.0dev';
// Do not overwrite default timezone set if defined.

View File

@ -548,7 +548,7 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
$query .= sprintf ('%s IN ("%s")', $field, implode ('", "', $value));
}
else {
if (empty($value)) {
if ($value === "") {
//Search empty string
$query .= sprintf ("%s = ''", $field);
}

View File

@ -421,7 +421,7 @@ function config_update_config () {
$error_update[] = __('Login background');
if (!config_update_value ('vc_refr', get_parameter('vc_refr')))
$error_update[] = __('Default interval for refresh on Visual Console');
if (!config_update_value ('vc_line_thickness', get_parameter('vc_line_thickness')))
if (!config_update_value ('vc_line_thickness', (int) get_parameter('vc_line_thickness')))
$error_update[] = __('Default line thickness for the Visual Console');
if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')))
$error_update[] = __('Agent size text');
@ -455,7 +455,7 @@ function config_update_config () {
$error_update[] = __('Shortened module graph data');
if (!config_update_value ('show_group_name', get_parameter('show_group_name')))
$error_update[] = __('Show the group name instead the group icon.');
if (!config_update_value ('custom_graph_widht', get_parameter('custom_graph_widht')))
if (!config_update_value ('custom_graph_widht', (int) get_parameter('custom_graph_widht', 1)))
$error_update[] = __('Default line thickness for the Custom Graph.');

View File

@ -1583,11 +1583,24 @@ function events_get_event_filter ($id_filter, $filter = false, $fields = false)
function events_get_event_filter_select($manage = true) {
global $config;
$user_groups = users_get_groups ($config['id_user'], "EW", $manage, true);
$strict_acl = db_get_value('strict_acl', 'tusuario', 'id_user', $config['id_user']);
if ($strict_acl) {
$user_groups = users_get_strict_mode_groups($config['id_user'],
users_can_manage_group_all());
}
else {
$user_groups = users_get_groups ($config['id_user'], "EW",
users_can_manage_group_all(), true);
}
if(empty($user_groups)) {
return array();
}
$sql = "SELECT id_filter, id_name FROM tevent_filter WHERE id_group IN (".implode(',', array_keys ($user_groups)).")";
$sql = "
SELECT id_filter, id_name
FROM tevent_filter
WHERE id_group IN (" . implode(',', array_keys ($user_groups)) . ")";
$event_filters = db_get_all_rows_sql($sql);
@ -2033,36 +2046,42 @@ function events_page_details ($event, $server = "") {
}
$table_details->data[] = $data;
if (check_acl($config['id_user'], $agent['id_grupo'], "RR")) {
$data = array();
$data[0] = '<div style="font-weight:normal; margin-left: 20px;">'.__('Graph').'</div>';
$module_module_type = -1;
$module_type = -1;
if (isset($module["module_type"])) {
$module_module_type = $module["module_type"];
$module_type = $module["module_type"];
}
$graph_type = return_graphtype ($module_module_type);
$graph_type = return_graphtype ($module_type);
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
$handle = dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
$win_handle = "day_$handle";
$win_handle=dechex(crc32($module["id_agente_modulo"] .
$module["nombre"]));
$graph_params = array(
"type" => $graph_type,
"period" => SECONDS_1DAY,
"id" => $module["id_agente_modulo"],
"label" => rawurlencode(urlencode(base64_encode($module["nombre"]))),
"refresh" => SECONDS_10MINUTES
);
$module_module_name = '';
if (isset($module["module_name"])) {
$module_module_name = $module["module_name"];
if (defined('METACONSOLE')) {
// Set the server id
$graph_params["server"] = $server["id"];
}
$link ="winopeng('" . $serverstring .
"operation/agentes/stat_win.php?type=" . $graph_type."&" .
"period=" . SECONDS_1DAY . "&" .
"id=" . $module["id_agente_modulo"] . "&" .
"label=" . rawurlencode(
urlencode(
base64_encode($module_module_name))) . $hashstring . "&" .
(!empty($server) ? "avg_only=1&" : "") .
"refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')";
$graph_params_str = http_build_query($graph_params);
$link = "winopeng('$url?$graph_params_str','$win_handle')";
$data[1] = '<a href="javascript:'.$link.'">';
$data[1] .= html_print_image('images/chart_curve.png',true);
$data[1] .= '</a>';
$table_details->data[] = $data;
}
}
$data = array();
$data[0] = __('Alert details');

View File

@ -804,26 +804,26 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$water_mark = array('file' =>
$config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png");
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
$series_suffix_str, $menu, $backgroundColor).
'<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
$series_suffix_str, $menu, $backgroundColor);
}
else {
// Color commented not to restrict serie colors
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl,
$series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false,
$series_suffix_str, $menu, $backgroundColor);
}
@ -1320,7 +1320,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
//Work around for fixed the agents name with huge size chars.
@ -1365,8 +1365,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width,
$height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png"), "",
"", $homeurl, $water_mark, $config['fontpath'],
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $homeurl, $water_mark, $config['fontpath'],
$fixed_font_size, "", $ttl, array(), array(), 0, 0, '',
false, '', true, $background_color);
break;
@ -1374,22 +1374,22 @@ function graphic_combined_module ($module_list, $weight_list, $period,
case CUSTOM_GRAPH_STACKED_AREA:
return stacked_area_graph($flash_charts, $graph_values,
$width, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png"), "",
"", $water_mark, $config['fontpath'], $fixed_font_size,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color);
break;
case CUSTOM_GRAPH_LINE:
return line_graph($flash_charts, $graph_values, $width,
$height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png"), "",
"", $water_mark, $config['fontpath'], $fixed_font_size,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color);
break;
case CUSTOM_GRAPH_STACKED_LINE:
return stacked_line_graph($flash_charts, $graph_values,
$width, $height, $color, $module_name_list, $long_index,
ui_get_full_url("images/image_problem.opaque.png"), "",
"", $water_mark, $config['fontpath'], $fixed_font_size,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $water_mark, $config['fontpath'], $fixed_font_size,
"", $ttl, $homeurl, $background_color);
break;
}
@ -1455,15 +1455,15 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return =
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
if ($empty_data) {
$out = graph_nodata_image($width, $height);
}
else {
$out = area_graph($config['flash_charts'], $data, $width, $height,
null, null, null, ui_get_full_url("images/image_problem.opaque.png"), "", "", ui_get_full_url(false, false, false, false),
$water_mark,
$out = area_graph($config['flash_charts'], $data, $width, $height, null, null, null,
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", ui_get_full_url(false, false, false, false), $water_mark,
$config['fontpath'], $config['font_size'], "", 1, array(), array(), 0, 0, '', false, '', false);
}
@ -1553,7 +1553,7 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
array_walk($data, 'truncate_negatives');
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/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);
@ -1566,8 +1566,8 @@ function graph_agent_status ($id_agent = false, $width = 300, $height = 200, $re
}
$out = pie2d_graph($config['flash_charts'], $data, $width, $height,
__("other"),
ui_get_full_url(false), '', $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
__("other"), ui_get_full_url(false, false, false, false), '',
$config['fontpath'], $config['font_size'], 1, "hidden", $colors);
if ($return) {
return $out;
@ -1635,11 +1635,10 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height, __("other"),
'', $water_mark,
$config['fontpath'], $config['font_size'], 1, "bottom");
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "bottom");
}
function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) {
@ -1736,8 +1735,7 @@ function graph_sla_slicebar ($id, $period, $sla_min, $sla_max, $date, $daysWeek
5 => COL_NOTINIT);
return slicesbar_graph($data, $period, $width, $height, $colors,
$config['fontpath'],
$round_corner, $home_url, $ttl);
$config['fontpath'], $round_corner, $home_url, $ttl);
}
/**
@ -1947,7 +1945,7 @@ function grafico_db_agentes_purge ($id_agent, $width = 380, $height = 300) {
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png")
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false)
);
return pie3d_graph($config['flash_charts'], $data, $width, $height,
@ -1979,11 +1977,10 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return hbar_graph($config['flash_charts'], $data, $width, $height, array(),
$legend, "", "", true, "",
$water_mark,
$legend, "", "", true, "", $water_mark,
$config['fontpath'], $config['font_size'], false);
}
@ -2040,7 +2037,7 @@ function graph_db_agentes_modulos($width, $height) {
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return hbar_graph($config['flash_charts'],
$data, $width, $height, array(),
@ -2087,8 +2084,11 @@ function graphic_user_activity ($width = 350, $height = 230) {
$data[$login['id_usuario']] = $login['n_incidents'];
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2122,8 +2122,11 @@ function grafico_incidente_prioridad () {
__('Very serious') => $data_tmp[4],
__('Maintenance') => $data_tmp[5]);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2157,8 +2160,11 @@ function graph_incidents_status () {
$data[__("Invalid")]++;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, 370, 180,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2195,8 +2201,11 @@ function graphic_incident_group () {
$data[__('All')] = $incidents_all;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2234,8 +2243,11 @@ function graphic_incident_user () {
$data[$name] = $incident['n_incidents'];
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, 320, 200,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2282,8 +2294,11 @@ function graphic_incident_source($width = 320, $height = 200) {
$data[$origin['origen']] = $origin['n_incident'];
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), '', $water_mark,
$config['fontpath'], $config['font_size']);
}
@ -2305,7 +2320,7 @@ function graph_events_validated($width = 300, $height = 200, $url = "", $meta =
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false, false));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
echo pie3d_graph(
true, $data_graph, $width, $height, __("other"), "",
@ -2446,7 +2461,7 @@ function grafico_eventos_grupo ($width = 300, $height = 200, $url = "", $meta =
arsort($data);
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false, false));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -2518,7 +2533,7 @@ function grafico_eventos_total($filter = "", $width = 320, $height = 200) {
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -2574,7 +2589,7 @@ function grafico_eventos_usuario ($width, $height) {
$water_mark = array(
'file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
return pie3d_graph($config['flash_charts'], $data, $width, $height,
__('Other'), '', $water_mark,
@ -2654,19 +2669,17 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar',
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
switch ($type) {
case 'sql_graph_vbar': // vertical bar
return vbar_graph($flash_charts, $data, $width, $height, array(),
array(), "", "", $homeurl,
$water_mark,
array(), "", "", $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], false, $ttl);
break;
case 'sql_graph_hbar': // horizontal bar
return hbar_graph($flash_charts, $data, $width, $height, array(),
array(), "", "", true, $homeurl,
$water_mark,
array(), "", "", true, $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], false, $ttl);
break;
case 'sql_graph_pie': // Pie
@ -3246,25 +3259,25 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("/images/logo_vertical_water.png", false, false, false));
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, $series_type,
$chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu).
'<br>'.
area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$long_index_prev, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, $series_type_prev,
$chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str, $menu);
}
else {
return area_graph($flash_chart, $chart, $width, $height, $color, $legend,
$long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl,
$water_mark,
$long_index, ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], $unit, 1, $series_type,
$chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu);
}
@ -3337,11 +3350,12 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit =
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return area_graph($flash_chart, $chart, $width, $height, array (), $sources,
array (), "images/image_problem.opaque.png", "", $unit, $homeurl,
array (), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", $unit, $homeurl,
$config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size'], $unit, 2);
}
@ -3415,12 +3429,12 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '',
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
$legend = array (__('Max.') . ' ' . format_numeric($max) . ' ' . __('Min.') . ' ' . format_numeric($min) . ' ' . __('Avg.') . ' ' . format_numeric ($avg));
return area_graph($flash_chart, $chart, $width, $height, array (), $legend,
array (), ui_get_full_url("images/image_problem.opaque.png"), "", "", $homeurl,
$water_mark,
array (), ui_get_full_url("images/image_problem.opaque.png", false, false, false),
"", "", $homeurl, $water_mark,
$config['fontpath'], $config['font_size'], $unit, $ttl);
}
@ -3454,8 +3468,11 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image =
$flash_chart = false;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return pie3d_graph($flash_chart, $values, 370, 200,
__('Other'), $config['homeurl'], $config['homedir'] . "/images/logo_vertical_water.png",
__('Other'), $config['homeurl'], $water_mark,
$config['fontpath'], $config['font_size'], $ttl);
}
@ -3762,7 +3779,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
'url' => ui_get_full_url("images/logo_vertical_water.png", false, false, false));
return area_graph($flash_chart, $chart, $width, $height, $color,
$legend, array(), '', "", $unit, $homeurl,

View File

@ -684,8 +684,39 @@ function reporting_get_stats_alerts($data, $links = false) {
}
}
// Alerts table
$table_al = html_get_predefined_table();
$table_agent = html_get_predefined_table();
$agent_data = array();
$agent_data[0] = html_print_image('images/agent_critical.png', true, array('title' => __('Agents critical')));
$agent_data[1] = "<a style='color: #FC4444;' href='" . $links['agents_critical'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #FC4444;'>";
$agent_data[1] .= format_numeric($data["agent_critical"]) <= 0 ? '-' : format_numeric($data['agent_critical']);
$agent_data[1] .= "</span></b></a>";
$agent_data[2] = html_print_image('images/agent_warning.png', true, array('title' => __('Agents warning')));
$agent_data[3] = "<a style='color: #FAD403;' href='" . $links['agents_warning'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #FAD403;'>";
$agent_data[3] .= $data["agent_warning"] <= 0 ? '-' : format_numeric($data['agent_warning']);
$agent_data[3] .= "</span></b></a>";
$table_agent->data[] = $agent_data;
$agent_data = array();
$agent_data[0] = html_print_image('images/agent_ok.png', true, array('title' => __('Agents ok')));
$agent_data[1] = "<a style='color: #80BA27;' href='" . $links['agents_ok'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #80BA27;'>";
$agent_data[1] .= $data["agent_ok"] <= 0 ? '-' : format_numeric($data['agent_ok']);
$agent_data[1] .= "</span></b></a>";
$agent_data[2] = html_print_image('images/agent_unknown.png', true, array('title' => __('Agents unknown')));
$agent_data[3] = "<a style='color: #B2B2B2;' href='" . $links['agents_unknown'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #B2B2B2;'>";
$agent_data[3] .= $data["agent_unknown"] <= 0 ? '-' : format_numeric($data['agent_unknown']);
$agent_data[3] .= "</span></b></a>";
$table_agent->data[] = $agent_data;
$agent_data = array();
$agent_data[0] = html_print_image('images/agent_notinit.png', true, array('title' => __('Agents not init')));
$agent_data[1] = "<a style='color: #5BB6E5;' href='" . $links['agents_not_init'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #5BB6E5;'>";
$agent_data[1] .= $data["agent_not_init"] <= 0 ? '-' : format_numeric($data['agent_not_init']);
$agent_data[1] .= "</span></b></a>";
$tdata = array();
$tdata[0] = html_print_image('images/bell.png', true, array('title' => __('Defined alerts')));
@ -721,78 +752,83 @@ function reporting_get_stats_alerts($data, $links = false) {
function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_height = 150, $links = false, $data_agents=false) {
global $config;
// Link URLS
if ($links === false) {
$urls = array();
$urls['monitor_critical'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_CRITICAL_BAD . "&pure=" . $config['pure'];
$urls['monitor_warning'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_WARNING . "&pure=" . $config['pure'];
$urls['monitor_ok'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NORMAL . "&pure=" . $config['pure'];
$urls['monitor_unknown'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_UNKNOWN . "&pure=" . $config['pure'];
$urls['monitor_not_init'] = "index.php?" .
"sec=estado&amp;sec2=operation/agentes/status_monitor&amp;" .
"refr=60&amp;status=" . AGENT_MODULE_STATUS_NOT_INIT . "&pure=" . $config['pure'];
}
else {
$urls = array();
$urls['monitor_critical'] = $links['monitor_critical'];
$urls['monitor_warning'] = $links['monitor_warning'];
$urls['monitor_ok'] = $links['monitor_ok'];
$urls['monitor_unknown'] = $links['monitor_unknown'];
$urls['monitor_not_init'] = $links['monitor_not_init'];
$table_node = html_get_predefined_table();
$node_data = array();
$node_data[0] = html_print_image('images/server_export.png', true, array('title' => __('Nodes')));
$node_data[1] = "<b><span style='font-size: 12pt; font-weight: bold; color: black;'>";
$node_data[1] .= $num_servers <= 0 ? '-' : format_numeric($num_servers);
$node_data[1] .= "</span></b>";
$table_node->data[] = $node_data;
if (!defined('METACONSOLE')){
$node_overview = '<fieldset class="databox tactical_set">
<legend>' .
__('Node overview') .
'</legend>' .
html_print_table($table_node, true) . '</fieldset>';
}else{
$table_node->style = array();
$table_node->class = "tactical_view";
$node_overview = '<fieldset class="tactical_set">
<legend>' .
__('Node overview') .
'</legend>' .
html_print_table($table_node, true) . '</fieldset>';
}
// Modules by status table
$table_mbs = html_get_predefined_table();
$tdata = array();
$tdata[0] = html_print_image('images/module_critical.png', true, array('title' => __('Monitor critical')));
$tdata[1] = $data["monitor_critical"] <= 0 ? '-' : $data["monitor_critical"];
$tdata[1] = '<a style="color: ' . COL_CRITICAL . ';" class="big_data" href="' . $urls['monitor_critical'] . '">' . $tdata[1] . '</a>';
$table_events->width = "100%";
if (defined('METACONSOLE'))
$style = " vertical-align:middle;";
else
$style = "";
if (defined('METACONSOLE')){
$table_events->style[0] = "background-color:#FC4444";
$table_events->data[0][0] = html_print_image('images/module_event_critical.png', true, array('title' => __('Critical events')));
$table_events->data[0][0] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color:#FFF; font-size: 12pt; font-weight: bold;" . $style . "' href='" . $links['critical'] . "'>";
$table_events->data[0][0] .= format_numeric($data['critical']) <= 0 ? ' -' : format_numeric($data['critical']);
$table_events->data[0][0] .= "</a>";
$table_events->style[1] = "background-color:#FAD403";
$table_events->data[0][1] = html_print_image('images/module_event_warning.png', true, array('title' => __('Warning events')));
$table_events->data[0][1] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color:#FFF; font-size: 12pt; font-weight: bold;" . $style . "' href='" . $links['warning'] . "'>";
$table_events->data[0][1] .= format_numeric($data['warning']) <= 0 ? ' -' : format_numeric($data['warning']);
$table_events->data[0][1] .= "</a>";
$table_events->style[2] = "background-color:#80BA27";
$table_events->data[0][2] = html_print_image('images/module_event_ok.png', true, array('title' => __('OK events')));
$table_events->data[0][2] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color:#FFF; font-size: 12pt; font-weight: bold;" . $style . "' href='" . $links['normal'] . "'>";
$table_events->data[0][2] .= format_numeric($data['normal']) <= 0 ? ' -' : format_numeric($data['normal']);
$table_events->data[0][2] .= "</a>";
$table_events->style[3] = "background-color:#B2B2B2";
$table_events->data[0][3] = html_print_image('images/module_event_unknown.png', true, array('title' => __('Unknown events')));
$table_events->data[0][3] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color:#FFF; font-size: 12pt; font-weight: bold;" . $style . "' href='" . $links['unknown'] . "'>";
$table_events->data[0][3] .=format_numeric($data['unknown']) <= 0 ? ' -' : format_numeric($data['unknown']);
$table_events->data[0][3] .="</a>";
}
else{
$table_events->data[0][0] = html_print_image('images/module_critical.png', true, array('title' => __('Critical events')));
$table_events->data[0][0] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color: #FC4444;" . $style . "' href='" . $links['critical'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #FC4444;'>".
format_numeric($data['critical'])."</span></b></a>";
$table_events->data[0][1] = html_print_image('images/module_warning.png', true, array('title' => __('Warning events')));
$table_events->data[0][1] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color: #FAD403;" . $style . "' href='" . $links['warning'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #FAD403;'>".
format_numeric($data['warning'])."</span></b></a>";
$table_events->data[0][2] = html_print_image('images/module_ok.png', true, array('title' => __('OK events')));
$table_events->data[0][2] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color: #80BA27;" . $style . "' href='" . $links['normal'] . "'><b style='font-size: 12pt; font-weight: bold; color: #80BA27;'>".
format_numeric($data['normal'])."</b></a>";
$table_events->data[0][3] = html_print_image('images/module_unknown.png', true, array('title' => __('Unknown events')));
$table_events->data[0][3] .= "&nbsp;&nbsp;&nbsp;" .
"<a style='color: #B2B2B2;" . $style . "' href='" . $links['unknown'] . "'><b><span style='font-size: 12pt; font-weight: bold; color: #B2B2B2;'>".
format_numeric($data['unknown'])."</span></b></a>";
$tdata[2] = html_print_image('images/module_warning.png', true, array('title' => __('Monitor warning')));
$tdata[3] = $data["monitor_warning"] <= 0 ? '-' : $data["monitor_warning"];
$tdata[3] = '<a style="color: ' . COL_WARNING_DARK . ';" class="big_data" href="' . $urls['monitor_warning'] . '">' . $tdata[3] . '</a>';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
$tdata = array();
$tdata[0] = html_print_image('images/module_ok.png', true, array('title' => __('Monitor normal')));
$tdata[1] = $data["monitor_ok"] <= 0 ? '-' : $data["monitor_ok"];
$tdata[1] = '<a style="color: ' . COL_NORMAL . ';" class="big_data" href="' . $urls["monitor_ok"] . '">' . $tdata[1] . '</a>';
$tdata[2] = html_print_image('images/module_unknown.png', true, array('title' => __('Monitor unknown')));
$tdata[3] = $data["monitor_unknown"] <= 0 ? '-' : $data["monitor_unknown"];
$tdata[3] = '<a style="color: ' . COL_UNKNOWN . ';" class="big_data" href="' . $urls["monitor_unknown"] . '">' . $tdata[3] . '</a>';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
$tdata = array();
$tdata[0] = html_print_image('images/module_notinit.png', true, array('title' => __('Monitor not init')));
$tdata[1] = $data["monitor_not_init"] <= 0 ? '-' : $data["monitor_not_init"];
$tdata[1] = '<a style="color: ' . COL_NOTINIT . ';" class="big_data" href="' . $urls["monitor_not_init"] . '">' . $tdata[1] . '</a>';
$tdata[2] = $tdata[3] = '';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
if ($data["monitor_checks"] > 0) {
$tdata = array();
$table_mbs->colspan[count($table_mbs->data)][0] = 4;
$table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;';
$tdata[0] = '<div id="outter_status_pie" style="height: ' . $graph_height . 'px">' .
'<div id="status_pie" style="margin: auto; width: ' . $graph_width . 'px;">' .
graph_agent_status(false, $graph_width, $graph_height, true, true, $data_agents) .
'</div></div>';
$table_mbs->rowclass[] = '';
$table_mbs->data[] = $tdata;
}
if (!defined("METACONSOLE")) {
@ -867,6 +903,24 @@ function reporting_get_stats_agents_monitors($data) {
function reporting_get_stats_users($data) {
global $config;
include_once ('../../include/graphs/functions_gd.php');
$max_value = count($events);
$ttl = 1;
$urlImage = ui_get_full_url(false, true, false, false);
$colors = array(
EVENT_CRIT_MAINTENANCE => COL_MAINTENANCE,
EVENT_CRIT_INFORMATIONAL => COL_INFORMATIONAL,
EVENT_CRIT_NORMAL => COL_NORMAL,
EVENT_CRIT_MINOR => COL_MINOR,
EVENT_CRIT_WARNING => COL_WARNING,
EVENT_CRIT_MAJOR => COL_MAJOR,
EVENT_CRIT_CRITICAL => COL_CRITICAL
);
foreach ($events as $data) {
// Link URLS
$urls = array();
if (check_acl ($config['id_user'], 0, "UM")) {

View File

@ -82,7 +82,7 @@ function reports_get_report ($id_report, $filter = false, $fields = false) {
*
* @return array An array with all the reports the user can view.
*/
function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'RR', $group = false) {
function reports_get_reports ($filter = false, $fields = false, $returnAllGroup = true, $privileges = 'RR', $group = false, $strict_user) {
global $config;
if (! is_array ($filter))
@ -110,6 +110,8 @@ function reports_get_reports ($filter = false, $fields = false, $returnAllGroup
else {
//Recheck in all reports if the user have permissions to see each report.
$groups = users_get_groups ($config['id_user'], $privileges, $returnAllGroup);
if ($strict_user)
$groups = users_get_strict_mode_groups ($config['id_user'], $returnAllGroup);
}
foreach ($all_reports as $report) {

View File

@ -356,6 +356,7 @@ TreeController = {
$content.append($serverTypeImage);
}
if (typeof element.showGraphs != 'undefined' && element.showGraphs != 0) {
// Graph pop-up
if (typeof element.moduleGraph != 'undefined') {
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
@ -398,6 +399,7 @@ TreeController = {
$content.append($dataImage);
}
}
// Alerts
if (typeof element.alertsImageHTML != 'undefined'

View File

@ -63,7 +63,7 @@
<div style='height: 10px'>
<?php
$version = '6.0dev';
$build = '150320';
$build = '150324';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -21,32 +21,32 @@ if (! isset($_SESSION['id_usuario'])) {
// Global & session management
require_once ('../../include/config.php');
require_once ('../../include/auth/mysql.php');
require_once ($config['homedir'] . '/include/auth/mysql.php');
require_once ($config['homedir'] . '/include/functions.php');
require_once ($config['homedir'] . '/include/functions_db.php');
require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_graph.php');
require_once ($config['homedir'] . '/include/functions_modules.php');
// Hash login process
if (! isset ($config['id_user']) && get_parameter("loginhash", 0)) {
$loginhash_data = get_parameter("loginhash_data", "");
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
if ($config["loginhash_pwd"] != ""
&& $loginhash_data == md5($loginhash_user.io_output_password($config["loginhash_pwd"]))) {
db_logon ($loginhash_user, $_SERVER['REMOTE_ADDR']);
$_SESSION['id_usuario'] = $loginhash_user;
$config["id_user"] = $loginhash_user;
$hash_connection_data = true;
}
}
require_once ($config['homedir'] . '/include/functions_agents.php');
check_login ();
// Metaconsole connection to the node
$server_id = (int) get_parameter("server");
if ($config["metaconsole"] && !empty($server_id)) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting
if (metaconsole_connect($server) !== NOERR) {
echo "<html>";
echo "<body>";
ui_print_error_message(__('There was a problem connecting with the node'));
echo "</body>";
echo "</html>";
exit;
}
}
$user_language = get_user_language ($config['id_user']);
if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
@ -100,15 +100,28 @@ $label = base64_decode(get_parameter('label', ''));
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
// Get input parameters
$label = get_parameter ("label","");
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
ui_print_error_message(
__('There was a problem locating the source of the graph'));
// Module id
$id = (int) get_parameter ("id", 0);
// Agent id
$agent_id = (int) modules_get_agentmodule_agent($id);
if (empty($id) || empty($agent_id)) {
ui_print_error_message(__('There was a problem locating the source of the graph'));
exit;
}
// ACL
$permission = false;
$agent_group = (int) agents_get_agent_group($agent_id);
if (!empty($agent_group) && check_acl($config['id_user'], $agent_group, "RR")) {
$permission = true;
}
if (!$permission) {
require ($config['homedir'] . "/general/noaccess.php");
exit;
}
$period = get_parameter ( "period", SECONDS_1HOUR);
$draw_alerts = get_parameter("draw_alerts", 0);
$avg_only = get_parameter ("avg_only", 0);
$show_other = (bool)get_parameter('show_other', false);
@ -154,7 +167,7 @@ $label = base64_decode(get_parameter('label', ''));
else
$date = $utime;
$urlImage = ui_get_full_url(false);
$urlImage = ui_get_full_url(false, false, false, false);
$unit = db_get_value('unit', 'tagente_modulo', 'id_agente_modulo', $id);
@ -216,22 +229,12 @@ $label = base64_decode(get_parameter('label', ''));
// MENU
$params['body_text'] .= '<form method="get" action="stat_win.php">';
$params['body_text'] .= html_print_input_hidden ("id", $id, true);
$params['body_text'] .= html_print_input_hidden ("label", $label);
if (isset($hash_connection_data)) {
$params['body_text'] .=
html_print_input_hidden("loginhash", "auto", true);
$params['body_text'] .=
html_print_input_hidden("loginhash_data", $loginhash_data, true);
$params['body_text'] .=
html_print_input_hidden("loginhash_user",
str_rot13($loginhash_user), true);
}
$params['body_text'] .= html_print_input_hidden ("id", $id, true);
$params['body_text'] .= html_print_input_hidden ("label", $label, true);
if (!empty($server_id))
$params['body_text'] .= html_print_input_hidden ("server", $server_id, true);
if (isset($_GET["type"])) {
$type = get_parameter_get ("type");
$params['body_text'] .= html_print_input_hidden ("type", $type, true);

View File

@ -893,6 +893,7 @@ else {
foreach ($result_server as $result_element_key => $result_element_value) {
$result_server[$result_element_key]['server_id'] = $server["id"];
$result_server[$result_element_key]['server_name'] = $server["server_name"];
$result_server[$result_element_key]['server_url'] = $server["server_url"]."/";
$result_server[$result_element_key]['hashdata'] = $hashdata;
@ -1196,39 +1197,30 @@ foreach ($result as $row) {
$data[7] = "";
if ($row['history_data'] == 1) {
if ($row['history_data'] == 1 && check_acl($config['id_user'], $row['id_group'], "RR")) {
$graph_type = return_graphtype ($row["module_type"]);
$nombre_tipo_modulo = modules_get_moduletype_name ($row["module_type"]);
$handle = "stat".$nombre_tipo_modulo."_".$row["id_agente_modulo"];
$url = 'include/procesos.php?agente='.$row["id_agente_modulo"];
$win_handle=dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
$url = ui_get_full_url("operation/agentes/stat_win.php", false, false, false);
$handle = dechex(crc32($row["id_agente_modulo"].$row["module_name"]));
$win_handle = "day_$handle";
if (defined('METACONSOLE'))
$link ="winopeng('" .
$row['server_url'] . "operation/agentes/stat_win.php?" .
"type=$graph_type&" .
"period=" . SECONDS_1DAY . "&" .
"loginhash=auto&" .
"loginhash_data=" . $row["hashdata"] . "&" .
"loginhash_user=" . str_rot13($row["user"]) . "&" .
"id=" . $row["id_agente_modulo"] . "&" .
"label=" . rawurlencode(
urlencode(
base64_encode($row["module_name"]))) . "&" .
"avg_only=1&" .
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
else
$link ="winopeng('" .
"operation/agentes/stat_win.php?" .
"type=$graph_type&" .
"period=" . SECONDS_1DAY . "&" .
"id=".$row["id_agente_modulo"]."&" .
"label=" . rawurlencode(
urlencode(
base64_encode($row["module_name"]))) . "&" .
"refresh=" . SECONDS_10MINUTES . "', 'day_".$win_handle."')";
$graph_params = array(
"type" => $graph_type,
"period" => SECONDS_1DAY,
"id" => $row["id_agente_modulo"],
"label" => rawurlencode(urlencode(base64_encode($row["module_name"]))),
"refresh" => SECONDS_10MINUTES
);
if (defined('METACONSOLE') && isset($row["server_id"])) {
// Set the server id
$graph_params["server"] = $row["server_id"];
}
$graph_params_str = http_build_query($graph_params);
$link = "winopeng('$url?$graph_params_str','$win_handle')";
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a>';

View File

@ -82,6 +82,13 @@ if (is_ajax()) {
$values['filter_only_alert'] = get_parameter('filter_only_alert');
$values['id_group_filter'] = get_parameter('id_group_filter');
$exists = (bool)db_get_value_filter(
'id_filter', 'tevent_filter', $values);
if ($exists) {
echo 'error';
}
else {
$result = db_process_sql_insert('tevent_filter', $values);
if ($result === false) {
@ -91,6 +98,7 @@ if (is_ajax()) {
echo $result;
}
}
}
if ($update_event_filter) {
$values = array();
@ -334,7 +342,7 @@ if(!defined("METACONSOLE"))
true, true, true, '', false, 'width: 120px; height: 70px;') . '<br>';
else
$data[0] = html_print_select ($tags_select_with, 'select_with', '', '', '', 0,
true, true, true, '', false, 'width: 250px; height: 70px;') . '<br>';
true, true, true, '', false, 'width: auto; height: 70px;') . '<br>';
$data[1] = html_print_image('images/darrowright.png', true, array('id' => 'button-add_with', 'style' => 'cursor: pointer;', 'title' => __('Add')));
$data[1] .= html_print_input_hidden('tag_with', $tag_with_base64, true);
$data[1] .= '<br><br>' . html_print_image('images/darrowleft.png', true, array('id' => 'button-remove_with', 'style' => 'cursor: pointer;', 'title' => __('Remove')));
@ -343,7 +351,7 @@ if(!defined("METACONSOLE"))
0, true, true, true, '', false, "width: 120px; height: 70px;");
else
$data[2] = html_print_select ($tag_with_temp, 'tag_with_temp', array(), '', '',
0, true, true, true, '', false, "width: 250px; height: 70px;");
0, true, true, true, '', false, "width: auto; height: 70px;");
$tabletags_with->data[] = $data;
$tabletags_with->rowclass[] = '';
@ -368,7 +376,7 @@ if(!defined("METACONSOLE"))
true, true, true, '', false, 'width: 120px; height: 70px;') . '<br>';
else
$data[0] = html_print_select ($tags_select_without, 'select_without', '', '', '', 0,
true, true, true, '', false, 'width: 250px; height: 70px;') . '<br>';
true, true, true, '', false, 'width: auto; height: 70px;') . '<br>';
$data[1] = html_print_image('images/darrowright.png', true, array('id' => 'button-add_without', 'style' => 'cursor: pointer;', 'title' => __('Add')));
$data[1] .= html_print_input_hidden('tag_without', $tag_without_base64, true);
@ -379,7 +387,7 @@ if(!defined("METACONSOLE"))
0, true, true, true, '', false, "width: 120px; height: 70px;");
else
$data[2] = html_print_select ($tag_without_temp, 'tag_without_temp', array(), '', '',
0, true, true, true, '', false, "width: 250px; height: 70px;");
0, true, true, true, '', false, "width: auto; height: 70px;");
$tabletags_without->data[] = $data;
$tabletags_without->rowclass[] = '';

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150320
%define release 150324
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 6.0dev
%define release 150320
%define release 150324
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -38,7 +38,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('graph_res','5'),
('step_compact','1'),
('db_scheme_version','6.0dev'),
('db_scheme_build','PD150320'),
('db_scheme_build','PD150324'),
('show_unknown','0'),
('show_lastalerts','1'),
('style','pandora'),

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 6.0dev-150320
Version: 6.0dev-150324
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="6.0dev-150320"
pandora_version="6.0dev-150324"
package_cpan=0
package_pandora=1

View File

@ -43,7 +43,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "6.0dev";
my $pandora_build = "150320";
my $pandora_build = "150324";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150320
%define release 150324
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 6.0dev
%define release 150320
%define release 150324
Summary: Pandora FMS Server
Name: %{name}

View File

@ -33,7 +33,7 @@ use PandoraFMS::Tools;
use PandoraFMS::DB;
# version: define current version
my $version = "6.0dev PS150320";
my $version = "6.0dev PS150324";
# Pandora server configuration
my %conf;
@ -213,6 +213,20 @@ sub pandora_purgedb ($$) {
usleep (10000);
}
log_message ('', "\n");
log_message ('PURGE', "Deleting validated events from tmetaconsole_event_history.", '');
$events_to_delete = get_db_value ($dbh, "SELECT COUNT(*) FROM tmetaconsole_event_history WHERE estado = 1");
while($events_to_delete > 0) {
db_do($dbh, "DELETE FROM tmetaconsole_event_history WHERE estado = 1 LIMIT ?", $BIG_OPERATION_STEP);
$events_to_delete = $events_to_delete - $BIG_OPERATION_STEP;
# Mark the progress
log_message ('', ".");
# Do not overload the MySQL server
usleep (10000);
}
log_message ('', "\n");
}
else {
log_message ('PURGE', 'event_purge is set to 0. Old events will not be deleted.');

View File

@ -34,7 +34,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "6.0dev PS150320";
my $version = "6.0dev PS150324";
# save program name for logging
my $progname = basename($0);