Merge branch 'develop' into ent-2520-api-listar-y-crear-repuestas-de-eventos-6165-eucomm

Conflicts resolved:
	pandora_console/include/functions_api.php
This commit is contained in:
fermin831 2018-10-25 15:45:16 +02:00
commit d70969e6e9
37 changed files with 385 additions and 517 deletions

View File

@ -227,7 +227,7 @@ int Cron::getResetValue (int position) {
* @return false if should not execute
*/
bool Cron::shouldExecuteAt (time_t date) {
return this->utimestamp < date;
return this->utimestamp <= date;
}
/**

View File

@ -48,7 +48,7 @@ function createXMLData($agent, $agentModule, $time, $data) {
$data
);
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . str_replace($time, " ", "_") . ".data";
$file_name = $config["remote_config"] . "/" . io_safe_output($agent["alias"]) . "." . strtotime($time) . ".data";
return (bool) @file_put_contents($file_name, $xml);
}
@ -115,7 +115,7 @@ function mainInsertData() {
$utimestamp = strtotime($date . " " . $time) - get_fixed_offset();
$timestamp = date(DATE_FORMAT . " " . TIME_FORMAT, $utimestamp);
$result = createXMLData($agent, $agentModule, $timestamp, $data);
if ($result) {
$done++;
}

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
COMMIT;

View File

@ -1740,6 +1740,8 @@ CREATE TABLE IF NOT EXISTS `tlayout_template` (
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE tlayout_template MODIFY `name` varchar(600) NOT NULL;
-- ---------------------------------------------------------------------
-- Table `tlayout_template_data`
-- ---------------------------------------------------------------------

View File

@ -233,7 +233,7 @@ foreach ($result as $row) {
$data[2] = ui_print_help_tip(date($config["date_format"], $row["utimestamp"]), true)
. ui_print_timestamp($row["utimestamp"], true);
$data[3] = $row["ip_origen"];
$data[4] = $row["descripcion"];
$data[4] = io_safe_output($row["descripcion"]);
if ($enterprise_include !== ENTERPRISE_NOT_HOOK) {
$data[5] = enterprise_hook("cell1EntepriseAudit", array($row["id_sesion"]));

View File

@ -541,7 +541,7 @@ if (!empty($interfaces_list)) {
$table->data[0][1] = '';
$table->data[0][2] = '<b>'.__('Modules').'</b>';
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px;');
$table->data[1][0] = html_print_select ($interfaces_list, 'id_snmp[]', 0, false, '', '', true, true, true, '', false, 'width:500px; overflow: auto;');
$table->data[1][1] = html_print_image('images/darrowright.png', true);
$table->data[1][2] = html_print_select (array (), 'module[]', 0, false, '', 0, true, true, true, '', false, 'width:200px;');
$table->data[1][2] .= html_print_input_hidden('agent', $id_agent, true);

View File

@ -139,7 +139,7 @@ if (($policy_page) || (isset($agent))) {
echo '</td>';
}
echo '<td class="datos" style="font-weight: bold; width:20%;">';
echo __("Type");
echo __("<p>Type</p>");
html_print_select ($modules, 'moduletype', '', '', '', '', false, false, false, '', false, 'max-width:300px;' );
html_print_input_hidden ('edit_module', 1);
echo '</td>';
@ -607,7 +607,7 @@ foreach ($modules as $module) {
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK)
$table->colspan[$i - 1][0] = 10;
else
$table->colspan[$i - 1][0] = 8;
$table->colspan[$i - 1][0] = 9;
$data = array ();
}

View File

@ -195,7 +195,8 @@ if ($add_module) {
"')");
if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
$order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
$order = db_get_row_sql("SELECT `field_order` from tgraph_source WHERE id_graph=$id_graph ORDER BY `field_order` DESC");
$order = $order['field_order'];
foreach($id_agent_modules as $id_agent_module){
$order++;
@ -207,8 +208,13 @@ if ($add_module) {
}
if ($delete_module) {
$id_graph = get_parameter('id');
$deleteGraph = get_parameter('delete');
$order_val = db_get_value('field_order', 'tgraph_source', 'id_gs', $deleteGraph);
$result = db_process_sql_delete('tgraph_source', array('id_gs' => $deleteGraph));
db_process_sql ('UPDATE tgraph_source SET field_order=field_order-1 WHERE id_graph='.$id_graph.' AND field_order>'.$order_val);
}
if ($change_weight) {

View File

@ -222,7 +222,7 @@ $table->data[36][0] = __('Include agents manually disabled');
$table->data[36][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 1, '', $config["include_agents"], true).'&nbsp;&nbsp;';
$table->data[36][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button ('include_agents', 0, '', $config["include_agents"], true);
$table->data[37][0] = __('audit log directory') .
$table->data[37][0] = __('Audit log directory') .
ui_print_help_tip (__("Directory where audit log is stored."), true);
$table->data[37][1] = html_print_input_text ('auditdir', io_safe_output($config["auditdir"]), '', 30, 100, true);

View File

@ -83,13 +83,8 @@ $table_behaviour->data[$row][1] = html_print_checkbox('paginate_module', 1,
$row++;
$table_behaviour->data[$row][0] = __('Display data of proc modules in other format');
$table_behaviour->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('render_proc', 1, '',
$config["render_proc"], true) .
'&nbsp;&nbsp;';
$table_behaviour->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('render_proc', 0, '',
$config["render_proc"], true);
$table_behaviour->data[$row][1] = html_print_checkbox('render_proc', 1,
$config['render_proc'], true);
$row++;
$table_behaviour->data[$row][0] = __('Display text proc modules have state is ok');
@ -103,13 +98,8 @@ $row++;
//Daniel maya 02/06/2016 Display menu with click --INI
$table_behaviour->data[$row][0] = __('Click to display lateral menus').
ui_print_help_tip(__('When enabled, the lateral menus are shown when left clicking them, instead of hovering over them'), true);
$table_behaviour->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('click_display', 1, '',
$config["click_display"], true) .
'&nbsp;&nbsp;';
$table_behaviour->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('click_display', 0, '',
$config["click_display"], true);
$table_behaviour->data[$row][1] = html_print_checkbox('click_display', 1,
$config['click_display'], true);
$row++;
//Daniel maya 02/06/2016 Display menu with click --END
@ -126,13 +116,8 @@ if (enterprise_installed()) {
$table_behaviour->data[$row][0] = __('Classic menu mode').
ui_print_help_tip(__('Text menu options always visible, don\'t hide'), true);
$table_behaviour->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('classic_menu', 1, '',
$config["classic_menu"], true) .
'&nbsp;&nbsp;';
$table_behaviour->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('classic_menu', 0, '',
$config["classic_menu"], true);
$table_behaviour->data[$row][1] = html_print_checkbox('classic_menu', 1,
$config['classic_menu'], true);
$row++;
echo "<fieldset>";
@ -398,41 +383,31 @@ if(enterprise_installed()) {
$row++;
}
$table_styles->data[$row][0] = __('Disable logo in graphs');
$table_styles->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button_extended ('fixed_graph', 1, '', $config["fixed_graph"], $open, '','',true) .
'&nbsp;&nbsp;';
if (enterprise_installed()){
$table_styles->data[$row][0] = __('Disable logo in graphs');
$table_styles->data[$row][1] = html_print_checkbox('fixed_graph', 1,
$config['fixed_graph'], true);
$row++;
}
/* Hello there! :)
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/
$table_styles->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button_extended ('fixed_graph', 0, '', $config["fixed_graph"], $open, '','',true, $open,'visualmodal');
$row++;
$table_styles->data[$row][0] = __('Disable helps');
$table_styles->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('disable_help', 1, '', $config["disable_help"], true) .
'&nbsp;&nbsp;';
$table_styles->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('disable_help', 0, '', $config["disable_help"], true);
$table_styles->data[$row][1] = html_print_checkbox('disable_help', 1,
$config['disable_help'], true);
$row++;
$table_styles->data[$row][0] = __('Fixed header');
$table_styles->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('fixed_header', 1, '', $config["fixed_header"], true) .
'&nbsp;&nbsp;';
$table_styles->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('fixed_header', 0, '', $config["fixed_header"], true);
$table_styles->data[$row][1] = html_print_checkbox('fixed_header', 1,
$config['fixed_header'], true);
$row++;
$table_styles->data[$row][0] = __('Fixed menu');
$table_styles->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('fixed_menu', 1, '', $config["fixed_menu"], true) .
'&nbsp;&nbsp;';
$table_styles->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('fixed_menu', 0, '', $config["fixed_menu"], true);
$table_styles->data[$row][1] = html_print_checkbox('fixed_menu', 1,
$config['fixed_menu'], true);
$row++;
// For 5.1 Autohidden menu feature
@ -441,11 +416,8 @@ $table_styles->data['autohidden'][1] = html_print_checkbox('autohidden_menu',
1, $config['autohidden_menu'], true);
$table_styles->data[$row][0] = __('Visual effects and animation');
$table_styles->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('visual_animation', 1, '', $config["visual_animation"], true) .
'&nbsp;&nbsp;';
$table_styles->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('visual_animation', 0, '', $config["visual_animation"], true);
$table_styles->data[$row][1] = html_print_checkbox('visual_animation', 1,
$config['visual_animation'], true);
echo "<fieldset>";
echo "<legend>" . __('Style configuration') . "</legend>";
@ -465,10 +437,8 @@ $table_gis->data = array ();
$table_gis->data[$row][0] = __('GIS Labels') .
ui_print_help_tip(__('This enabling this, you get a label with agent name in GIS maps. If you have lots of agents in the map, will be unreadable. Disabled by default.'), true);
$table_gis->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('gis_label', 1, '', $config["gis_label"], true).'&nbsp;&nbsp;';
$table_gis->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('gis_label', 0, '', $config["gis_label"], true);
$table_gis->data[$row][1] = html_print_checkbox('gis_label', 1,
$config['gis_label'], true);
$row++;
$listIcons = gis_get_array_list_icons();
@ -558,10 +528,8 @@ $row++;
$table_font->data[$row][0] = __('Show unit along with value in reports') .
ui_print_help_tip(__('This enabling this, max, min and avg values will be shown with units.'), true);
$table_font->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('simple_module_value', 1, '', $config["simple_module_value"], true).'&nbsp;&nbsp;';
$table_font->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('simple_module_value', 0, '', $config["simple_module_value"], true);
$table_font->data[$row][1] = html_print_checkbox('simple_module_value', 1,
$config['simple_module_value'], true);
$row++;
echo "<fieldset>";
@ -647,8 +615,8 @@ $table_chars->data[$row][1] = html_print_input_text ('custom_graph_width',
$row++;
$table_chars->data[$row][0] = __('Use round corners');
$table_chars->data[$row][1] = __('Yes').'&nbsp;'.html_print_radio_button ('round_corner', 1, '', $config["round_corner"], true).'&nbsp;&nbsp;';
$table_chars->data[$row][1] .= __('No').'&nbsp;'.html_print_radio_button ('round_corner', 0, '', $config["round_corner"], true);
$table_chars->data[$row][1] = html_print_checkbox('round_corner', 1,
$config['round_corner'], true);
$row++;
$table_chars->data[$row][0] = __('Type of module charts');
@ -876,14 +844,8 @@ $table_other->data['custom_report_front-footer'][1] = html_print_textarea('custo
$table_other->data[$row][0] = __('Show QR Code icon in the header');
$table_other->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('show_qr_code_header', 1, '',
$config["show_qr_code_header"], true) .
'&nbsp;&nbsp;';
$table_other->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('show_qr_code_header', 0, '',
$config["show_qr_code_header"], true);
$table_other->data[$row][1] = html_print_checkbox('show_qr_code_header', 1,
$config['show_qr_code_header'], true);
$row++;
$table_other->data[$row][0] = __('Custom graphviz directory') .
@ -903,13 +865,8 @@ $row++;
$table_other->data[$row][0] = __('Show only the group name');
$table_other->data[$row][0] .= ui_print_help_tip(
__('Show the group name instead the group icon.'), true);
$table_other->data[$row][1] = __('Yes') . '&nbsp;' .
html_print_radio_button ('show_group_name', 1, '',
$config["show_group_name"], true) .
'&nbsp;&nbsp;';
$table_other->data[$row][1] .= __('No') . '&nbsp;' .
html_print_radio_button ('show_group_name', 0, '',
$config["show_group_name"], true);
html_print_checkbox('show_group_name', 1,
$config['show_group_name'], true);
$row++;
$table_other->data[$row][0] = __('Date format string') . ui_print_help_icon("date_format", true);

View File

@ -154,6 +154,8 @@ if ($create_user) {
}
if (html_print_csrf_error()) return;
$user_is_admin = (int) get_parameter ('is_admin', 0);
$values = array ();
$values['id_user'] = (string) get_parameter ('id_user');
$values['fullname'] = (string) get_parameter ('fullname');
@ -164,7 +166,7 @@ if ($create_user) {
$values['email'] = (string) get_parameter ('email');
$values['phone'] = (string) get_parameter ('phone');
$values['comments'] = (string) get_parameter ('comments');
$values['is_admin'] = (int) get_parameter ('is_admin', 0);
$values['is_admin'] = $user_is_admin;
$values['language'] = get_parameter ('language', 'default');
$values['timezone'] = (string) get_parameter('timezone');
$values['default_event_filter'] = (int) get_parameter('default_event_filter');
@ -193,9 +195,9 @@ if ($create_user) {
$values['last_pass_change'] = date ("Y/m/d H:i:s", get_system_time());
if(defined('METACONSOLE')) {
$values['metaconsole_access'] = get_parameter ('metaconsole_access', 'basic');
$values['metaconsole_agents_manager'] = get_parameter ('metaconsole_agents_manager', '0');
$values['metaconsole_agents_manager'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_agents_manager', '0'));
$values['metaconsole_assigned_server'] = get_parameter ('metaconsole_assigned_server', '');
$values['metaconsole_access_node'] = get_parameter ('metaconsole_access_node', '0');
$values['metaconsole_access_node'] = ($user_is_admin == 1 ? 1 : get_parameter ('metaconsole_access_node', '0'));
}
}
$values["not_login"] = (bool)get_parameter ('not_login', false);
@ -738,12 +740,11 @@ $(document).ready (function () {
$('input:radio[name="is_admin"]').change(function() {
if($('#radiobtn0002').prop('checked')) {
$('#user_configuration_table-metaconsole_agents_manager').show();
$('#user_configuration_table-metaconsole_assigned_server').show();
$('#user_configuration_table-metaconsole_access_node').show();
}
else {
$('#user_configuration_table-metaconsole_agents_manager').hide();
$('#user_configuration_table-metaconsole_assigned_server').hide();
$('#user_configuration_table-metaconsole_assigned_server').show();
$('#user_configuration_table-metaconsole_access_node').hide();
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -126,6 +126,58 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
echo grafico_modulo_sparse($params);
echo '</div>';
}
elseif($type_graph_pdf == 'hbar'){
echo '<div>';
echo hbar_graph(
$params['flash_chart'],
$params['chart_data'],
$params['width'],
$params['height'],
$params['color'],
$params['legend'],
$params['long_index'],
$params['no_data_image'],
$params['xaxisname'],
$params['yaxisname'],
$params['water_mark'],
$params['font'],
$params['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
$params['backgroundColor'],
$params['tick_color'],
$params['val_min'],
$params['val_max']
);
echo '</div>';
}
elseif($type_graph_pdf == 'vbar'){
echo '<div>';
echo vbar_graph(
$params['flash_chart'],
$params['chart_data'],
$params['width'],
$params['height'],
$params['color'],
$params['legend'],
$params['long_index'],
$params['no_data_image'],
$params['xaxisname'],
$params['yaxisname'],
$params['water_mark'],
$params['font'],
$params['font_size'],
$params['unit'],
$params['ttl'],
$params['homeurl'],
$params['backgroundColor'],
$params['from_ux'],
$params['from_wux'],
$params['tick_color']
);
echo '</div>';
}
$config['font_size'] = $aux_font_size;
?>

View File

@ -1369,10 +1369,11 @@ function is_metaconsole() {
*
* @return bool
*/
function is_management_allowed() {
function is_management_allowed($hkey = '') {
global $config;
return ( (is_metaconsole() && $config["centralized_management"])
|| (!is_metaconsole() && !$config["centralized_management"]));
|| (!is_metaconsole() && !$config["centralized_management"])
|| (!is_metaconsole() && $config["centralized_management"]) && $hkey == hash('sha256', db_get_value ('value', 'tupdate_settings', 'token', 'customer_key')));
}
/**
@ -3128,16 +3129,23 @@ function series_type_graph_array($data, $show_elements_graph){
if (isset($show_elements_graph['labels']) &&
is_array($show_elements_graph['labels']) &&
(count($show_elements_graph['labels']) > 0)){
$name_legend = $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']] . ' ' ;
if ($show_elements_graph['unit'])
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
else
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
}
else{
if(strpos($key, 'baseline') !== false){
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$value['module_name'] . ' Baseline ';
if ($show_elements_graph['unit'])
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .'Baseline ';
else
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . 'Baseline ';
}
else{
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' .
$value['module_name'] . ': ';
if ($show_elements_graph['unit'])
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
else
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
}
}
@ -3173,6 +3181,11 @@ function series_type_graph_array($data, $show_elements_graph){
!$show_elements_graph['fullscale'] && strpos($key, 'max') !== false){
$data_return['series_type'][$key] = $type_graph;
if ($show_elements_graph['unit'])
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
else
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
$data_return['legend'][$key] = $name_legend;
if($show_elements_graph['type_mode_graph']){
$data_return['legend'][$key] .=
@ -3234,6 +3247,10 @@ function series_type_graph_array($data, $show_elements_graph){
__('Percentil') . ' ' .
$config['percentil'] .
'º ' . __('of module') . ' ';
if ($show_elements_graph['unit'])
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ' / ' . __('Unit ') . ' ' . $show_elements_graph['unit'] .': ';
else
$name_legend = $data_return['legend'][$key] = $value['agent_alias'] . ' / ' . $value['module_name'] . ': ';
$data_return['legend'][$key] .= $name_legend;
$data_return['legend'][$key] .= remove_right_zeros(
number_format(

View File

@ -28,13 +28,14 @@ require_once($config['homedir'] . '/include/functions_users.php');
*
* @param int $id_agent The agent id.
* @param boolean $show_disabled Show the agent found althought it is disabled. By default false.
* @param boolean $force_meta
*
* @return boolean The result to check if the agent is in the DB.
*/
function agents_check_agent_exists($id_agent, $show_disabled = true) {
function agents_check_agent_exists($id_agent, $show_disabled = true, $force_meta = false) {
$agent = db_get_value_filter(
'id_agente',
'tagente',
$force_meta ? 'tmetaconsole_agent' : 'tagente',
array('id_agente' => $id_agent, 'disabled' => !$show_disabled)
);
@ -2729,17 +2730,18 @@ function agents_count_agents_filter ($filter = array(), $access = "AR") {
*
* @param int Id agent
* @param string ACL access bit
* @param boolean $force_meta
*
* @return True if user has access, false if user has not permissions and
* null if id agent does not exist
*/
function agents_check_access_agent ($id_agent, $access = "AR") {
function agents_check_access_agent ($id_agent, $access = "AR", $force_meta = false) {
global $config;
if (users_access_to_agent($id_agent, $access)) return true;
if (users_access_to_agent($id_agent, $access, false, $force_meta)) return true;
// If agent exist return false
if (agents_check_agent_exists($id_agent)) return false;
if (agents_check_agent_exists($id_agent, true, $force_meta)) return false;
// Return null otherwise
return null;
}

View File

@ -101,7 +101,7 @@ function returnError($typeError, $returnType = 'string') {
break;
default:
returnData("string",
array('type' => 'string', 'data' => __($typeError)));
array('type' => 'string', 'data' => __($returnType)));
break;
}
}
@ -9281,18 +9281,27 @@ function api_get_agent_id($trash1, $trash2, $data, $returnType) {
* Agent alias for a given id
*
* @param int $id_agent
* @param int $id_node Only for metaconsole
* @param $thrash1 Don't use.
* @param $returnType
*
**/
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_name&id=1&apipass=1234&user=admin&pass=pandora
function api_get_agent_alias($id_agent, $trash1, $trash2, $returnType) {
if (defined ('METACONSOLE')) {
return;
// http://localhost/pandora_console/include/api.php?op=get&op2=agent_alias&id=1&apipass=1234&user=admin&pass=pandora
// http://localhost/pandora_console/enterprise/meta/include/api.php?op=get&op2=agent_alias&id=1&id2=1&apipass=1234&user=admin&pass=pandora
function api_get_agent_alias($id_agent, $id_node, $trash1, $returnType) {
$table_agent_alias = 'tagente';
$force_meta=false;
if (is_metaconsole()) {
$table_agent_alias = 'tmetaconsole_agent';
$force_meta = true;
$id_agent = db_get_value_sql("SELECT id_agente FROM tmetaconsole_agent WHERE id_tagente = $id_agent AND id_tmetaconsole_setup = $id_node");
}
if (!util_api_check_agent_and_print_error($id_agent, $returnType)) return;
if (!util_api_check_agent_and_print_error($id_agent, $returnType, 'AR', $force_meta)) return;
$sql = sprintf('SELECT alias
FROM tagente
FROM ' . $table_agent_alias . '
WHERE id_agente = %d', $id_agent);
$value = db_get_value_sql($sql);
@ -11636,10 +11645,10 @@ function api_get_cluster_items ($cluster_id){
// AUX FUNCTIONS
/////////////////////////////////////////////////////////////////////
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR") {
function util_api_check_agent_and_print_error($id_agent, $returnType, $access = "AR", $force_meta = false) {
global $config;
$check_agent = agents_check_access_agent($id_agent, $access);
$check_agent = agents_check_access_agent($id_agent, $access, $force_meta);
if ($check_agent === true) return true;
if ($check_agent === false || !check_acl($config['id_user'], 0, $access)) {
@ -11651,282 +11660,8 @@ function util_api_check_agent_and_print_error($id_agent, $returnType, $access =
return false;
}
function api_get_user_info($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$separator = ';';
$other = json_decode(base64_decode($other['data']),true);
$sql = 'select * from tusuario where id_user = "'.$other[0]['id_user'].'" and password = "'.$other[0]['password'].'"';
$user_info = db_get_all_rows_sql($sql);
if (count($user_info) > 0 and $user_info !== false) {
$data = array('type' => 'array', 'data' => $user_info);
returnData($returnType, $data, $separator);
}
else {
return 0;
}
}
/*
This function receives different parameters to process one of these actions the logging process in our application from the records in the audit of pandora fms, to avoid concurrent access of administrator users, and optionally to prohibit access to non-administrator users:
Parameter 0
The User ID that attempts the action is used to check the status of the application for access.
Parameter 1
Login, logout, exclude, browse.
These requests receive a response that we can treat as we consider, this function only sends answers, does not perform any action in your application, you must customize them.
Login action: free (register our access), taken, denied (if you are not an administrator user and parameter four is set to 1, register the expulsion).
Browse action: It has the same answers as login, but does not register anything in the audit.
Logout action: It records the deslogeo but does not send a response.
All other actions do not return a response,
Parameter 2
IP address of the application is also used to check the status of the application for access.
Parameter 3
Name of the application, it is also used to check the status of the application for access.
Parameter 4
If you mark 1 you will avoid the access to the non-administrators users, returning the response `denied' and registering that expulsion in the audit of pandora fms.
*/
function api_set_access_process($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$sql = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario != "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence = db_get_all_rows_sql($sql);
$sql_user = 'select id_usuario,utimestamp from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logon%" and id_usuario IN (select id_user from tusuario where is_admin = 1) and id_usuario = "'.$other['data'][0].'" order by utimestamp DESC limit 1';
$audit_concurrence_user = db_get_all_rows_sql($sql_user);
$sql2 = 'select id_usuario,utimestamp,accion from tsesion where descripcion like "%'.$other['data'][2].'%" and accion like "%'.$other['data'][3].'&#x20;Logoff%" and id_usuario = "'.$audit_concurrence[0]['id_usuario'].'" order by utimestamp DESC limit 1';
$audit_concurrence_2 = db_get_all_rows_sql($sql2);
//The user trying to log in is an administrator
if(users_is_admin($other['data'][0])){
//The admin user is trying to login
if($other['data'][1] == 'login'){
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => 'taken'));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'logout') {
// The administrator user wants to log out
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'exclude') {
// The administrator user has ejected another administrator user who was logged in
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2] , $audit_concurrence[0]['id_usuario']);
}
//The admin user is trying to browse
elseif ($other['data'][1] == 'browse') {
// Check if there is an administrator user logged in prior to our last login
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_user[0]['utimestamp']){
// Check if the administrator user logged in later to us has unlogged and left the node free
if($audit_concurrence[0]['utimestamp'] > $audit_concurrence_2[0]['utimestamp']){
// The administrator user logged in later has not yet unlogged
returnData('string', array('type' => 'string', 'data' => $audit_concurrence[0]['id_usuario']));
}
else{
// The administrator user logged in later has already unlogged
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
else{
// There is no administrator user who has logged in since then to log us in.
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
elseif ($other['data'][1] == 'cancelled'){
//The administrator user tries to log in having another administrator logged in, but instead of expelling him he cancels his log in.
db_pandora_audit($other['data'][3].' cancelled access', 'Cancelled access in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'cancelled'));
}
}
else{
if($other['data'][4] == 1){
//The user trying to log in is not an administrator and is not allowed no admin access
db_pandora_audit($other['data'][3].' denied access', 'Denied access to non-admin user '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'denied'));
}
else{
//The user trying to log in is not an administrator and is allowed no admin access
if($other['data'][1] == 'login'){
//The user trying to login is not admin, can enter without concurrent use filter
db_pandora_audit($other['data'][3].' Logon', 'Logged in '.$other['data'][3].' node '.$other['data'][2] , $other['data'][0]);
returnData('string', array('type' => 'string', 'data' => 'free'));
}
elseif ($other['data'][1] == 'logout') {
//The user trying to logoff is not admin
db_pandora_audit($other['data'][3].' Logoff', 'Logout from '.$other['data'][3].' node '.$other['data'][2], $other['data'][0]);
}
elseif ($other['data'][1] == 'browse'){
//The user trying to browse in an app page is not admin, can enter without concurrent use filter
returnData('string', array('type' => 'string', 'data' => 'free'));
}
}
}
}
function api_get_traps($thrash1, $thrash2, $other, $returnType) {
if (defined ('METACONSOLE')) {
return;
}
$other['data'] = explode('|',$other['data']);
$other['data'][1] = date("Y-m-d H:i:s",$other['data'][1]);
$sql = 'SELECT * from ttrap where timestamp >= "'.$other['data'][1].'"';
// $sql = 'SELECT * from ttrap where source = "'.$other['data'][0].'" and timestamp >= "'.$other['data'][1].'"';
if($other['data'][4]){
$other['data'][4] = date("Y-m-d H:i:s",$other['data'][4]);
$sql .= ' and timestamp <= "'.$other['data'][4].'"';
}
if($other['data'][2]){
$sql .= ' limit '.$other['data'][2];
}
if($other['data'][3]){
$sql .= ' offset '.$other['data'][3];
}
if($other['data'][5]){
$sql .= ' and status = 0';
}
if(sizeof($other['data']) == 0){
$sql = 'SELECT * from ttrap';
}
$traps = db_get_all_rows_sql($sql);
if($other['data'][6]){
foreach ($traps as $key => $value) {
if(!strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'false'){
unset($traps[$key]);
}
if(strpos($value['oid_custom'],$other['data'][6]) && $other['data'][7] == 'true'){
unset($traps[$key]);
}
}
}
$traps_json = json_encode($traps);
if (count($traps) > 0 and $traps !== false) {
returnData('string', array('type' => 'string', 'data' => $traps_json));
}
else {
return 0;
}
}
function api_set_validate_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
if($id == 'all'){
$result = db_process_sql_update('ttrap',array('status' => 1));
}
else{
$result = db_process_sql_update('ttrap',
array('status' => 1), array('id_trap' => $id));
}
if (is_error($result)) {
// TODO: Improve the error returning more info
returnError('error_update_trap', __('Error in trap update.'));
}
else {
returnData('string',
array('type' => 'string',
'data' => __('Validated traps.')));
}
}
function api_set_delete_traps ($id, $thrash2, $other, $thrash3) {
if (defined ('METACONSOLE')) {
return;
}
if($id == 'all'){
$result = db_process_sql ('delete from ttrap');
}
else{
$result = db_process_sql_delete('ttrap',array('id_trap' => $id));
}
if (is_error($result)) {
// TODO: Improve the error returning more info
returnError('error_delete_trap', __('Error in trap delete.'));
}
else {
returnData('string',
array('type' => 'string',
'data' => __('Deleted traps.')));
}
}
?>

View File

@ -1149,7 +1149,7 @@ function events_print_type_description ($type, $return = false) {
break;
case "going_down_critical":
case "going_up_critical": //This is to be backwards compatible
$output .= __('Going down to critical state');
$output .= __('Going up to critical state');
break;
case "going_up_normal":
case "going_down_normal": //This is to be backwards compatible
@ -1850,15 +1850,20 @@ function events_get_response_target($event_id, $response_id, $server_id, $histor
// Substitute each macro
if (strpos($target, '_agent_address_') !== false) {
if ($meta) {
$server = metaconsole_get_connection_by_id ($server_id);
metaconsole_connect($server);
}
$target = str_replace('_agent_address_', $event['id_agente'], $target);
if($meta) {
metaconsole_restore_db_force();
$agente_table_name = 'tmetaconsole_agent';
$filter = array(
'id_tagente' => $event['id_agente'],
'id_tmetaconsole_setup' => $server_id
);
} else {
$agente_table_name = 'tagente';
$filter = array('id_agente' => $event['id_agente']);
}
$ip = db_get_value_filter('direccion', $agente_table_name, $filter);
// If agent has not an ip, display N/A
if ($ip === false) $ip = __('N/A');
$target = str_replace('_agent_address_', $ip, $target);
}
if (strpos($target, '_agent_id_') !== false) {
$target = str_replace('_agent_id_', $event['id_agente'], $target);
@ -2664,13 +2669,14 @@ function events_page_comments ($event, $childrens_ids = array()) {
}
break;
}
if ((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) {
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%;"', true);
if (((tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EM", $event['clean_tags'], $childrens_ids)) || (tags_checks_event_acl($config["id_user"], $event["id_grupo"], "EW", $event['clean_tags'],$childrens_ids))) && $config["show_events_in_local"] == false || $config["event_replication"] == false) {
$comments_form = '<br><div id="comments_form" style="width:98%;">'.html_print_textarea("comment", 3, 10, '', 'style="min-height: 15px; width: 100%; disabled"', true);
$comments_form .= '<br><div style="text-align:right;">'.html_print_button(__('Add comment'),'comment_button',false,'event_comment();','class="sub next"',true).'</div><br></div>';
}
else {
$comments_form = '';
$comments_form = ui_print_message(__( 'If event replication is ongoing, it won\'t be possible to enter comments here. This option is only to allow local pandora users to see comments, but not to operate with them. The operation, when event replication is enabled, must be done only in the Metaconsole.'));
}
$comments = '<div id="extended_event_comments_page" class="extended_event_pages">'.$comments_form.html_print_table($table_comments, true).'</div>';

View File

@ -3072,10 +3072,9 @@ function graph_custom_sql_graph ($id, $width, $height,
}
}
}
$flash_charts = $config['flash_charts'];
if ($only_image) {
$flash_charts = true;
if ($ttl == 2) {
$flash_charts = false;
}
@ -3105,9 +3104,9 @@ function graph_custom_sql_graph ($id, $width, $height,
$ttl,
$homeurl,
"white",
true,
false,
false,
"c1c1c1"
"#c1c1c1"
);
break;
case 'sql_graph_hbar': // horizontal bar
@ -3129,7 +3128,7 @@ function graph_custom_sql_graph ($id, $width, $height,
$ttl,
$homeurl,
'white',
'c1c1c1'
'#c1c1c1'
);
break;
case 'sql_graph_pie': // Pie

View File

@ -666,6 +666,7 @@ function planned_downtimes_stop ($downtime) {
function planned_downtimes_created ($values) {
global $config;
$check_group = (bool) db_get_value ('id_grupo', 'tgrupo', 'id_grupo', $values['id_group']);
$check = (bool) db_get_value ('name', 'tplanned_downtime', 'name', $values['name']);
$datetime_from = strtotime ($values['once_date_from'] . ' ' . $values['once_time_from']);
@ -702,6 +703,11 @@ function planned_downtimes_created ($values) {
'message' => __('Not created. Error inserting data') . ". "
. __('The end day must be higher than the start day'));
}
else if (!$check_group && $values['id_group'] != 0) {
return array('return' => false,
'message' => __('Not created. Error inserting data') . ". "
. __('Group not exist'));
}
else {
if (trim(io_safe_output($values['name'])) != '') {
if (!$check) {

View File

@ -381,7 +381,7 @@ function reporting_html_SLA($table, $item, $mini) {
}
}
if(isset($item['data'])){
if(!(!isset($item['data']) && $hide_notinit_agent == 1)) {
$table1 = new stdClass();
$table1->width = '99%';
@ -471,20 +471,23 @@ function reporting_html_SLA($table, $item, $mini) {
foreach ($item['data'] as $sla) {
if(isset($sla)){
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
if (!$hide_notinit_agent) {
//first_table
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']);
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
//first_table
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']);
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
if (!$hide_notinit_agent) {
if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
@ -646,6 +649,11 @@ function reporting_html_SLA($table, $item, $mini) {
$table->colspan['checks_global']['cell'] = 2;
$table->data['checks_global']['cell'] = html_print_table($table3, true);
}
else {
$table->colspan['error']['cell'] = 3;
$table->data['error']['cell'] =
__('There are no Agent/Modules defined');
}
if (!empty($item['charts'])) {
$table1 = new stdClass();
@ -2319,7 +2327,7 @@ function reporting_html_availability(&$table, $item) {
global $config;
if (!empty($item["data"])) {
if (!empty($item["data"]) || $hide_notinit_agent !=1) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();

View File

@ -468,8 +468,6 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
enterprise_include_once ('meta/include/functions_ui_meta.php');
include_graphs_dependencies();
$strict_user = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
$is_extra = enterprise_hook('policies_is_agent_extra_policy', array($id_agente));
if ($is_extra === ENTERPRISE_NOT_HOOK) {
@ -483,9 +481,13 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
return;
}
// Get the agent info
$agent = db_get_row ("tagente", "id_agente", $id_agente);
if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) {
if ($agent == false) return;
// Check all groups
$groups = agents_get_all_groups_agent($id_agente, $agent["id_grupo"], is_metaconsole());
if (! check_acl_one_of_groups ($config["id_user"], $groups, "AR") && ! check_acl_one_of_groups ($config["id_user"], $groups, "AW") && !$is_extra) {
db_pandora_audit("ACL Violation",
"Trying to access Agent General Information");
require_once ("general/noaccess.php");
@ -522,7 +524,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
$hashdata = $user.$pwd_deserialiced['auth_token'];
$hashdata = md5($hashdata);
$url = $server_data["server_url"] . "/index.php?" .
$url = "//" . $server_data["server_url"] . "/index.php?" .
"sec=estado&" .
"sec2=operation/agentes/ver_agente&" .
"id_agente=" . $agent["id_agente"] . "&" .
@ -608,7 +610,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals
$go_to_agent = '<div style="text-align: right;">';
if($agent["id_os"] != 100){
$go_to_agent .= '<a target=_blank href="' . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
$go_to_agent .= '<a target=_blank href="' . "//" . $console_url . 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente='.$id_agente.$url_hash.'">';
$go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true);
}
else{

View File

@ -1968,6 +1968,23 @@ function ui_print_help_tip ($text, $return = false, $img = 'images/tip.png', $is
echo $output;
}
function ui_print_help_tip_border ($text, $return = false, $img = 'images/tip_border.png', $is_relative = false) {
$output =
'<a href="javascript:" class="tip" >' .
html_print_image (
$img,
true,
array('title' => $text),
false,
$is_relative && is_metaconsole()
) .
'</a>';
if ($return)
return $output;
echo $output;
}
/**
* Powerful debug function that also shows a backtrace.
*

View File

@ -476,20 +476,20 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['background_row_2']['items'] = array('background', 'datos');
$form_items['background_row_2']['html'] = '<td align="left">' .
__('Original Size') . '</td>
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub"', true) . '</td>';
<td align="left">' . html_print_button(__('Apply'), 'original_false', false, "setAspectRatioBackground('original')", 'class="sub vs_button_ghost"', true) . '</td>';
$form_items['background_row_3'] = array();
$form_items['background_row_3']['items'] = array('background', 'datos');
$form_items['background_row_3']['html'] = '<td align="left">' .
__('Aspect ratio') . '</td>
<td align="left">' . html_print_button(__('Width proportional'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub"', true) . '</td>';
<td align="left">' . html_print_button(__('Proportional Width'), 'original_false', false, "setAspectRatioBackground('width')", 'class="sub vs_button_ghost"', true) . '</td>';
$form_items['background_row_4'] = array();
$form_items['background_row_4']['items'] = array('background', 'datos');
$form_items['background_row_4']['html'] = '<td align="left"></td>
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub"', true) . '</td>';
<td align="left">' . html_print_button(__('Height proportional'), 'original_false', false, "setAspectRatioBackground('height')", 'class="sub vs_button_ghost"', true) . '</td>';
$form_items['percentile_bar_row_1'] = array();

View File

@ -187,35 +187,27 @@ function vbar_graph(
$tick_color);
}
else {
$new_chart_data = array();
foreach ($chart_data as $key => $value) {
if(strlen($key) > 20 && strpos($key, ' - ') !== false){
$key_temp = explode(" - ",$key);
$key_temp[0] = $key_temp[0]." \n";
$key_temp[1]= '...'.substr($key_temp[1],-15);
$key2 = $key_temp[0].$key_temp[1];
io_safe_output($key2);
$new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
} else {
$new_chart_data[$key] = $value;
}
}
$graph = array();
$graph['data'] = $new_chart_data;
$graph['width'] = $width;
$graph['height'] = $height;
$graph['color'] = $color;
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['water_mark'] = $water_mark_file;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$id_graph = serialize_in_temp($graph, null, $ttl);
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
$params['flash_chart'] = true;
$params['chart_data'] = $chart_data;
$params['width'] = $width;
$params['height'] = $height;
$params['color'] = $color;
$params['legend'] = $legend;
$params['long_index'] = $long_index;
$params['no_data_image'] = $no_data_image;
$params['xaxisname'] = $xaxisname;
$params['yaxisname'] = $yaxisname;
$params['water_mark'] = $water_mark;
$params['font'] = $font;
$params['font_size'] = $font_size;
$params['unit'] = $unit;
$params['ttl'] = 2;
$params['homeurl'] = $homeurl;
$params['backgroundColor'] = $backgroundColor;
$params['from_ux'] = $from_ux;
$params['from_wux'] = $from_wux;
$params['tick_color'] = $tick_color;
return generator_chart_to_pdf('vbar', $params);
}
}
@ -312,37 +304,27 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
$chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
}
else {
foreach ($chart_data as $key => $value) {
$str_key = io_safe_output($key);
if(strlen($str_key) > 40){
if(strpos($str_key, ' - ') != -1){
$key_temp = explode(" - ",$str_key);
$key_temp[0] = $key_temp[0]." <br>";
$key_temp[1]= '...'.substr($key_temp[1],-20);
$key2 = $key_temp[0].$key_temp[1];
}
$chart_data[$key2]['g'] = $chart_data[$key]['g'];
unset($chart_data[$key]);
}
}
$graph = array();
$graph['data'] = $chart_data;
$graph['width'] = $width;
$graph['height'] = $height;
$graph['color'] = $color;
$graph['legend'] = $legend;
$graph['xaxisname'] = $xaxisname;
$graph['yaxisname'] = $yaxisname;
$graph['force_height'] = $force_height;
$graph['water_mark'] = $water_mark_file;
$graph['font'] = $font;
$graph['font_size'] = $font_size;
$graph['force_steps'] = $force_steps;
$id_graph = serialize_in_temp($graph, null, $ttl);
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
$params['flash_chart'] = true;
$params['chart_data'] = $chart_data;
$params['width'] = $width;
$params['height'] = $height;
$params['color'] = $color;
$params['legend'] = $legend;
$params['long_index'] = $long_index;
$params['no_data_image'] = $no_data_image;
$params['xaxisname'] = $xaxisname;
$params['yaxisname'] = $yaxisname;
$params['water_mark'] = $water_mark;
$params['font'] = $font;
$params['font_size'] = $font_size;
$params['unit'] = $unit;
$params['ttl'] = 2;
$params['homeurl'] = $homeurl;
$params['backgroundColor'] = $backgroundColor;
$params['tick_color'] = $tick_color;
$params['val_min'] = $val_min;
$params['val_max'] = $val_max;
return generator_chart_to_pdf('hbar', $params);
}
}

View File

@ -2262,17 +2262,25 @@ function pandoraFlotArea( graph_id, values, legend,
}
$('#overview_' + graph_id).css('display', 'none');
if (menu) {
var parent_height;
$('#menu_overview_' + graph_id).click(function() {
$('#overview_' + graph_id).toggle();
});
$("#menu_export_csv_"+graph_id)
.click(function (event) {
event.preventDefault();
$("#menu_export_csv_"+graph_id).click(function (e) {
e.preventDefault();
plot.exportDataCSV();
var es_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if(es_firefox){
$("#dialog").css('visibility', 'visible').dialog();
}
delete data_base[0].threshold;
plot = $.plot($('#' + graph_id), data_base,
$.extend(true, {}, options, {
legend: { show: true }
}));
});
$('#menu_threshold_' + graph_id).click(function() {

View File

@ -11,7 +11,7 @@
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
<h3>Validate</h3>
<?php html_print_image("images/tick.png", false, array("title" => "Validated event", "alt" => "Validated event", "width" => '10', "height" => '10')); ?> - Validated event<br>
<?php html_print_image("images/cross.png", false, array("title" => "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?> - Event not validated
<?php //html_print_image("images/cross.png", false, array("title" => "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?><div style="width: 10px;height: 10px; display: inline-block;"></div> - Event not validated
</div>
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
@ -27,7 +27,8 @@
<h3>Actions</h3>
<?php html_print_image("images/ok.png", false, array("title" => "Validate event", "alt" => "Validate event")); ?> - Validate event<br>
<?php html_print_image("images/cross.png", false, array("title" => "Delete event", "alt" => "Delete event")); ?> - Delete event<br>
<?php html_print_image("images/page_lightning.png", false, array("title" => "Create incident from event", "alt" => "Create incident from event")); ?> - Create incident from event
<?php html_print_image("images/eye.png", false, array("title" => "Show more", "alt" => "Show more")); ?> - Show more<br>
<?php html_print_image("images/hourglass.png", false, array("title" => "In progress", "alt" => "In progress")); ?> - In progress
</div>
<div style="clear: both;">&nbsp;</div>

View File

@ -30,43 +30,43 @@
This macros can be used in module alerts.
</p>
<h2>Si el módulo es de tipo analisis de módulo web:</h2>
<h2>IF THE MODULE IS A WEB MODULE ANALYSIS TYPE: </h2>
<p>
Las macros dinámicas tendrán un formato especial que empieza por @ y tendrán estas posibles sustituciones:
Dynamic macros will have a special format starting with @ and will have these possible substitutions:
</p>
<ol>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT (fecha/hora actual con formato definido por el usuario)
@DATE_FORMAT (current date/time with user-defined format)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_nh (horas)
@DATE_FORMAT_nh (hours)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_nm (minutos)
@DATE_FORMAT_nm (minutes)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_nd (días)
@DATE_FORMAT_nd (days)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_ns (segundos)
@DATE_FORMAT_ns (seconds)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_nM (mes)
@DATE_FORMAT_nM (month)
</li>
<li style="font-family: 'lato-bolder'; font-size: 12pt;">
@DATE_FORMAT_nY (años)
@DATE_FORMAT_nY (years)
</li>
</ol>
<p>
Donde “n” puede ser un numero sin signo (positivo) o negativo.
Where "n" can be a number without a sign (positive) or negative.
</p>
<p>
Y FORMAT sigue el standard de strftime de perl:
And FORMAT follows the standard of perl's strftime:
http://search.cpan.org/~dexter/POSIX-strftime-GNU-0.02/lib/POSIX/strftime/GNU.pm
</p>
<p>
Ejemplos:
Examples:
</p>
<pre>
@DATE_%Y-%m-%d %H:%M:%S

View File

@ -11,7 +11,7 @@
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
<h3>Validar</h3>
<?php html_print_image("images/tick.png", false, array("title" => "Validated event", "alt" => "Validated event", "width" => '10', "height" => '10')); ?> - Validar evento<br>
<?php html_print_image("images/cross.png", false, array("title" => "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?> - Evento no validado
<?php //html_print_image("images/cross.png", false, array("title" => "Event not validated", "alt" => "Event not validated", "width" => '10', "height" => '10')); ?><div style="width: 10px;height: 10px; display: inline-block;"></div> - Evento no validado
</div>
<div style="padding-left: 30px; width: 150px; float: left; line-height: 17px;">
@ -27,7 +27,8 @@
<h3>Acciones</h3>
<?php html_print_image("images/ok.png", false, array("title" => "Validate event", "alt" => "Validate event")); ?> - Validar evento<br>
<?php html_print_image("images/cross.png", false, array("title" => "Delete event", "alt" => "Delete event")); ?> - Borrar evento<br>
<?php html_print_image("images/page_lightning.png", false, array("title" => "Create incident from event", "alt" => "Create incident from event")); ?> - Crear incidente del evento
<?php html_print_image("images/eye.png", false, array("title" => "Mostrar más", "alt" => "Mostrar más")); ?> - Mostrar más<br>
<?php html_print_image("images/hourglass.png", false, array("title" => "En progreso", "alt" => "En progreso")); ?> - En progreso
</div>
<div style="clear: both;">&nbsp;</div>

View File

@ -653,6 +653,15 @@ input.sub[disabled] {
cursor: default;
}
input.vs_button_ghost{
background-color: transparent !important;
border: 1px solid #82b92e;
color: #82b92e !important;
text-align: center;
padding: 4px 12px;
font-weight: bold;
}
input.next, input.upd, input.ok, input.wand, input.delete, input.cog,
input.target, input.search, input.copy, input.add, input.graph,
input.percentile, input.binary, input.camera, input.config,
@ -1393,6 +1402,37 @@ table.databox {
color: #222 !important;
}
.databox.data>tbody>tr>td:first-child{
border-left: 1px solid #e2e2e2;
}
.databox.data>tbody>tr:last-child>td:first-child{
border-bottom-left-radius: 4px;
}
.databox.data>tbody>tr>td:last-child {
border-right: 1px solid #e2e2e2;
}
.databox.data>tbody>tr:last-child >td:last-child {
border-bottom-right-radius: 4px;
}
.databox.data>thead>tr:first-child>th:first-child {
border-left: 1px solid #e2e2e2;
border-top-left-radius: 4px;
border-color: #373737;
}
.databox.data>thead>tr:first-child>th:last-child {
border-right: 1px solid #e2e2e2;
border-top-right-radius: 4px;
border-color: #373737;
}
.databox.data{
border: none;
}
.tabletitle {
color: #333;
}

View File

@ -1058,6 +1058,7 @@ else {
$_GET['sec2'] = 'general/logon_ok';
break;
case 'Dashboard':
$dashboard_from_main_page = 1;
$id_dashboard = db_get_value('id', 'tdashboard', 'name', $home_url);
$str = 'sec=reporting&sec2='.ENTERPRISE_DIR.'/dashboard/main_dashboard&id='.$id_dashboard;
parse_str($str, $res);

View File

@ -100,8 +100,11 @@ $alias = db_get_value ("alias","tagente","id_agente",$id_agent);
</script>
</head>
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
echo"<div id='dialog' title='".__('CSV Export Information')."' style='visibility:hidden;'>";
echo"<p>" . __('The CSV export has been successful.') . "</p>";
echo"</div>";
// Module id
$id = (int) get_parameter ("id", 0);
// Agent id

View File

@ -68,14 +68,18 @@ if (is_ajax ()) {
}
}
else {
$groups_orig = users_get_groups(false, $privilege);
$groups_orig = users_get_groups(false, $privilege, false);
$groups = array_keys($groups_orig);
}
// Build filter
$filter = array();
$filter['id_grupo'] = $groups;
// Group filter (primary and secondary)
$filter[] = "(" .db_format_array_where_clause_sql(
array('id_grupo' => $groups, 'id_group' => $groups),
'OR'
) . ")";
if (!empty($id_os))
$filter['id_os'] = $id_os;
if (!empty($agent_name))
@ -158,12 +162,17 @@ if (is_ajax ()) {
}
}
$filter['group'] = 'id_agente';
// Build fields
$fields = array('id_agente', 'alias');
// Perform search
$agents = db_get_all_rows_filter('tagente', $filter, $fields);
$agents = db_get_all_rows_filter(
'tagente LEFT JOIN tagent_secondary_group ON id_agente=id_agent',
$filter,
$fields
);
if (empty($agents)) $agents = array();
foreach ($agents as $k => $v) {

View File

@ -680,7 +680,14 @@ else {
}
$comments_help_tip = "";
if (!empty($event_user_comment_str)) {
$comments_help_tip = ui_print_help_tip($event_user_comment_str, true);
if($myclass == 'datos_yellow'){
$comments_help_tip = ui_print_help_tip_border($event_user_comment_str, true);
}
else{
$comments_help_tip = ui_print_help_tip($event_user_comment_str, true);
}
}
$data[$i] = '<span id="comment_header_' . $event['id_evento'] . '">' . $comments_help_tip . '</span>';

View File

@ -385,10 +385,11 @@ $data = array();
$autorefresh_list_out = array();
if(is_metaconsole()) {
$autorefresh_list_out['monitoring/tactical'] = "tactical";
$autorefresh_list_out['monitoring/group_view'] = "group_view";
} else {
$autorefresh_list_out['operation/agentes/tactical'] = "tactical";
$autorefresh_list_out['operation/agentes/group_view'] = "group_view";
}
$autorefresh_list_out['operation/agentes/group_view'] = "group_view";
$autorefresh_list_out['operation/agentes/estado_agente'] = "agent_status";
$autorefresh_list_out['operation/agentes/alerts_status'] = "alerts_status";
$autorefresh_list_out['operation/agentes/status_monitor'] = "status_monitor";

View File

@ -3294,7 +3294,7 @@ CREATE TABLE IF NOT EXISTS `tautoconfig_actions` (
-- ---------------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `tlayout_template` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`name` varchar(600) NOT NULL,
`id_group` INTEGER UNSIGNED NOT NULL,
`background` varchar(200) NOT NULL,
`height` INTEGER UNSIGNED NOT NULL default 0,