Merge branch 'ent-3595-discovery-fase-2' of https://brutus.artica.lan:8081/artica/pandorafms into ent-3595-discovery-fase-2

Former-commit-id: 4ac64c1af6d4487f6a5d1ad1a55400b1879bb730
This commit is contained in:
alejandro-campos 2019-03-20 15:48:37 +01:00
commit 791a3ccfc6
95 changed files with 5776 additions and 3187 deletions

View File

@ -1,10 +1,10 @@
package: pandorafms-agent-unix
Version: 4.0.1
Version: 7.0
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Homepage: http://pandorafms.org/
Maintainer: ÁRTICA ST <info@artica.es>
Homepage: https://pandorafms.org/
Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -1,10 +1,10 @@
package: pandorafms-agent
Version: 4.0
Version: 7.0
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Maintainer: ÁRTICA ST <info@artica.es>
Homepage: http://pandorafms.org/
Depends: coreutils, perl
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -1,10 +1,10 @@
package: pandorafms-agent-unix
Version: 7.0NG.732-190311
Version: 7.0NG.732-190313
Architecture: all
Priority: optional
Section: admin
Installed-Size: 260
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Maintainer: ÁRTICA ST <info@artica.es>
Homepage: http://pandorafms.org/
Depends: coreutils, perl, unzip
Description: Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment. These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.732-190311"
pandora_version="7.0NG.732-190313"
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

@ -42,7 +42,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.732';
use constant AGENT_BUILD => '190311';
use constant AGENT_BUILD => '190313';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.732
%define release 190311
%define release 190313
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.732
%define release 190311
%define release 190313
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.732"
PI_BUILD="190311"
PI_BUILD="190313"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{190311}
{190313}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.732(Build 190311)")
#define PANDORA_VERSION ("7.0NG.732(Build 190313)")
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", "(7.0NG.732(Build 190311))"
VALUE "ProductVersion", "(7.0NG.732(Build 190313))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.732-190311
Version: 7.0NG.732-190313
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="7.0NG.732-190311"
pandora_version="7.0NG.732-190313"
package_pear=0
package_pandora=1
@ -149,7 +149,7 @@ if [ $package_pear -eq 1 ]
then
echo "Make the package \"php-xml-rpc\"."
cd temp_package
dh-make-pear --maintainer "Miguel de Dios <miguel.dedios@artica.es>" XML_RPC
dh-make-pear --maintainer "ÁRTICA ST <info@artica.es>" XML_RPC
cd php-xml-rpc-*
dpkg-buildpackage -rfakeroot
cd ..

View File

@ -7,4 +7,6 @@ ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) defau
-- ----------------------------------------------------------------------
ALTER TABLE tagent_custom_fields ADD COLUMN `combo_values` VARCHAR(255) DEFAULT '';
ALTER TABLE `treport_content` ADD COLUMN `show_extended_events` tinyint(1) default '0';
COMMIT;

View File

@ -106,7 +106,9 @@ function get_value_sum($arr)
{
foreach ($arr as $clave) {
foreach ($clave as $valor) {
$result += $valor;
if (is_numeric($valor) === true) {
$result += $valor;
}
}
}

View File

@ -30,6 +30,33 @@ require_once 'include/functions_notifications.php';
$notifications_numbers['last_id']
).'</div>';
// ======= Servers List ===============================================
$servers_list = '<div id="servers_list">';
$servers = [];
$servers['all'] = (int) db_get_value('COUNT(id_server)', 'tserver');
if ($servers['all'] != 0) {
$servers['up'] = (int) servers_check_status();
$servers['down'] = ($servers['all'] - $servers['up']);
if ($servers['up'] == 0) {
// All Servers down or no servers at all.
$servers_check_img = html_print_image('images/header_down_gray.png', true, ['alt' => 'cross', 'class' => 'bot', 'title' => __('All systems').': '.__('Down')]);
} else if ($servers['down'] != 0) {
// Some servers down.
$servers_check_img = html_print_image('images/header_warning_gray.png', true, ['alt' => 'error', 'class' => 'bot', 'title' => $servers['down'].' '.__('servers down')]);
} else {
// All servers up.
$servers_check_img = html_print_image('images/header_ready_gray.png', true, ['alt' => 'ok', 'class' => 'bot', 'title' => __('All systems').': '.__('Ready')]);
}
unset($servers);
// Since this is the header, we don't like to trickle down variables.
$servers_check_img_link = '<a class="white" href="index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60">';
$servers_check_img_link .= $servers_check_img;
$servers_check_img_link .= '</a>';
};
$servers_list .= $servers_check_img_link.'</div>';
// ======= Alerts ===============================================
$check_minor_release_available = false;
@ -48,7 +75,7 @@ require_once 'include/functions_notifications.php';
}
// Chat messages
// Chat messages.
$header_chat = "<div id='header_chat'><span id='icon_new_messages_chat' style='display: none;'>";
$header_chat .= "<a href='index.php?sec=workspace&sec2=operation/users/webchat'>";
$header_chat .= html_print_image('images/header_chat_gray.png', true, ['title' => __('New chat message')]);
@ -180,7 +207,7 @@ require_once 'include/functions_notifications.php';
$header_autorefresh_counter = '<div id="header_autorefresh_counter" style="'.$display_counter.'">'.$autorefresh_link_open_txt.$autorefresh_txt.$autorefresh_link_close.$autorefresh_additional.'</div>';
// qr
// Qr.
if ($config['show_qr_code_header'] == 0) {
$show_qr_code_header = 'display: none;';
} else {
@ -209,7 +236,7 @@ require_once 'include/functions_notifications.php';
});
</script>
<?php
// User
// User.
if (is_user_admin($config['id_user']) == 1) {
$header_user = html_print_image('images/header_user_admin_green.png', true, ['title' => __('Edit my user'), 'class' => 'bot', 'alt' => 'user']);
} else {
@ -218,13 +245,13 @@ require_once 'include/functions_notifications.php';
$header_user = '<div id="header_user"><a href="index.php?sec=workspace&sec2=operation/users/user_edit">'.$header_user.'<span> ('.$config['id_user'].')</span></a></div>';
// Logout
// Logout.
$header_logout = '<div id="header_logout"><a class="white" href="'.ui_get_full_url('index.php?bye=bye').'">';
$header_logout .= html_print_image('images/header_logout_gray.png', true, ['alt' => __('Logout'), 'class' => 'bot', 'title' => __('Logout')]);
$header_logout .= '</a></div>';
echo '<div class="header_left">'.$header_autorefresh, $header_autorefresh_counter, $header_qr, $header_chat.'</div>
<div class="header_center">'.$header_searchbar, $header_discovery.'</div>
<div class="header_center">'.$header_searchbar, $header_discovery, $servers_list.'</div>
<div class="header_right">'.$header_user, $header_logout.'</div>';
?>
</div> <!-- Closes #table_header_inner -->

View File

@ -82,42 +82,30 @@ if (!empty($page) && !empty($sec)) {
}
$login_body_style = '';
// Overrides the default background with the defined by the user
// Overrides the default background with the defined by the user.
if (!empty($config['login_background'])) {
$background_url = 'images/backgrounds/'.$config['login_background'];
$login_body_style = "style=\"background-image: url('$background_url');\"";
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
}
// Get the custom icons
// Get the custom icons.
$docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo();
echo '<div id="login_body" '.$login_body_style.'>';
echo '<div id="header_login">';
echo '<div id="icon_custom_pandora">';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if (isset($config['custom_logo'])) {
echo '<img src="enterprise/images/custom_logo/'.$config['custom_logo'].'" alt="monitoring_console">';
} else {
echo '<img src="images/custom_logo/pandora_logo_head_4.png" alt="monitoring_console">';
}
} else {
echo '<img src="images/custom_logo/pandora_logo_head_3.png" alt="monitoring_console">';
}
echo '</div>';
echo '<div id="list_icon_docs_support"><ul style="line-height: 36px;">';
echo '<div id="list_icon_docs_support"><ul>';
if ($docs_logo !== false) {
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
}
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if ($support_logo !== false) {
echo '<li id="li_margin_left"><a href="'.$config['custom_support_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
}
echo '<li><a style="color: white; font-size:inherit;" href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
} else {
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
echo '<li>'.__('Support').'</li>';
@ -151,7 +139,8 @@ if (defined('METACONSOLE')) {
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
}
echo "<br><span style='font-size:120%;color:white;top:10px;position:relative;'>Community edition</span>";
// I comment this in case in the future we put a logo without text.
// echo "<br><span style='font-size:120%;color:white;top:10px;position:relative;'>Community edition</span>";.
}
echo '</a></div>';
@ -167,9 +156,6 @@ switch ($login_screen) {
if ($config['auth'] == 'saml') {
echo '<div id="log_nick" class="login_nick" style="display: none;">';
echo '<div>';
html_print_image('/images/usuario_login.png', false);
echo '</div>';
html_print_input_text_extended(
'nick',
'',
@ -184,9 +170,6 @@ switch ($login_screen) {
echo '</div>';
echo '<div id="log_pass" class="login_pass" style="display: none;">';
echo '<div>';
html_print_image('/images/candado_login.png', false);
echo '</div>';
html_print_input_text_extended(
'pass',
'',
@ -202,54 +185,48 @@ switch ($login_screen) {
);
echo '</div>';
echo '<div id="log_button" class="login_button" style="display: none; margin-bottom: 20px;">';
echo '<div id="log_button" class="login_button" style="display: none;">';
html_print_submit_button(__('Login as admin'), 'login_button', false, 'class="sub next_login"');
echo '</div>';
echo '<div class="login_button" id="remove_button" style="margin-bottom: 20px;">';
echo '<div class="login_button" id="remove_button">';
echo '<input type="button" id="input_saml" value="Login as admin" onclick="show_normal_menu()">';
echo '</div>';
echo '<div class="login_button">';
echo '<div class="login_button login_button_saml">';
html_print_submit_button(__('Login with SAML'), 'login_button_saml', false, '');
echo '</div>';
} else {
echo '<div class="login_nick">';
echo '<div>';
html_print_image('/images/usuario_login.png', false);
echo '</div>';
html_print_input_text_extended(
'nick',
'',
'nick',
'',
'',
'',
false,
'',
'autocomplete="off" placeholder="'.__('User').'"'
);
html_print_input_text_extended(
'nick',
'',
'nick',
'',
'',
'',
false,
'',
'autocomplete="off" placeholder="'.__('User').'"'
);
echo '</div>';
echo '<div class="login_pass">';
echo '<div>';
html_print_image('/images/candado_login.png', false);
echo '</div>';
html_print_input_text_extended(
'pass',
'',
'pass',
'',
'',
'',
false,
'',
'autocomplete="off" placeholder="'.__('Password').'"',
false,
true
);
html_print_input_text_extended(
'pass',
'',
'pass',
'',
'',
'',
false,
'',
'autocomplete="off" placeholder="'.__('Password').'"',
false,
true
);
echo '</div>';
echo '<div class="login_button">';
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
html_print_submit_button(__('Login'), 'login_button', false, 'class="sub next_login"');
echo '</div>';
}
break;
@ -289,9 +266,9 @@ switch ($login_screen) {
if ($config['enterprise_installed']) {
if ($config['reset_pass_option']) {
$reset_pass_link = 'reset_pass.php';
// Reset password link
echo '<div style="width:70%; height:40px; margin-right:auto; margin-left:auto; margin-top:20px; text-align:center;">';
echo '<a style="color: white !important;" href="index.php?reset=true&first=true">'.__('Forgot your password?');
// Reset password link.
echo '<div class="reset_password">';
echo '<a href="index.php?reset=true&first=true">'.__('Forgot your password?');
echo '</a>';
echo '</div>';
}
@ -544,7 +521,7 @@ ui_require_jquery_file('jquery-ui.min');
?>
<?php
// Hidden div to forced title
// Hidden div to forced title.
html_print_div(['id' => 'forced_title_layer', 'class' => 'forced_title_layer', 'hidden' => true]);
// html_print_div(array('id' => 'modal_alert', 'hidden' => true));

View File

@ -1,17 +1,32 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
@ -51,15 +66,22 @@ if (is_ajax()) {
}
if (!is_metaconsole()) {
// Header
ui_print_page_header(__('Module groups defined in %s', get_product_name()), 'images/module_group.png', false, '', true, '');
// Header.
ui_print_page_header(
__('Module groups defined in %s', get_product_name()),
'images/module_group.png',
false,
'',
true,
''
);
}
$create_group = (bool) get_parameter('create_group');
$update_group = (bool) get_parameter('update_group');
$delete_group = (bool) get_parameter('delete_group');
// Create group
// Create group.
if ($create_group) {
$name = (string) get_parameter('name');
$icon = (string) get_parameter('icon');
@ -70,22 +92,29 @@ if ($create_group) {
if ($name) {
if (!$check) {
$result = db_process_sql_insert('tmodule_group', ['name' => $name]);
$result = db_process_sql_insert(
'tmodule_group',
['name' => $name]
);
if ($result) {
ui_print_success_message(__('Group successfully created'));
} else {
ui_print_error_message(__('There was a problem creating group'));
ui_print_error_message(
__('There was a problem creating group')
);
}
} else {
ui_print_error_message(__('Each module group must have a different name'));
ui_print_error_message(
__('Each module group must have a different name')
);
}
} else {
ui_print_error_message(__('Module group must have a name'));
}
}
// Update group
// Update group.
if ($update_group) {
$id_group = (int) get_parameter('id_group');
$name = (string) get_parameter('name');
@ -98,38 +127,79 @@ if ($update_group) {
if ($name) {
if (!$check || $subcheck == $name) {
$result = db_process_sql_update('tmodule_group', ['name' => $name], ['id_mg' => $id_group]);
$result = db_process_sql_update(
'tmodule_group',
['name' => $name],
['id_mg' => $id_group]
);
if ($result !== false) {
ui_print_success_message(__('Group successfully updated'));
} else {
ui_print_error_message(__('There was a problem modifying group'));
ui_print_error_message(
__('There was a problem modifying group')
);
}
} else {
ui_print_error_message(__('Each module group must have a different name'));
ui_print_error_message(
__('Each module group must have a different name')
);
}
} else {
ui_print_error_message(__('Module group must have a name'));
}
}
// Delete group
// Delete group.
if ($delete_group) {
$id_group = (int) get_parameter('id_group');
$result = db_process_sql_delete('tmodule_group', ['id_mg' => $id_group]);
if ($result) {
$result = db_process_sql_update('tagente_modulo', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('tpolicy_modules', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('tcontainer_item', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('tnetwork_component', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('treport_content', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('tnetwork_map', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('tlocal_component', ['id_module_group' => 0], ['id_module_group' => $id_group]);
db_process_sql_update('treport_content_template', ['id_module_group' => 0], ['id_module_group' => $id_group]);
$result = db_process_sql_update(
'tagente_modulo',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'tpolicy_modules',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'tcontainer_item',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'tnetwork_component',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'treport_content',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'tnetwork_map',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'tlocal_component',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
db_process_sql_update(
'treport_content_template',
['id_module_group' => 0],
['id_module_group' => $id_group]
);
// A group with no modules can be deleted, to avoid a message error then do the follwing
// A group with no modules can be deleted,
// to avoid a message error then do the follwing.
if ($result !== false) {
$result = true;
}
@ -150,36 +220,15 @@ $offset = (int) get_parameter('offset', 0);
ui_pagination($total_groups, $url, $offset);
switch ($config['dbtype']) {
case 'mysql':
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC
LIMIT '.$offset.', '.$config['block_size'];
break;
case 'postgresql':
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC
LIMIT '.$config['block_size'].' OFFSET '.$offset;
break;
case 'oracle':
$set = [];
$set['limit'] = $config['block_size'];
$set['offset'] = $offset;
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC';
$sql = oracle_recode_query($sql, $set);
break;
}
$sql = 'SELECT *
FROM tmodule_group
ORDER BY name ASC
LIMIT '.$offset.', '.$config['block_size'];
$groups = db_get_all_rows_sql($sql);
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox data';
@ -210,11 +259,21 @@ if (!empty($groups)) {
html_print_table($table);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no defined module groups') ]);
ui_print_info_message(
[
'no_close' => true,
'message' => __('There are no defined module groups'),
]
);
}
echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/groups/configure_modu_group">';
echo '<div class="action-buttons" style="width: '.$table->width.'">';
html_print_submit_button(__('Create module group'), 'crt', false, 'class="sub next"');
html_print_submit_button(
__('Create module group'),
'crt',
false,
'class="sub next"'
);
echo '</div>';
echo '</form>';

View File

@ -1,17 +1,32 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2009 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
@ -34,7 +49,8 @@ if (is_ajax()) {
if ($get_agents) {
$id_group = (int) get_parameter('id_group', 0);
// Is is possible add keys prefix to avoid auto sorting in js object conversion
// Is is possible add keys prefix to avoid auto
// sorting in js object conversion.
$keys_prefix = (string) get_parameter('keys_prefix', '');
if ($id_group == 0) {
@ -62,7 +78,7 @@ if (is_ajax()) {
);
}
// Add keys prefix
// Add keys prefix.
if ($keys_prefix !== '') {
foreach ($agents as $k => $v) {
$agents[$keys_prefix.$k] = $v;
@ -92,8 +108,8 @@ function process_manage_add($id_alert_template, $id_agents, $module_names)
foreach ($module_names as $module) {
foreach ($id_agents as $id_agent) {
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
$module_id = modules_get_agentmodule_id($module, $id_agent);
$modules_id[] = $module_id['id_agente_modulo'];
}
}
@ -148,6 +164,7 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = true;
}
$table = new stdClass();
$table->id = 'add_table';
$table->class = 'databox filters';
$table->width = '100%';
@ -251,10 +268,10 @@ html_print_submit_button(__('Add'), 'go', false, 'class="sub add"');
echo '</div>';
echo '</form>';
// TODO: Change to iu_print_error system
// TODO: Change to iu_print_error system.
echo '<h3 class="error invisible" id="message"> </h3>';
// Hack to translate text "none" in PHP to javascript
// Hack to translate text "none" in PHP to javascript.
echo '<span id ="none_text" style="display: none;">'.__('None').'</span>';
ui_require_jquery_file('form');
@ -270,42 +287,40 @@ $(document).ready (function () {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_alerts").serializeArray().length;
var count_parameters =
get_parameters_count + post_parameters_count;
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
$("#checkbox-recursion").click(function () {
$("#id_group").trigger("change");
});
$("#id_agents").change(agent_changed_by_multiple_agents);
$("#id_group").change (function () {
var $select = $("#id_agents").enable ();
$("#agent_loading").show ();
$("option", $select).remove ();
jQuery.post ("ajax.php",
{"page" : "godmode/massive/massive_add_alerts",
"get_agents" : 1,
"id_group" : this.value,
"recursion" : $("#checkbox-recursion").is(":checked") ? 1 : 0,
// Add a key prefix to avoid auto sorting in js object conversion
// Add a key prefix to avoid auto sorting in js object conversion.
"keys_prefix" : "_"
},
function (data, status) {
options = "";
jQuery.each (data, function (id, value) {
// Remove keys_prefix from the index
// Remove keys_prefix from the index.
id = id.substring(1);
options += "<option value=\""+id+"\">"+value+"</option>";
});
$("#id_agents").append (options);
@ -315,40 +330,39 @@ $(document).ready (function () {
"json"
);
});
$("#id_group").value = "0";
$("#id_group").click (
function () {
$(this).css ("width", "auto");
});
$("#id_group").blur (function () {
$(this).css ("width", "180px");
});
$("#id_agents").click (
function () {
$(this).css ("width", "auto");
});
$("#id_agents").blur (function () {
$(this).css ("width", "180px");
});
$("#module").click (
function () {
$(this).css ("width", "auto");
});
$("#module").blur (function () {
$(this).css ("width", "180px");
});
$("#modules_selection_mode").change (function() {
$("#id_agents").trigger('change');
});
});
/* ]]> */
</script>

View File

@ -134,7 +134,6 @@ if (is_ajax()) {
set_unless_defined($config['double_auth_enabled'], false);
$row = [];
$row['name'] = __('Double authentication').ui_print_help_tip(__('If this option is enabled, the users can use double authentication with their accounts'), true);
$row['control'] = html_print_input_hidden('double_auth_enabled', 0);
$row['control'] .= html_print_checkbox_switch('double_auth_enabled', 1, $config['double_auth_enabled'], true);
$table->data['double_auth_enabled'] = $row;

View File

@ -1,18 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Warning: This file may be required into the metaconsole's setup
// Load global vars
global $config;
check_login();
@ -23,7 +28,7 @@ if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user
return;
}
// Check custom field
// Check custom field.
$custom_field = db_get_value('name', 'tagent_custom_fields', 'name', $config['ehorus_custom_field']);
$custom_field_exists = !empty($custom_field);
$custom_field_created = null;
@ -36,7 +41,7 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
$custom_field_exists = $custom_field_created = $result;
}
// Enable table
// Enable table.
$table_enable = new StdClass();
$table_enable->data = [];
$table_enable->width = '100%';
@ -45,15 +50,13 @@ $table_enable->class = 'databox filters';
$table_enable->size['name'] = '30%';
$table_enable->style['name'] = 'font-weight: bold';
// Enable eHorus
// Enable eHorus.
$row = [];
$row['name'] = __('Enable eHorus');
$row['control'] = __('Enabled').'&nbsp;'.html_print_radio_button('ehorus_enabled', 1, '', $config['ehorus_enabled'], true).'&nbsp;&nbsp;';
$row['control'] .= __('Disabled').'&nbsp;'.html_print_radio_button('ehorus_enabled', 0, '', $config['ehorus_enabled'], true);
$row['button'] = html_print_submit_button(__('Update'), 'update_button', false, 'class="sub upd"', true);
$row['control'] = html_print_checkbox_switch('ehorus_enabled', 1, $config['ehorus_enabled'], true);
$table_enable->data['ehorus_enabled'] = $row;
// Remote config table
// Remote config table.
$table_remote = new StdClass();
$table_remote->data = [];
$table_remote->width = '100%';
@ -63,40 +66,40 @@ $table_remote->class = 'databox filters';
$table_remote->size['name'] = '30%';
$table_remote->style['name'] = 'font-weight: bold';
// User
// User.
$row = [];
$row['name'] = __('User');
$row['control'] = html_print_input_text('ehorus_user', $config['ehorus_user'], '', 30, 100, true);
$table_remote->data['ehorus_user'] = $row;
// Pass
// Pass.
$row = [];
$row['name'] = __('Password');
$row['control'] = html_print_input_password('ehorus_pass', io_output_password($config['ehorus_pass']), '', 30, 100, true);
$table_remote->data['ehorus_pass'] = $row;
// Directory hostname
// Directory hostname.
$row = [];
$row['name'] = __('API Hostname');
$row['control'] = html_print_input_text('ehorus_hostname', $config['ehorus_hostname'], '', 30, 100, true);
$row['control'] .= ui_print_help_tip(__('Hostname of the eHorus API').'. '.__('Without protocol and port').'. '.__('e.g., portal.ehorus.com'), true);
$table_remote->data['ehorus_hostname'] = $row;
// Directory port
// Directory port.
$row = [];
$row['name'] = __('API Port');
$row['control'] = html_print_input_text('ehorus_port', $config['ehorus_port'], '', 6, 100, true);
$row['control'] .= ui_print_help_tip(__('e.g., 18080'), true);
$table_remote->data['ehorus_port'] = $row;
// Request timeout
// Request timeout.
$row = [];
$row['name'] = __('Request timeout');
$row['control'] = html_print_input_text('ehorus_req_timeout', $config['ehorus_req_timeout'], '', 3, 10, true);
$row['control'] .= ui_print_help_tip(__('Time in seconds to set the maximum time of the requests to the eHorus API').'. '.__('0 to disable'), true);
$table_remote->data['ehorus_req_timeout'] = $row;
// Test
// Test.
$row = [];
$row['name'] = __('Test');
$row['control'] = html_print_button(__('Start'), 'test-ehorus', false, '', 'class="sub next"', true);
@ -106,7 +109,7 @@ $row['control'] .= '<span id="test-ehorus-failure" style="display:none;">&nbsp;'
$row['control'] .= '&nbsp;<span id="test-ehorus-message" style="display:none;"></span>';
$table_remote->data['ehorus_test'] = $row;
// Print
// Print.
echo '<div style="text-align: center; padding-bottom: 20px;">';
echo '<a target="_blank" rel="noopener noreferrer" href="http://ehorus.com">';
html_print_image('include/ehorus/images/ehorus-logo-grey.png');
@ -136,13 +139,13 @@ if ($config['ehorus_enabled'] && !$custom_field_exists) {
ui_print_error_message($error_message);
}
// Form enable
// Form enable.
echo '<form id="form_enable" method="post">';
html_print_input_hidden('update_config', 1);
html_print_table($table_enable);
echo '</form>';
// Form remote
// Form remote.
if ($config['ehorus_enabled']) {
echo '<form id="form_remote" method="post">';
echo '<fieldset>';
@ -159,6 +162,9 @@ if ($config['ehorus_enabled']) {
?>
<script type="text/javascript">
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
$('form#form_remote').hide();
$('form#form_enable').css('margin-bottom','20px');
var showFields = function () {
$('form#form_remote').show();
}
@ -166,10 +172,17 @@ if ($config['ehorus_enabled']) {
$('form#form_remote').hide();
}
var handleEnable = function (event) {
if (event.target.value == '1') showFields();
else hideFields();
var is_checked = $('input:checkbox[name="ehorus_enabled"]').is(':checked');
if (event.target.value == '1' && is_checked) {
showFields();
$('input:checkbox[name="ehorus_enabled"]').attr('checked', false);
}
else {
hideFields();
$('input:checkbox[name="ehorus_enabled"]').attr('checked', true);
};
}
$('input:radio[name="ehorus_enabled"]').change(handleEnable);
$('input:checkbox[name="ehorus_enabled"]').change(handleEnable);
var handleTest = function (event) {
var user = $('input#text-ehorus_user').val();

View File

@ -1,17 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
check_login();
@ -269,12 +275,10 @@ $table->data[37][0] = __('Audit log directory').ui_print_help_tip(__('Directory
$table->data[37][1] = html_print_input_text('auditdir', io_safe_output($config['auditdir']), '', 30, 100, true);
$table->data[38][0] = __('Set alias as name by default in agent creation');
$table->data[38][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('alias_as_name', 1, '', $config['alias_as_name'], true).'&nbsp;&nbsp;';
$table->data[38][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('alias_as_name', 0, '', $config['alias_as_name'], true);
$table->data[38][1] = html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true);
$table->data[39][0] = __('Unique IP').ui_print_help_tip(__('Set the primary IP address as the unique IP, preventing the same primary IP address from being used in more than one agent'), true);
$table->data[39][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('unique_ip', 1, '', $config['unique_ip'], true).'&nbsp;&nbsp;';
$table->data[39][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button('unique_ip', 0, '', $config['unique_ip'], true);
$table->data[39][1] = html_print_checkbox_switch('unique_ip', 1, $config['unique_ip'], true);
echo '<form id="form_setup" method="post" action="index.php?sec=gsetup&sec2=godmode/setup/setup&amp;section=general&amp;pure='.$config['pure'].'">';

View File

@ -1,16 +1,23 @@
<?php
/**
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
global $config;
require_once 'include/functions_ui.php';
@ -55,21 +62,19 @@ $table->data[5][0] = '<b>'.__('Maximum chart resolution').'</b>'.ui_print_help_t
$table->data[5][1] = html_print_input_text('netflow_max_resolution', $config['netflow_max_resolution'], false, 50, 200, true);
$table->data[6][0] = '<b>'.__('Disable custom live view filters').'</b>'.ui_print_help_tip(__('Disable the definition of custom filters in the live view. Only existing filters can be used.'), true);
$table->data[6][1] = __('Yes').'&nbsp;&nbsp;'.html_print_radio_button('netflow_disable_custom_lvfilters', 1, '', $config['netflow_disable_custom_lvfilters'], true).'&nbsp;&nbsp;&nbsp;';
$table->data[6][1] .= __('No').'&nbsp;&nbsp;'.html_print_radio_button('netflow_disable_custom_lvfilters', 0, '', $config['netflow_disable_custom_lvfilters'], true);
$table->data[6][1] = html_print_checkbox_switch('netflow_disable_custom_lvfilters', 1, $config['netflow_disable_custom_lvfilters'], true);
$table->data[7][0] = '<b>'.__('Netflow max lifetime').'</b>'.ui_print_help_tip(__('Sets the maximum lifetime for netflow data in days.'), true);
$table->data[7][1] = html_print_input_text('netflow_max_lifetime', $config['netflow_max_lifetime'], false, 50, 200, true);
$table->data[8][0] = '<b>'.__('Name resolution for IP address').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true);
$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
$table->data[8][1] = __('Yes').'&nbsp;&nbsp;'.html_print_radio_button_extended('netflow_get_ip_hostname', 1, '', $config['netflow_get_ip_hostname'], false, $onclick, '', true).'&nbsp;&nbsp;&nbsp;';
$table->data[8][1] .= __('No').'&nbsp;&nbsp;'.html_print_radio_button('netflow_get_ip_hostname', 0, '', $config['netflow_get_ip_hostname'], true);
$table->data[8][1] = html_print_checkbox_switch_extended('netflow_get_ip_hostname', 1, $config['netflow_get_ip_hostname'], false, $onclick, '', true);
echo '<form id="netflow_setup" method="post">';
html_print_table($table);
// Update button
// Update button.
echo '<div class="action-buttons" style="width:100%;">';
html_print_input_hidden('update_config', 1);
html_print_submit_button(__('Update'), 'upd_button', false, 'class="sub upd"');

View File

@ -964,7 +964,7 @@ $row++;
__('Custom report front page. It will be applied to all reports and templates by default.'),
true
);
$table_other->data[$row][1] = html_print_checkbox(
$table_other->data[$row][1] = html_print_checkbox_switch(
'custom_report_front',
1,
$config['custom_report_front'],
@ -1438,12 +1438,12 @@ $(document).ready (function () {
// Juanma (06/05/2014) New feature: Custom front page for reports
var custom_report = $('#checkbox-custom_report_front')
.prop('checked');
display_custom_report_front(custom_report,$('#checkbox-custom_report_front').parent().parent().parent().parent().attr('id'));
display_custom_report_front(custom_report,$('#checkbox-custom_report_front').parent().parent().parent().parent().parent().attr('id'));
$("#checkbox-custom_report_front").click( function() {
$("#checkbox-custom_report_front").change( function() {
var custom_report = $('#checkbox-custom_report_front')
.prop('checked');
display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().attr('id'));
display_custom_report_front(custom_report,$(this).parent().parent().parent().parent().parent().attr('id'));
});
$(".databox.filters").css('margin-bottom','-10px');
});

View File

@ -240,7 +240,7 @@ class DiscoveryTaskList extends Wizard
$id_console_task = (int) get_parameter('id_console_task');
if ($id_console_task !== null) {
enterprise_hook('cron_task_run', $id_console_task, true);
enterprise_hook('cron_task_run', [$id_console_task, true]);
// Trick to avoid double execution.
header('Location: '.$this->url);
}
@ -511,6 +511,15 @@ class DiscoveryTaskList extends Wizard
$data[9] .= '</a>';
}
if ($task['disabled'] != 2 && $task['utimestamp'] > 0) {
$data[9] .= '<a href="#" onclick="show_map('.$task['id_rt'].',\''.$task['name'].'\',\''.$url_ajax.'\')">';
$data[9] .= html_print_image(
'images/dynamic_network_icon.png',
true
);
$data[9] .= '</a>';
}
if (check_acl(
$config['id_user'],
$task['id_group'],

View File

@ -28,9 +28,10 @@
require_once __DIR__.'/Wizard.main.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/class/CustomNetScan.class.php';
require_once $config['homedir'].'/include/class/ManageNetScanScripts.class.php';
enterprise_include_once('include/class/CSVImportAgents.class.php');
enterprise_include_once('include/class/CustomNetScan.class.php');
enterprise_include_once('include/class/ManageNetScanScripts.class.php');
enterprise_include_once('include/functions_hostdevices.php');
/**
@ -126,20 +127,20 @@ class HostDevices extends Wizard
'icon' => ENTERPRISE_DIR.'/images/wizard/csv.png',
'label' => __('Import CSV'),
];
$buttons[] = [
'url' => $this->url.'&mode=customnetscan',
'icon' => ENTERPRISE_DIR.'/images/wizard/customnetscan.png',
'label' => __('Custom NetScan'),
];
$buttons[] = [
'url' => $this->url.'&mode=managenetscanscripts',
'icon' => ENTERPRISE_DIR.'/images/wizard/managenetscanscripts.png',
'label' => __('Manage NetScan scripts'),
];
}
$buttons[] = [
'url' => $this->url.'&mode=customnetscan',
'icon' => '/images/wizard/customnetscan.png',
'label' => __('Custom NetScan'),
];
$buttons[] = [
'url' => $this->url.'&mode=managenetscanscripts',
'icon' => '/images/wizard/managenetscanscripts.png',
'label' => __('Manage NetScan scripts'),
];
$this->prepareBreadcrum(
[
[
@ -165,22 +166,22 @@ class HostDevices extends Wizard
);
return $csv_importer->runCSV();
}
}
if ($mode === 'customnetscan') {
$customnetscan_importer = new CustomNetScan(
$this->page,
$this->breadcrum
);
return $customnetscan_importer->runCustomNetScan();
}
if ($mode === 'customnetscan') {
$customnetscan_importer = new CustomNetScan(
$this->page,
$this->breadcrum
);
return $customnetscan_importer->runCustomNetScan();
}
if ($mode === 'managenetscanscripts') {
$managenetscanscript_importer = new ManageNetScanScripts(
$this->page,
$this->breadcrum
);
return $managenetscanscript_importer->runManageNetScanScript();
}
if ($mode === 'managenetscanscripts') {
$managenetscanscript_importer = new ManageNetScanScripts(
$this->page,
$this->breadcrum
);
return $managenetscanscript_importer->runManageNetScanScript();
}
if ($mode == 'netscan') {

View File

@ -26,14 +26,15 @@
* ============================================================================
*/
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
// Begin.
/**
* Global Wizard generic class. Needs to be inherited.
*
* Used in Hostdevices class, Applications class and others, is the core of
* Discovery proyect.
*/
/**
* Global Wizard generic class. Needs to be inherited.
*
* Used in Hostdevices class, Applications class and others, is the core of
* Discovery proyect.
*/
class Wizard
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 690 B

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

After

Width:  |  Height:  |  Size: 263 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -29,6 +29,7 @@
require_once $config['homedir'].'/include/graphs/functions_d3.php';
$progress_task_discovery = (bool) get_parameter('progress_task_discovery', 0);
$showmap = (bool) get_parameter('showmap', 0);
if ($progress_task_discovery) {
$id_task = get_parameter('id', 0);
@ -42,9 +43,15 @@ if ($progress_task_discovery) {
$id_task,
90,
460,
50,
'#EA5434'
30,
'#EA5434',
'%',
'',
'#FFFFFF',
0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Searching devices in').' red a scanear</h1></li>';
$result .= '<li>';
@ -52,9 +59,15 @@ if ($progress_task_discovery) {
$id_task.'_2',
30,
460,
50,
'#2751E1'
30,
'#2751E1',
'%',
'',
'#FFFFFF',
0,
0
);
$result .= '</li>';
$result .= '<li><h1>'.__('Summary').'</h1></li>';
$result .= '<li><span><b>'.__('Estimated').'</b>: total de host</span></li>';
@ -72,3 +85,16 @@ if ($progress_task_discovery) {
return;
}
if ($showmap) {
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
$id_task = get_parameter('id', 0);
$map = new NetworkMap(
[
'id_task' => $id_task,
'pure' => 1,
]
);
$map->printMap();
}

View File

@ -1065,6 +1065,7 @@ class ConsoleSupervisor
id_server,
name,
server_type,
server_keepalive,
status,
unix_timestamp() - unix_timestamp(keepalive) as downtime
FROM tserver
@ -1100,8 +1101,8 @@ class ConsoleSupervisor
}
foreach ($servers as $server) {
if ($server['type'] == SERVER_TYPE_ENTERPRISE_SATELLITE) {
if ($server['downtime'] < ($server['keepalive'] * 2)) {
if ($server['server_type'] == SERVER_TYPE_ENTERPRISE_SATELLITE) {
if ($server['downtime'] < ($server['server_keepalive'] * 2)) {
// Satellite uses different keepalive mode.
continue;
}

View File

@ -0,0 +1,758 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Host&Devices
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
/**
* CustomNetScan. Host and devices child class.
*/
class CustomNetScan extends Wizard
{
/**
* Number of pages to control breadcrum.
*
* @var integer
*/
public $MAXPAGES = 2;
/**
* Labels for breadcrum.
*
* @var array
*/
public $pageLabels = [
'Netscan Custom definition',
'Netscan Custom script',
];
/**
* Constructor.
*
* @param integer $page Page.
* @param array $breadcrum Breadcrum.
*
* @return void
*/
public function __construct(int $page, array $breadcrum)
{
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
);
$this->page = $page;
$this->breadcrum = $breadcrum;
}
/**
* Retrieves and validates information given by user in NetScan wizard.
*
* @return boolean Data OK or not.
*/
public function parseNetScan()
{
if (isset($this->page) === true && $this->page === 0) {
// Check if we're updating a task.
$task_id = get_parameter('task', null);
if (isset($task_id) === true) {
// We're updating this task.
$task = db_get_row(
'trecon_task',
'id_rt',
$task_id
);
if ($task !== false) {
$this->task = $task;
}
}
return true;
}
// Validate response from page 0. No, not a bug, we're always 1 page
// from 'validation' page.
if (isset($this->page) === true && $this->page === 1) {
$task_id = get_parameter('task', null);
$taskname = get_parameter('taskname', '');
$comment = get_parameter('comment', '');
$server_id = get_parameter('id_recon_server', '');
$id_group = get_parameter('id_group', '');
$interval = get_parameter('interval', 0);
if (isset($task_id) === true) {
// We're updating this task.
$task = db_get_row(
'trecon_task',
'id_rt',
$task_id
);
if ($task !== false) {
$this->task = $task;
}
} else if (isset($taskname) === true) {
// Avoid double creation.
$task = db_get_row_filter(
'trecon_task',
['name' => $taskname]
);
if ($task !== false) {
$this->task = $task;
$this->msg = __('This task has been already defined. Please edit it or create a new one.');
return false;
}
}
if ($task_id !== null
&& $taskname == null
&& $server_id == null
&& $id_group == null
&& $server == null
&& $datacenter == ''
&& $user == ''
&& $pass == ''
&& $encrypt == null
&& $interval == 0
) {
// Default values, no data received.
// User is accesing directly to this page.
if (users_is_admin() !== true && check_acl(
$config['id_usuario'],
$this->task['id_group'],
'PM'
) !== true
) {
$this->msg = __('You have no access to edit this task.');
return false;
}
} else {
if (isset($this->task['id_rt']) === false) {
// Disabled 2 Implies wizard non finished.
$this->task['disabled'] = 2;
}
if ($taskname == '') {
$this->msg = __('You must provide a task name.');
return false;
}
if ($server_id == '') {
$this->msg = __('You must select a Discovery Server.');
return false;
}
if ($id_group == '') {
$this->msg = __('You must select a valid group.');
return false;
}
// Assign fields.
$this->task['name'] = $taskname;
$this->task['description'] = $comment;
$this->task['id_recon_server'] = $server_id;
$this->task['id_group'] = $id_group;
$this->task['interval_sweep'] = $interval;
if (isset($this->task['id_rt']) === false) {
// Create.
$this->task['id_rt'] = db_process_sql_insert(
'trecon_task',
$this->task
);
} else {
// Update.
db_process_sql_update(
'trecon_task',
$this->task,
['id_rt' => $this->task['id_rt']]
);
}
}
return true;
}
// Validate response from page 1.
if ($this->page == 2) {
$id_rt = get_parameter('task', -1);
$task = db_get_row(
'trecon_task',
'id_rt',
$id_rt
);
if ($task !== false) {
$this->task = $task;
} else {
$this->msg = __('Failed to find network scan task.');
return false;
}
$id_recon_script = get_parameter('id_recon_script', null);
$field1 = get_parameter('_field1_', '');
$field2 = get_parameter('_field2_', '');
$field3 = get_parameter('_field3_', '');
$field4 = get_parameter('_field4_', '');
// Get macros.
$macros = get_parameter('macros', null);
if (empty($macros) === false) {
$macros = json_decode(
base64_decode($macros),
true
);
foreach ($macros as $k => $m) {
$macros[$k]['value'] = get_parameter($m['macro'], '');
}
}
$this->task['id_recon_script'] = $id_recon_script;
$this->task['macros'] = io_json_mb_encode($macros);
$this->task['field1'] = $field1;
$this->task['field2'] = $field2;
$this->task['field3'] = $field3;
$this->task['field4'] = $field4;
if ($this->task['disabled'] == 2) {
// Wizard finished.
$this->task['disabled'] = 0;
}
// Update.
$res = db_process_sql_update(
'trecon_task',
$this->task,
['id_rt' => $this->task['id_rt']]
);
return true;
}
return false;
}
/**
* Run function. It will be call into HostsDevices class.
* Page 0: Upload form.
* Page 1: Task resume.
*
* @return void
*/
public function runCustomNetScan()
{
global $config;
if (!check_acl($config['id_user'], 0, 'PM')) {
db_pandora_audit(
'ACL Violation',
'Trying to access Custom Net Scan.'
);
include 'general/noaccess.php';
return;
}
if ($this->parseNetScan() === false) {
// Error.
ui_print_error_message(
$this->msg
);
$form = [
'form' => [
'method' => 'POST',
'action' => $this->url.'&mode=customnetscan&page='.($this->page - 1).'&task='.$this->task['id_rt'],
],
'inputs' => [
[
'arguments' => [
'type' => 'hidden',
'name' => 'task',
'value' => $this->task['id_rt'],
],
],
[
'arguments' => [
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'return' => true,
],
],
],
];
// Check ACL. If user is not able to manage target task,
// redirect him to main page.
if (users_is_admin() !== true && check_acl(
$config['id_usuario'],
$this->task['id_group'],
'PM'
) !== true
) {
$form['form']['action'] = $this->url.'&mode=customnetscan&page='.($this->page - 1);
}
$this->printForm($form);
return null;
}
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$task_url = '';
if (isset($this->task['id_rt']) === true) {
$task_url = '&task='.$this->task['id_rt'];
}
$breadcrum[] = [
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
];
for ($i = 0; $i < $this->MAXPAGES; $i++) {
$breadcrum[] = [
'link' => $run_url.'&wiz=hd&mode=customnetscan&page='.$i.$task_url,
'label' => __($this->pageLabels[$i]),
'selected' => (($i == $this->page) ? 1 : 0),
];
}
if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
}
$task_url = '';
if (isset($this->task['id_rt'])) {
$task_url = '&task='.$this->task['id_rt'];
}
$breadcrum[] = [
'link' => $run_url.'&wiz=hd',
'label' => __($this->label),
];
for ($i = 0; $i < $this->maxPagesNetScan; $i++) {
$breadcrum[] = [
'link' => $run_url.'&wiz=hd&mode=customnetscan&page='.$i.$task_url,
'label' => $this->pageLabelsNetScan[$i],
'selected' => (($i == $this->page) ? 1 : 0),
];
}
if ($this->page < $this->maxPagesNetScan) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
}
if (isset($this->page) === true
&& $this->page !== 0
&& isset($this->task['id_rt']) === false
) {
// Error.
ui_print_error_message(
__('Internal error, please re-run this wizard.')
);
$form = [
'form' => [
'method' => 'POST',
'action' => $this->url.'&mode=customnetscan&page=0',
],
'inputs' => [
[
'arguments' => [
'type' => 'hidden',
'name' => 'page',
'value' => 0,
],
],
[
'arguments' => [
'name' => 'submit',
'label' => __('Go back'),
'type' => 'submit',
'attributes' => 'class="sub cancel"',
'return' => true,
],
],
],
];
$this->printForm($form);
return null;
}
// -------------------------------.
// Page 0. wizard starts HERE.
// -------------------------------.
if (isset($this->page) === true || $this->page == 0) {
if (isset($this->page) === false
|| $this->page == 0
) {
$form = [];
// Input task name.
$form['inputs'][] = [
'label' => '<b>'.__('Task name').'</b>',
'arguments' => [
'name' => 'taskname',
'value' => $this->task['name'],
'type' => 'text',
'size' => 25,
],
];
if (isset($this->task['id_rt']) === true) {
// Propagate id.
$form['inputs'][] = [
'arguments' => [
'name' => 'task',
'value' => $this->task['id_rt'],
'type' => 'hidden',
],
];
}
// Input task description.
$form['inputs'][] = [
'label' => '<b>'.__('Comment').'</b>',
'arguments' => [
'name' => 'comment',
'value' => $this->task['description'],
'type' => 'text',
'size' => 25,
],
];
// Input Discovery Server.
$form['inputs'][] = [
'label' => '<b>'.__('Discovery server').'</b>'.ui_print_help_tip(
__('You must select a Discovery Server to run the Task, otherwise the Recon Task will never run'),
true
),
'arguments' => [
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_server, name
FROM tserver
WHERE server_type = %d
ORDER BY name',
SERVER_TYPE_DISCOVERY
),
'name' => 'id_recon_server',
'selected' => $this->task['id_recon_server'],
'return' => true,
],
];
// Input Group.
$form['inputs'][] = [
'label' => '<b>'.__('Group').'</b>',
'arguments' => [
'name' => 'id_group',
'returnAllGroup' => false,
'privilege' => 'PM',
'type' => 'select_groups',
'selected' => $this->task['id_group'],
'return' => true,
],
];
// Interval and schedules.
$interv_manual = 0;
if ((int) $this->task['interval_sweep'] == 0) {
$interv_manual = 1;
}
// Schedule.
$form['inputs'][] = [
'label' => '<b>'.__('Interval').'</b>'.ui_print_help_tip(
__('Manual interval means that it will be executed only On-demand'),
true
),
'arguments' => [
'type' => 'select',
'selected' => $interv_manual,
'fields' => [
0 => __('Defined'),
1 => __('Manual'),
],
'name' => 'interval_manual_defined',
'return' => true,
],
'extra' => '<span id="interval_manual_container">'.html_print_extended_select_for_time(
'interval',
$this->task['interval_sweep'],
'',
'',
'0',
false,
true,
false,
false
).ui_print_help_tip(
__('The minimum recomended interval for Recon Task is 5 minutes'),
true
).'</span>',
];
$str = __('Next');
if (isset($this->task['id_rt']) === true) {
$str = __('Update and continue');
}
// Submit button.
$form['inputs'][] = [
'arguments' => [
'name' => 'submit',
'label' => $str,
'type' => 'submit',
'attributes' => 'class="sub next"',
'return' => true,
],
];
$task_url = '';
if (isset($this->task['id_rt'])) {
$task_url = '&task='.$this->task['id_rt'];
}
$form['form'] = [
'method' => 'POST',
'action' => $this->url.'&mode=customnetscan&page='.($this->page + 1).$task_url,
];
// Default.
$interval = 600;
$unit = 60;
if (isset($this->task['interval_sweep']) === true) {
$interval = $this->task['interval_sweep'];
$unit = $this->getTimeUnit($interval);
}
$form['js'] = '
$("select#interval_manual_defined").change(function() {
if ($("#interval_manual_defined").val() == 1) {
$("#interval_manual_container").hide();
$("#text-interval_text").val(0);
$("#hidden-interval").val(0);
}
else {
$("#interval_manual_container").show();
$("#text-interval_text").val(10);
$("#hidden-interval").val('.$interval.');
$("#interval_units").val('.$unit.');
}
}).change();
';
// XXX: Could be improved validating inputs before continue (JS)
// Print NetScan page 0.
$this->printForm($form);
}
}
if (isset($this->page) === true && $this->page === 1) {
$name_ipam = 'IPAM Recon';
// Recon script.
$form['inputs'][] = [
'label' => '<b>'.__('Recon script').'</b>',
'arguments' => [
'type' => 'select_from_sql',
'sql' => sprintf(
'SELECT id_recon_script, name FROM trecon_script WHERE name <> "%s" ORDER BY name',
$name_ipam
),
'name' => 'id_recon_script',
'selected' => $this->task['id_recon_script'],
'return' => true,
],
];
$form['inputs'][] = [
'hidden' => 1,
'arguments' => [
'type' => 'hidden',
'name' => 'task',
'value' => $this->task['id_rt'],
],
];
$form['inputs'][] = [
'hidden' => 1,
'arguments' => [
'type' => 'hidden_extended',
'name' => 'macros',
'value' => base64_encode($this->task['macros']),
'return' => true,
],
];
// Explanation.
$explanation = db_get_value(
'description',
'trecon_script',
'id_recon_script',
$this->task['id_recon_script']
);
$form['inputs'][] = [
'label' => '<b>'.__('Explanation').'</b><span id="spinner_recon_script" style="display: none;">'.html_print_image('images/spinner.gif', true).'</span>',
'arguments' => [
'type' => 'textarea',
'rows' => 4,
'columns' => 60,
'name' => 'explanation',
'value' => $explanation,
'return' => true,
'attributes' => 'style="width: 388px;"',
],
];
$form['inputs'][] = [
'hidden' => 1,
'id' => 'table_recon-macro_field',
'label' => '<b>'.__('macro_desc').'</b>'.ui_print_help_tip('macro_help', true),
'arguments' => [
'name' => 'macro_name',
'value' => 'macro_value',
'type' => 'text',
'size' => 100,
'return' => true,
],
];
if (empty($this->task['macros']) === false) {
$macros = json_decode($this->task['macros'], true);
foreach ($macros as $k => $m) {
$label_macro = '';
$label_macro .= '<b>'.$m['desc'].'</b>';
if (!empty($m['help'])) {
$label_macro .= ui_print_help_tip(
$m['help'],
true
);
}
if ($m['hide']) {
$form['inputs'][] = [
'label' => $label_macro,
'id' => 'table_recon-macro'.$m['macro'],
'class' => 'macro_field',
'arguments' => [
'name' => $m['macro'],
'value' => $m['value'],
'type' => 'password',
'size' => 100,
'return' => true,
],
];
} else {
$form['inputs'][] = [
'label' => $label_macro,
'id' => 'table_recon-macro'.$m['macro'],
'class' => 'macro_field',
'arguments' => [
'name' => $m['macro'],
'value' => $m['value'],
'type' => 'text',
'size' => 100,
'return' => true,
],
];
}
}
}
// Submit button.
$form['inputs'][] = [
'arguments' => [
'name' => 'submit',
'label' => __('Finish'),
'type' => 'submit',
'attributes' => 'class="sub next"',
'return' => true,
],
];
$form['form'] = [
'method' => 'POST',
'action' => $this->url.'&mode=customnetscan&page='.($this->page + 1).'&task='.$this->task['id_rt'],
];
$id_task = (isset($this->task['id_rt']) === true) ? $this->task['id_rt'] : 0;
$url_ajax = $config['homeurl'].'ajax.php';
$change = '';
if (empty($this->task['macros']) !== false) {
$change = '.change();';
}
$form['js'] = '
$("select#id_recon_script").change(function() {
get_explanation_recon_script($(this).val(), "'.$id_task.'", "'.$url_ajax.'");
})'.$change;
$this->printForm($form);
}
if (isset($this->page) === true && $this->page === 2) {
if ($this->task['id_rt']) {
// 0 - Is OK.
$this->result = 0;
$this->msg = __('Task configured.');
} else {
// 1 - Is NOT OK.
$this->result = 1;
$this->msg = __('Wizard failed. Cannot configure task.');
}
return [
'result' => $this->result,
'id' => $this->task['id_rt'],
'msg' => $this->msg,
];
}
ui_require_javascript_file('pandora_modules');
}
}

View File

@ -0,0 +1,759 @@
<?php
/**
* Extension to schedule tasks on Pandora FMS Console
*
* @category Wizard
* @package Pandora FMS
* @subpackage Host&Devices
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
require_once $config['homedir'].'/godmode/wizards/Wizard.main.php';
/**
* ManageNetScanScripts. Host and devices child class.
*/
class ManageNetScanScripts extends Wizard
{
/**
* Number of pages to control breadcrum.
*
* @var integer
*/
public $MAXPAGES = 2;
/**
* Labels for breadcrum.
*
* @var array
*/
public $pageLabels = [
'List net scan scripts',
'Operation net scan cripts',
];
/**
* Constructor.
*
* @param integer $page Page.
* @param array $breadcrum Breadcrum.
*
* @return void
*/
public function __construct(int $page, array $breadcrum)
{
$this->url = ui_get_full_url(
'index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=hd'
);
$this->page = $page;
$this->breadcrum = $breadcrum;
}
/**
* Run function. It will be call into HostsDevices class.
* Page 0: Upload form.
* Page 1: Task resume.
*
* @return void
*/
public function runManageNetScanScript()
{
global $config;
if (check_acl($config['id_user'], 0, 'AW') === 0) {
db_pandora_audit(
'ACL Violation',
'Trying to access Net Scan Script.'
);
include 'general/noaccess.php';
return;
}
$run_url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$breadcrum[] = [
'link' => $run_url.'&wiz=hd',
'label' => __('Host & Devices'),
];
for ($i = 0; $i < $this->MAXPAGES; $i++) {
$breadcrum[] = [
'link' => $run_url.'&wiz=hd&mode=managenetscanscripts&page='.$i,
'label' => __($this->pageLabels[$i]),
'selected' => (($i == $this->page) ? 1 : 0),
];
}
if ($this->page < $this->MAXPAGES) {
// Avoid to print header out of wizard.
$this->prepareBreadcrum($breadcrum);
$this->printHeader();
}
$id_script = get_parameter('id_script', 0);
// Initialize msg.
$msg = [];
// Operations.
$operation_scp = get_parameter('operation_scp', '');
if ($operation_scp !== '') {
switch ($operation_scp) {
case 'update_scp':
$msg = $this->updateScanScripts($id_script);
break;
case 'delete_scp':
$msg = $this->deleteScanScripts($id_script);
break;
case 'create_scp':
$msg = $this->createScanScripts($id_script);
break;
default:
// Nothing for doing. Never exist other operation.
break;
}
}
if (!isset($this->page) || $this->page === 0) {
$this->printListNetScanScripts($msg);
}
if (!isset($this->page) || $this->page === 1) {
$this->printFormScanScripts($id_script);
}
}
/**
* Create net scan script.
*
* @return array Check msg successfully or problem
*/
private function createScanScripts()
{
$result = [];
$reconscript_name = get_parameter('form_name', '');
$reconscript_description = get_parameter('form_description', '');
$reconscript_script = get_parameter('form_script', '');
// Get macros.
$i = 1;
$macros = [];
while (1) {
$macro = (string) get_parameter('field'.$i.'_macro');
if ($macro == '') {
break;
}
$desc = (string) get_parameter('field'.$i.'_desc');
$help = (string) get_parameter('field'.$i.'_help');
$value = (string) get_parameter('field'.$i.'_value');
$hide = get_parameter('field'.$i.'_hide');
$macros[$i]['macro'] = $macro;
$macros[$i]['desc'] = $desc;
$macros[$i]['help'] = $help;
$macros[$i]['value'] = $value;
$macros[$i]['hide'] = $hide;
$i++;
}
$macros = io_json_mb_encode($macros);
$values = [
'name' => $reconscript_name,
'description' => $reconscript_description,
'script' => $reconscript_script,
'macros' => $macros,
];
$result_crt = false;
if ($values['name'] !== '' && $values['script'] !== '') {
$result_crt = db_process_sql_insert('trecon_script', $values);
if (!$result_crt) {
$result = [
'error' => 1,
'msg' => __('Problem creating'),
];
} else {
$result = [
'error' => 0,
'msg' => __('Created successfully'),
];
}
} else {
$result = [
'error' => 1,
'msg' => __('Name or Script fullpath they can not be empty'),
];
}
return $result;
}
/**
* Update net scan script.
*
* @param integer $id_script Id script.
*
* @return array Check msg successfully or problem
*/
private function updateScanScripts(int $id_script)
{
$result = [];
if (isset($id_script) === false || $id_script === 0) {
$result = [
'error' => 1,
'msg' => __('Problem deleting Net scan Scripts, Not selected script'),
];
return $result;
}
// If modified any parameter.
$reconscript_name = get_parameter('form_name', '');
$reconscript_description = get_parameter('form_description', '');
$reconscript_script = get_parameter('form_script', '');
// Get macros.
$i = 1;
$macros = [];
while (1) {
$macro = (string) get_parameter('field'.$i.'_macro');
if ($macro == '') {
break;
}
$desc = (string) get_parameter('field'.$i.'_desc');
$help = (string) get_parameter('field'.$i.'_help');
$value = (string) get_parameter('field'.$i.'_value');
$hide = get_parameter('field'.$i.'_hide');
$macros[$i]['macro'] = $macro;
$macros[$i]['desc'] = $desc;
$macros[$i]['help'] = $help;
$macros[$i]['value'] = $value;
$macros[$i]['hide'] = $hide;
$i++;
}
$macros = io_json_mb_encode($macros);
$sql_update = sprintf(
"UPDATE trecon_script SET
name = '%s',
description = '%s',
script = '%s',
macros = '%s'
WHERE id_recon_script = %d",
$reconscript_name,
$reconscript_description,
$reconscript_script,
$macros,
$id_script
);
$result_upd = false;
if ($reconscript_name !== '' && $reconscript_script !== '') {
$result_upd = db_process_sql($sql_update);
if (!$result_upd) {
$result = [
'error' => 1,
'msg' => __('Problem updating'),
];
} else {
$result = [
'error' => 0,
'msg' => __('Updated successfully'),
];
}
} else {
$result = [
'error' => 1,
'msg' => __('Name or Script fullpath they can not be empty'),
];
}
return $result;
}
/**
* Delete net scan script.
*
* @param integer $id_script Id script.
*
* @return array Check msg successfully or problem
*/
private function deleteScanScripts(int $id_script)
{
$result = [];
if (isset($id_script) === false || $id_script === 0) {
$result = [
'error' => 1,
'msg' => __('Problem deleting Net scan Scripts, Not selected script'),
];
return $result;
}
$result_dlt = db_process_sql_delete(
'trecon_script',
['id_recon_script' => $id_script]
);
if (!$result_dlt) {
$result = [
'error' => 1,
'msg' => __('Problem deleting Net scan Scripts'),
];
} else {
$result_dlt2 = db_process_sql_delete(
'trecon_task',
['id_recon_script' => $id_script]
);
if (!$result_dlt2) {
$result = [
'error' => 1,
'msg' => __('Problem deleting Net scan Scripts'),
];
} else {
$result = [
'error' => 0,
'msg' => __('Deleted successfully'),
];
}
}
return $result;
}
/**
* Print list Net scan scripts and messages operations.
*
* @param array $msg Print msg if necessary.
*
* @return void
*/
private function printListNetScanScripts(array $msg)
{
if (count($msg) > 0) {
if ($msg['error'] === 1) {
ui_print_error_message($msg['msg']);
} else {
ui_print_success_message($msg['msg']);
}
}
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$url .= '&wiz=hd&mode=managenetscanscripts';
// List available Net scan scripts.
$rows = db_get_all_rows_in_table('trecon_script');
if ($rows !== false) {
echo '<table width="100%" cellspacing="4" cellpadding="4" class="databox data">';
echo '<th>'.__('Name').'</th>';
echo '<th>'.__('Description').'</th>';
echo '<th>'.__('Delete').'</th>';
$color = 0;
foreach ($rows as $row) {
if ($color == 1) {
$tdcolor = 'datos';
$color = 0;
} else {
$tdcolor = 'datos2';
$color = 1;
}
echo '<tr>';
echo "<td class='".$tdcolor."' style='min-width: 100px;'>";
echo '<b><a href="'.$url.'&page=1&id_script='.$row['id_recon_script'].'">';
echo $row['name'];
echo '</a></b></td>';
echo "</td><td class='".$tdcolor."'>";
$desc = io_safe_output(
$row['description']
);
$desc = str_replace(
"\n",
'<br>',
$desc
);
echo $desc.'<br><br>';
echo '<b>'.__('Command').': </b><i>'.$row['script'].'</i>';
echo "</td><td align='center' class='".$tdcolor."'>";
// Delete.
echo '<form
method="post"
onsubmit="if (! confirm (\''.__('Are you sure delete script?').'\')) return false"
style="display: inline;">';
echo html_print_input_hidden('page', 0, true);
echo html_print_input_hidden(
'operation_scp',
'delete_scp',
true
);
echo html_print_input_hidden(
'id_script',
$row['id_recon_script'],
true
);
echo html_print_input_image(
'delete',
'images/cross.png',
1,
'',
true,
[
'title' => __('Delete Script'),
]
);
echo '</form>';
echo '</td></tr>';
}
echo '</table>';
echo "<form name=reconscript method='post' action='".$url."'>";
echo html_print_input_hidden('page', 1, true);
echo "<input name='crtbutton' style='float:right;' type='submit' class='sub next' value='".__('Add')."'>";
echo '</form>';
} else {
ui_print_info_message(
[
'no_close' => true,
'message' => __(
'There are no net scan scripts in the system'
),
]
);
}
}
/**
* Print form net scan scripts.
*
* @param integer $id_script Id script.
*
* @return void
*/
private function printFormScanScripts(int $id_script)
{
// Initialize vars.
if ($id_script !== 0) {
$form_id = $id_script;
$reconscript = db_get_row(
'trecon_script',
'id_recon_script',
$form_id
);
$form_name = $reconscript['name'];
$form_description = $reconscript['description'];
$form_script = $reconscript['script'];
$macros = $reconscript['macros'];
} else {
$form_name = '';
$form_description = '';
$form_script = '';
$macros = '';
}
$url = 'index.php?sec=gservers&sec2=godmode/servers/discovery';
$url .= '&wiz=hd&mode=managenetscanscripts';
if ($id_script !== 0) {
echo '<form name=reconscript method="post" action="'.$url.'&id_script='.$id_script.'">';
echo html_print_input_hidden('page', 0, true);
echo html_print_input_hidden(
'operation_scp',
'update_scp',
true
);
} else {
echo '<form name=reconscript method="post" action="'.$url.'">';
echo html_print_input_hidden('page', 0, true);
echo html_print_input_hidden(
'operation_scp',
'create_scp',
true
);
}
$table = new stdClass();
$table->width = '100%';
$table->id = 'table-form';
$table->class = 'databox filters';
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->data = [];
$data = [];
$data[0] = __('Name');
$data[0] .= ui_print_help_icon(
'reconscript_definition',
true,
'',
'images/help_w.png'
);
$data[1] = '<input type="text" name="form_name" size=30 value="'.$form_name.'">';
$table->data['recon_name'] = $data;
$table->colspan['recon_name'][1] = 3;
$data = [];
$data[0] = __('Script fullpath');
$data[1] = '<input type="text" name="form_script" size=70 value="'.$form_script.'">';
$table->data['recon_fullpath'] = $data;
$table->colspan['recon_fullpath'][1] = 3;
$data = [];
$data[0] = __('Description');
$data[1] = '<textarea name="form_description" cols="50" rows="4">';
$data[1] .= $form_description;
$data[1] .= '</textarea>';
$table->data['recon_description'] = $data;
$table->colspan['recon_description'][1] = 3;
$macros = json_decode($macros, true);
// This code is ready to add locked feature as plugins.
$locked = false;
// The next row number is recon_3.
$next_name_number = 3;
$i = 1;
while (1) {
// Always print at least one macro.
if ((!isset($macros[$i]) || $macros[$i]['desc'] == '') && $i > 1) {
break;
}
$macro_desc_name = 'field'.$i.'_desc';
$macro_desc_value = '';
$macro_help_name = 'field'.$i.'_help';
$macro_help_value = '';
$macro_value_name = 'field'.$i.'_value';
$macro_value_value = '';
$macro_name_name = 'field'.$i.'_macro';
$macro_name = '_field'.$i.'_';
$macro_hide_value_name = 'field'.$i.'_hide';
$macro_hide_value_value = 0;
if (isset($macros[$i]['desc'])) {
$macro_desc_value = $macros[$i]['desc'];
}
if (isset($macros[$i]['help'])) {
$macro_help_value = $macros[$i]['help'];
}
if (isset($macros[$i]['value'])) {
$macro_value_value = $macros[$i]['value'];
}
if (isset($macros[$i]['hide'])) {
$macro_hide_value_value = $macros[$i]['hide'];
}
$datam = [];
$datam[0] = __('Description');
$datam[0] .= "<span style='font-weight: normal'> ( ";
$datam[0] .= $macro_name;
$datam[0] .= ' )</span>';
$datam[0] .= html_print_input_hidden(
$macro_name_name,
$macro_name,
true
);
$datam[1] = html_print_input_text_extended(
$macro_desc_name,
$macro_desc_value,
'text-'.$macro_desc_name,
'',
30,
255,
$locked,
'',
"class='command_advanced_conf'",
true
);
if ($locked) {
$datam[1] .= html_print_image(
'images/lock.png',
true,
['class' => 'command_advanced_conf']
);
}
$datam[2] = __('Default value');
$datam[2] .= "<span style='font-weight: normal'> ( ";
$datam[2] .= $macro_name;
$datam[2] .= ' ) </span>';
$datam[3] = html_print_input_text_extended(
$macro_value_name,
$macro_value_value,
'text-'.$macro_value_name,
'',
30,
255,
$locked,
'',
"class='command_component command_advanced_conf'",
true
);
if ($locked) {
$datam[3] .= html_print_image(
'images/lock.png',
true,
['class' => 'command_advanced_conf']
);
}
$table->data['recon_'.$next_name_number] = $datam;
$next_name_number++;
$table->colspan['recon_'.$next_name_number][1] = 3;
$datam = [];
$datam[0] = __('Hide value');
$datam[0] .= ui_print_help_tip(
__('This field will show up as dots like a password'),
true
);
$datam[1] = html_print_checkbox_extended(
$macro_hide_value_name,
1,
$macro_hide_value_value,
0,
'',
['class' => 'command_advanced_conf'],
true,
'checkbox-'.$macro_hide_value_name
);
$table->data['recon_'.$next_name_number] = $datam;
$next_name_number++;
$table->colspan['recon_'.$next_name_number][1] = 3;
$datam = [];
$datam[0] = __('Help');
$datam[0] .= "<span style='font-weight: normal'> ( ";
$datam[0] .= $macro_name;
$datam[0] .= ' )</span><br><br><br>';
$tadisabled = ($locked === true) ? ' disabled' : '';
$datam[1] = html_print_textarea(
$macro_help_name,
6,
100,
$macro_help_value,
'class="command_advanced_conf" style="width: 97%;"'.$tadisabled,
true
);
if ($locked) {
$datam[1] .= html_print_image(
'images/lock.png',
true,
['class' => 'command_advanced_conf']
);
}
$datam[1] .= '<br><br><br>';
$table->data['recon_'.$next_name_number] = $datam;
$next_name_number++;
$i++;
}
if (!$locked) {
$datam = [];
$datam[0] = '<span style="font-weight: bold">';
$datam[0] .= __('Add macro').'</span>';
$datam[0] .= '<a href="javascript:new_macro(\'table-form-recon_\');update_preview();">';
$datam[0] .= html_print_image(
'images/add.png',
true
);
$datam[0] .= '</a>';
$datam[0] .= '<div id="next_macro" style="display:none">';
$datam[0] .= $i.'</div>';
$datam[0] .= '<div id="next_row" style="display:none">';
$datam[0] .= $next_name_number.'</div>';
$delete_macro_style = '';
if ($i <= 2) {
$delete_macro_style = 'display:none;';
}
$datam[2] = '<div id="delete_macro_button" style="'.$delete_macro_style.'">';
$datam[2] .= __('Delete macro');
$datam[2] .= '<a href="javascript:delete_macro_form(\'table-form-recon_\');update_preview();">';
$datam[2] .= html_print_image(
'images/delete.png',
true
);
$datam[2] .= '</a></div>';
$table->colspan['recon_action'][0] = 2;
$table->rowstyle['recon_action'] = 'text-align:center';
$table->colspan['recon_action'][2] = 2;
$table->data['recon_action'] = $datam;
}
html_print_table($table);
echo '<table width=100%>';
echo '<tr><td align="right">';
if ($id_script === 0) {
echo "<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
} else {
echo "<input name='uptbutton' type='submit' class='sub upd' value='".__('Update')."'>";
}
echo '</form></table>';
ui_require_javascript_file('pandora_modules');
}
}

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC190311';
$build_version = 'PC190313';
$pandora_version = 'v7.0NG.732';
// Do not overwrite default timezone set if defined.

View File

@ -535,12 +535,41 @@ define('MAP_GENERATION_RADIAL', 2);
define('MAP_GENERATION_SPRING1', 3);
define('MAP_GENERATION_SPRING2', 4);
// Algorithm: Circo.
define('LAYOUT_CIRCULAR', 0);
// Algorithm: Dot.
define('LAYOUT_FLAT', 1);
// Algorithm: Twopi.
define('LAYOUT_RADIAL', 2);
// Algorithm: Neato.
define('LAYOUT_SPRING1', 3);
// Algorithm: Fdp.
define('LAYOUT_SPRING2', 4);
// Extra: radial dynamic.
define('LAYOUT_RADIAL_DYNAMIC', 6);
// Map sources.
define('SOURCE_GROUP', 0);
define('SOURCE_TASK', 1);
define('SOURCE_NETWORK', 2);
// Backward compatibility ~ Migration.
define('MAP_SOURCE_GROUP', 0);
define('MAP_SOURCE_IP_MASK', 1);
define('NETWORKMAP_DEFAULT_WIDTH', 800);
define('NETWORKMAP_DEFAULT_HEIGHT', 800);
// Discovery task types.
define('DISCOVERY_HOSTDEVICES', 0);
define('DISCOVERY_HOSTDEVICES_CUSTOM', 1);
define('DISCOVERY_CLOUD_AWS', 10);
define('DISCOVERY_APP_VMWARE', 100);
// Discovery task descriptions.
define('CLOUDWIZARD_AWS_DESCRIPTION', 'Discovery.Cloud.AWS.EC2');
define('CLOUDWIZARD_VMWARE_DESCRIPTION', 'Discovery.App.VMware');
// Background options.
define('CENTER', 0);
define('MOSAIC', 1);

View File

@ -2202,7 +2202,7 @@ function agents_delete_agent($id_agents, $disableACL=false)
// Delete agent in networkmap enterprise
if (enterprise_installed()) {
enterprise_include_once('include/functions_pandora_networkmap.php');
enterprise_include_once('include/functions_networkmap.php');
networkmap_delete_nodes_by_agent([$id_agent]);
}

View File

@ -1828,11 +1828,11 @@ function config_process_config()
}
if (!isset($config['custom_title1_login'])) {
config_update_value('custom_title1_login', __('WELCOME TO PANDORA FMS'));
config_update_value('custom_title1_login', __('PANDORA FMS'));
}
if (!isset($config['custom_title2_login'])) {
config_update_value('custom_title2_login', __('NEXT GENERATION'));
config_update_value('custom_title2_login', __('ONE TOOL TO MONITOR THEM ALL'));
}
if (!isset($config['custom_docs_url'])) {

View File

@ -26,7 +26,7 @@
* ============================================================================
*/
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_tags.php';
require_once $config['homedir'].'/include/functions.php';
enterprise_include_once('meta/include/functions_events_meta.php');
@ -2513,9 +2513,8 @@ function events_page_custom_fields($event)
{
global $config;
//
// Custom fields.
//
$table = new stdClass;
$table->cellspacing = 2;
$table->cellpadding = 2;
$table->width = '100%';
@ -2666,9 +2665,8 @@ function events_page_details($event, $server='')
$serverstring = '';
}
//
// Details.
//
$table_details = new stdClass;
$table_details->width = '100%';
$table_details->data = [];
$table_details->head = [];
@ -3136,9 +3134,8 @@ function events_page_general($event)
global $group_rep;
//
// General.
//
$table_general = new stdClass;
$table_general->cellspacing = 2;
$table_general->cellpadding = 2;
$table_general->width = '100%';
@ -3300,11 +3297,10 @@ function events_page_general($event)
*/
function events_page_comments($event, $childrens_ids=[])
{
//
// Comments.
//
global $config;
$table_comments = new stdClass;
$table_comments->width = '100%';
$table_comments->data = [];
$table_comments->head = [];
@ -3319,7 +3315,9 @@ function events_page_comments($event, $childrens_ids=[])
$event_comments_array = json_decode($event_comments, true);
// Show the comments more recent first.
$event_comments_array = array_reverse($event_comments_array);
if (is_array($event_comments_array)) {
$event_comments_array = array_reverse($event_comments_array);
}
if (empty($event_comments_array)) {
$comments_format = 'old';
@ -3337,11 +3335,15 @@ function events_page_comments($event, $childrens_ids=[])
$table_comments->data[] = $data;
}
foreach ($event_comments_array as $c) {
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
$data[1] = $c['comment'];
$table_comments->data[] = $data;
if (isset($event_comments_array) === true
&& is_array($event_comments_array) === true
) {
foreach ($event_comments_array as $c) {
$data[0] = '<b>'.$c['action'].' by '.$c['id_user'].'</b>';
$data[0] .= '<br><br><i>'.date($config['date_format'], $c['utimestamp']).'</i>';
$data[1] = $c['comment'];
$table_comments->data[] = $data;
}
}
break;

View File

@ -121,9 +121,9 @@ if (!function_exists('mime_content_type')) {
global $config;
if (isset($config['homedir_filemanager'])) {
$homedir_filemanager = io_safe_output($config['homedir_filemanager']);
$homedir_filemanager = trim(io_safe_output($config['homedir_filemanager']));
} else {
$homedir_filemanager = $config['homedir'];
$homedir_filemanager = trim($config['homedir']);
}
$sec2 = get_parameter('sec2');

View File

@ -221,3 +221,219 @@ function run_graphviz($filename_map, $filename_dot, $layout, $graph)
return $filename_plain;
}
function open_graph($size_x=50, $size_y=25)
{
$size = '';
$size = $size_x.','.$size_y;
// BEWARE: graphwiz DONT use single ('), you need double (").
$head = 'graph vmwaremap { labeljust=l; margin=0; ';
$head .= 'ratio=fill;';
$head .= 'root=0;';
$head .= 'rankdir=LR;';
$head .= 'size="'.$size.'";';
return $head;
}
function create_node($node, $font_size=10)
{
// Set node status.
if (isset($node['status'])) {
switch ($node['status']) {
case AGENT_MODULE_STATUS_NORMAL:
$status_color = COL_NORMAL;
// Normal monitor.
break;
case AGENT_MODULE_STATUS_CRITICAL_BAD:
$status_color = COL_CRITICAL;
// Critical monitor.
break;
case AGENT_MODULE_STATUS_WARNING:
$status_color = COL_WARNING;
// Warning monitor.
break;
case AGENT_STATUS_ALERT_FIRED:
case AGENT_MODULE_STATUS_CRITICAL_ALERT:
case AGENT_MODULE_STATUS_WARNING_ALERT:
$status_color = COL_ALERTFIRED;
// Alert fired.
break;
case AGENT_MODULE_STATUS_NOT_INIT:
$status_color = COL_NOTINIT;
// Not init.
break;
default:
$status_color = COL_UNKNOWN;
// Unknown monitor.
break;
}
$status_color = 'color="'.$status_color.'",';
} else {
$status_color = '';
}
// Short name.
if (isset($node['nombre'])) {
$name = io_safe_output(strtolower($node['nombre']));
if (strlen($name) > 16) {
$name = substr($name, 0, 16).'...';
}
}
// Set node icon.
if (isset($node['image'])) {
if (file_exists($node['image'])) {
$img_node = $node['image'];
} else {
$img_node = null;
}
} else {
$img_node = null;
}
$result = $node['id_node'].' [ '.$status_color.' fontsize='.$font_size.', style="filled", fixedsize=true, width=0.40, height=0.40, label=<<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR><TD>'.html_print_image($img_node, true, false, false, true).'</TD></TR>
<TR><TD>'.$name.'</TD></TR></TABLE>>,
shape="doublecircle",
tooltip="ajax.php?page=operation/agentes/ver_agente&get_agent_status_tooltip=1&id_agent='.$node['id'].'"];';
return $result;
}
/**
* Returns an edge definition.
*
* @param string $head Origin.
* @param string $tail Target.
*
* @return string Edge str.
*/
function create_edge($head, $tail)
{
// Token edgeURL allows node navigation.
$edge = $head.' -- '.$tail.'[color="#BDBDBD", headclip=false, tailclip=false];'."\n";
return $edge;
}
// Closes a graph definition
function close_graph()
{
return '}';
}
function loadfile_map($file='', $graph)
{
global $config;
$networkmap_nodes = [];
$relations = [];
$other_file = file($file);
$graph = explode(']', $graph);
$ids = [];
foreach ($graph as $node) {
$line = str_replace("\n", ' ', $node);
if (preg_match('/([0-9]+) \[.*tooltip.*id_agent=([0-9]+)/', $line, $match) != 0) {
$ids[$match[1]] = ['id_agent' => $match[2]];
}
}
foreach ($other_file as $key => $line) {
$line = preg_replace('/[ ]+/', ' ', $line);
$data = [];
if (preg_match('/^node.*$/', $line) != 0) {
$items = explode(' ', $line);
$node_id = $items[1];
$node_x = ($items[2] * 100);
// 200 is for show more big
$node_y = ($height_map - $items[3] * 100);
// 200 is for show more big
$data['id'] = $node_id;
$data['image'] = '';
$data['width'] = 10;
$data['height'] = 10;
$data['id_agent'] = 0;
if (preg_match('/<img src=\"([^\"]*)\"/', $line, $match) == 1) {
$image = $match[1];
$data['image'] = $config['homeurl'].'/'.$image;
$size = getimagesize($config['homeurl'].'/'.$image);
$data['image_width'] = $size[0];
$data['image_height'] = $size[1];
if ($ids[$node_id]['id_agent'] == '') {
$data['id_agent'] = 0;
$data['label'] = get_product_name();
$data['color'] = COL_UNKNOWN;
} else {
$data['id_agent'] = $ids[$node_id]['id_agent'];
$data['label'] = io_safe_output(agents_get_alias($data['id_agent']));
$status = agents_get_status($data['id_agent']);
switch ($status) {
case 0:
$status_color = COL_NORMAL;
// Normal monitor
break;
case 1:
$status_color = COL_CRITICAL;
// Critical monitor
break;
case 2:
$status_color = COL_WARNING;
// Warning monitor
break;
case 4:
$status_color = COL_ALERTFIRED;
// Alert fired
break;
default:
$status_color = COL_UNKNOWN;
// Unknown monitor
break;
}
$data['color'] = $status_color;
}
}
$data['x'] = $node_x;
$data['y'] = $node_y;
$networkmap_nodes['nodes'][] = $data;
} else if (preg_match('/^edge.*$/', $line) != 0) {
$items = explode(' ', $line);
$line_orig = $items[2];
$line_dest = $items[1];
$networkmap_nodes['arrows'][] = [
'orig' => $line_orig,
'dest' => $line_dest,
];
}
}
return $networkmap_nodes;
}

View File

@ -506,8 +506,6 @@ function menu_add_extras(&$menu)
$menu_extra['workspace']['sub']['operation/incidents/incident_detail']['text'] = __('Manage incident');
$menu_extra['reporting']['sub']['godmode/reporting/visual_console_builder']['text'] = __('Manage visual console');
// Duplicate extensions as sec=extension to check it from url
foreach ($menu as $k => $m) {
if (!isset($m['sub'])) {
@ -645,6 +643,7 @@ function menu_get_sec_pages($sec, $menu_hash=false)
/**
* Get the pages in a section2
* $menu
*
* @param string sec code
* @param string menu hash. All the menu structure (For example

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,29 @@
<?php
;
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/*
* @package Include
* @subpackage Networkmaps
/**
* Library for networkmaps in Pandora FMS
*
* @category Deprecated
* @package Pandora FMS
* @subpackage NetworkMap
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Deprecated.

File diff suppressed because it is too large Load Diff

View File

@ -1026,16 +1026,14 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
$extended_events = events_get_extended_events($event['id_evento']);
foreach ($extended_events as $extended_event) {
$extended_data = [];
$extended_data[] = "<td colspan='5'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp'])."</font></td>";
$extended_data[] = "<td colspan='5'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
array_push($table1->data, $extended_data);
}
}
}
@ -1234,16 +1232,14 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$table1->data[] = $data;
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
$extended_events = events_get_extended_events($event['id_evento']);
foreach ($extended_events as $extended_event) {
$extended_data = [];
$extended_data[] = "<td colspan='3'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp'])."</font></td>";
$extended_data[] = "<td colspan='3'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
array_push($table1->data, $extended_data);
}
}
}
}
@ -2025,16 +2021,14 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
array_push($table1->data, $data);
if ($show_extended_events == 1 && events_has_extended_info($event['id_evento'])) {
$extended_events = events_get_extended_events($event['id_evento']);
foreach ($extended_events as $extended_event) {
$extended_data = [];
$extended_data[] = "<td colspan='4'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp'])."</font></td>";
$extended_data[] = "<td colspan='4'><font style='font-style: italic;'>".io_safe_output($extended_event['description'])."</font></td><td><font style='font-size: 6pt; font-style: italic;'>".date($config['date_format'], $extended_event['utimestamp']).'</font></td>';
array_push($table1->data, $extended_data);
}
}
}

View File

@ -1041,6 +1041,9 @@ function servers_get_server_string_name(int $server)
case SERVER_TYPE_WUX:
return __('WUX server');
case SERVER_TYPE_ENTERPRISE_SATELLITE:
return __('Satellite');
default:
return __('N/A');
}

View File

@ -1,21 +1,41 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2013 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once $config['homedir'].'/include/functions_config.php';
enterprise_include_once($config['homedir'].'/enterprise/include/pdf_translator.php');
enterprise_include_once($config['homedir'].'/enterprise/include/functions_metaconsole.php');
enterprise_include_once(
$config['homedir'].'/enterprise/include/pdf_translator.php'
);
enterprise_include_once(
$config['homedir'].'/enterprise/include/functions_metaconsole.php'
);
// Date format for nfdump
// Date format for nfdump.
global $nfdump_date_format;
$nfdump_date_format = 'Y/m/d.H:i:s';
@ -27,16 +47,23 @@ $nfdump_date_format = 'Y/m/d.H:i:s';
* @param id string Level ID. Do not set, used for recursion.
* @param depth string Branch depth. Do not set, used for recursion.
*/
function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[], $sufix=false, $checked=[])
{
function snmp_browser_print_tree(
$tree,
$id=0,
$depth=0,
$last=0,
$last_array=[],
$sufix=false,
$checked=[]
) {
static $url = false;
// Get the base URL for images
// Get the base URL for images.
if ($url === false) {
$url = ui_get_full_url('operation/tree', false, false, false);
}
// Leaf
// Leaf.
if (empty($tree['__LEAVES__'])) {
return;
}
@ -134,8 +161,19 @@ function snmp_browser_print_tree($tree, $id=0, $depth=0, $last=0, $last_array=[]
*
* @return array The SNMP tree.
*/
function snmp_browser_get_tree($target_ip, $community, $starting_oid='.', $version='2c', $snmp3_auth_user='', $snmp3_security_level='', $snmp3_auth_method='', $snmp3_auth_pass='', $snmp3_privacy_method='', $snmp3_privacy_pass='', $server_to_exec=0)
{
function snmp_browser_get_tree(
$target_ip,
$community,
$starting_oid='.',
$version='2c',
$snmp3_auth_user='',
$snmp3_security_level='',
$snmp3_auth_method='',
$snmp3_auth_pass='',
$snmp3_privacy_method='',
$snmp3_privacy_pass='',
$server_to_exec=0
) {
global $config;
if ($target_ip == '') {
@ -303,14 +341,33 @@ function snmp_browser_get_tree($target_ip, $community, $starting_oid='.', $versi
/**
* Retrieve data for the specified OID.
*
* @param target_ip string IP of the SNMP agent.
* @param community string SNMP community to use.
* @param target_oid SNMP OID to query.
* @param string $target_ip IP of the SNMP agent.
* @param string $community SNMP community to use.
* @param string $target_oid SNMP OID to query.
* @param string $version Version SNMP.
* @param string $snmp3_auth_user User snmp3.
* @param string $snmp3_security_level Security level snmp3.
* @param string $snmp3_auth_method Method snmp3.
* @param string $snmp3_auth_pass Pass snmp3.
* @param string $snmp3_privacy_method Privicy method snmp3.
* @param string $snmp3_privacy_pass Pass Method snmp3.
* @param integer $server_to_exec Execute with other server.
*
* @return array OID data.
* @return mixed OID data.
*/
function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c', $snmp3_auth_user='', $snmp3_security_level='', $snmp3_auth_method='', $snmp3_auth_pass='', $snmp3_privacy_method='', $snmp3_privacy_pass='')
{
function snmp_browser_get_oid(
$target_ip,
$community,
$target_oid,
$version='2c',
$snmp3_auth_user='',
$snmp3_security_level='',
$snmp3_auth_method='',
$snmp3_auth_pass='',
$snmp3_privacy_method='',
$snmp3_privacy_pass='',
$server_to_exec=0
) {
global $config;
if ($target_oid == '') {
@ -348,10 +405,38 @@ function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c'
break;
}
if ($version == '3') {
exec($snmpget_bin.' -m ALL -v 3 -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir, $output, $rc);
if ($server_to_exec != 0) {
$sql = sprintf(
'SELECT ip_address FROM tserver WHERE id_server = %d',
$server_to_exec
);
$server_data = db_get_row_sql($sql);
if ($version == '3') {
$command = $snmpget_bin.' -m ALL -v 3 -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir;
} else {
$command = $snmpget_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -On -c '.escapeshellarg(io_safe_output($community)).' -v '.escapeshellarg($version).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir;
}
exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command.'"',
$output,
$rc
);
} else {
exec($snmpget_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -On -c '.escapeshellarg(io_safe_output($community)).' -v '.escapeshellarg($version).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir, $output, $rc);
if ($version == '3') {
exec(
$snmpget_bin.' -m ALL -v 3 -u '.escapeshellarg($snmp3_auth_user).' -A '.escapeshellarg($snmp3_auth_pass).' -l '.escapeshellarg($snmp3_security_level).' -a '.escapeshellarg($snmp3_auth_method).' -x '.escapeshellarg($snmp3_privacy_method).' -X '.escapeshellarg($snmp3_privacy_pass).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir,
$output,
$rc
);
} else {
exec(
$snmpget_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -On -c '.escapeshellarg(io_safe_output($community)).' -v '.escapeshellarg($version).' '.escapeshellarg($target_ip).' '.escapeshellarg($target_oid).' 2> '.$error_redir_dir,
$output,
$rc
);
}
}
if ($rc != 0) {
@ -359,7 +444,7 @@ function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c'
}
foreach ($output as $line) {
// Separate the OID from the value
// Separate the OID from the value.
$full_oid = explode('=', $line);
if (! isset($full_oid[1])) {
break;
@ -368,7 +453,7 @@ function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c'
$oid = trim($full_oid[0]);
$oid_data['numeric_oid'] = $oid;
// Translate the OID
// Translate the OID.
if (empty($config['snmptranslate'])) {
switch (PHP_OS) {
case 'FreeBSD':
@ -387,10 +472,20 @@ function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c'
$snmptranslate_bin = $config['snmptranslate'];
}
exec(
$snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid),
$translate_output
);
if ($server_to_exec != 0) {
$command_output = $snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid);
exec(
'ssh pandora_exec_proxy@'.$server_data['ip_address'].' "'.$command_output.'"',
$translate_output,
$rc
);
} else {
exec(
$snmptranslate_bin.' -m ALL -M +'.escapeshellarg($config['homedir'].'/attachment/mibs').' -Td '.escapeshellarg($oid),
$translate_output
);
}
foreach ($translate_output as $line) {
if (preg_match('/SYNTAX\s+(.*)/', $line, $matches) == 1) {
$oid_data['syntax'] = $matches[1];
@ -403,7 +498,7 @@ function snmp_browser_get_oid($target_ip, $community, $target_oid, $version='2c'
}
}
// Parse the description. First search for it in custom values
// Parse the description. First search for it in custom values.
$custom_data = db_get_row('ttrap_custom_values', 'oid', $oid);
if ($custom_data === false) {
$translate_output = implode('', $translate_output);

View File

@ -476,7 +476,7 @@ function visual_map_print_item(
}
} else if ($is_a_link_to_other_visualconsole) {
if (!is_metaconsole()) {
$url = $config['homeurl'].'index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
$url = $config['homeurl'].'index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
} else {
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$layoutData['id_layout_linked'].'&refr=0';
}
@ -567,7 +567,7 @@ function visual_map_print_item(
if (METACONSOLE == 1) {
$url = $config['homeurl'].'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap='.$layoutData['id_layout_linked'].'&refr=300';
} else {
$url = $config['homeurl'].'index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
$url = $config['homeurl'].'index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
}
} else {
if (METACONSOLE == 1) {
@ -581,7 +581,7 @@ function visual_map_print_item(
case LABEL:
if ($layoutData['id_layout_linked'] != 0) {
// Link to a map
$url = $config['homeurl'].'index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
$url = $config['homeurl'].'index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
}
break;
@ -590,7 +590,7 @@ function visual_map_print_item(
if ($layoutData['id_layout_linked'] != 0) {
// Link to a map
if (empty($layoutData['id_metaconsole'])) {
$url = 'index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
$url = 'index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
} else {
$pure = get_parameter('pure', 0);
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_visualmap='.$layoutData['id_layout_linked'].'&refr=0';
@ -638,7 +638,7 @@ function visual_map_print_item(
} else if ($layoutData['id_layout_linked'] > 0) {
// Link to a map
if (empty($layoutData['id_metaconsole'])) {
$url = 'index.php?sec=reporting&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
$url = 'index.php?sec=network&amp;sec2=operation/visual_console/render_view&amp;pure='.$config['pure'].'&amp;id='.$layoutData['id_layout_linked'];
} else {
$pure = get_parameter('pure', 0);
$url = 'index.php?sec=screen&sec2=screens/screens&action=visualmap&pure='.$pure.'&id_visualmap='.$layoutData['id_layout_linked'].'&refr=0';

View File

@ -354,8 +354,18 @@ function ux_console_phases_donut($phases, $id, $return=false)
}
function d3_progress_bar($id, $percentile, $width, $height, $color, $unit='%', $text='', $fill_color='#FFFFFF')
{
function d3_progress_bar(
$id,
$percentile,
$width,
$height,
$color,
$unit='%',
$text='',
$fill_color='#FFFFFF',
$radiusx=10,
$radiusy=10
) {
global $config;
$recipient_name = 'progress_bar_'.$id;
@ -366,8 +376,19 @@ function d3_progress_bar($id, $percentile, $width, $height, $color, $unit='%', $
$output .= '<div id='.$recipient_name." style='overflow: hidden;'></div>";
$output .= include_javascript_d3(true);
$output .= "<script language=\"javascript\" type=\"text/javascript\">
progress_bar_d3('".$recipient_name_to_js."', ".(int) $percentile.', '.(int) $width.', '.(int) $height.", '".$color."', '".$unit."', '".$text."', '".$fill_color."');
</script>";
progress_bar_d3(
'".$recipient_name_to_js."',
".(int) $percentile.',
'.(int) $width.',
'.(int) $height.",
'".$color."',
'".$unit."',
'".$text."',
'".$fill_color."',
".(int) $radiusx.',
'.(int) $radiusy.',
);
</script>';
return $output;
}

View File

@ -1782,7 +1782,9 @@ function progress_bar_d3(
color,
unit,
label,
label_color
label_color,
radiusx,
radiusy
) {
var startPercent = 0;
var endPercent = parseInt(percentile) / 100;
@ -1799,20 +1801,20 @@ function progress_bar_d3(
.append("rect")
.attr("fill", "#000000")
.attr("fill-opacity", 0.5)
.attr("height", 20)
.attr("height", height)
.attr("width", width)
.attr("rx", 10)
.attr("ry", 10)
.attr("rx", radiusx)
.attr("ry", radiusy)
.attr("x", 0);
var progress_front = circle
.append("rect")
.attr("fill", color)
.attr("fill-opacity", 1)
.attr("height", 20)
.attr("height", height)
.attr("width", 0)
.attr("rx", 10)
.attr("ry", 10)
.attr("rx", radiusx)
.attr("ry", radiusy)
.attr("x", 0);
var labelText = circle
@ -1834,7 +1836,7 @@ function progress_bar_d3(
.style("font-weight", "bold")
.style("font-size", 14)
.attr("text-anchor", "middle")
.attr("dy", "-10");
.attr("dy", (height - height / 2) / 4);
function updateProgress(bar_progress) {
var percent_value = Number(bar_progress * 100);

View File

@ -52,6 +52,7 @@ Apart from the defined module macros, the following macros are also available:
<li>_event_extra_id_ : (Only event alerts) Extra id.</li>
<li>_event_id_: (Only event alerts) ID of the event that triggered the alert.</li>
<li>_event_text_severity_: (Only event alerts) Event text severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).</li>
<li>_eventTimestamp_: Timestamp in which the event was created.</li>
<li>_field1_: User defined field 1.</li>
<li>_field2_: User defined field 2.</li>
<li>_field3_: User defined field 3.</li>

View File

@ -37,6 +37,7 @@ Besides the defined module macros, the following macros are available:
<li>_event_extra_id_: (Only event alerts) Extra id.</li>
<li>_event_id_: (Only event alerts) ID of the event that triggered the alert.</li>
<li>_event_text_severity_: (Only event alerts) Event text severity (Maintenance, Informational, Normal Minor, Warning, Major, Critical).</li>
<li>_eventTimestamp_: Timestamp in which the event was created.</li>
<li>_field1_: User defined field 1.</li>
<li>_field2_: User defined field 2.</li>
<li>_field3_: User defined field 3.</li>

View File

@ -54,6 +54,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_event_extra_id_ : (Solo alertas de evento) Id extra.</li>
<li>_event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.</li>
<li>_event_text_severity_: (Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).</li>
<li>_eventTimestamp_: Timestamp en el que se creo el evento.</li>
<li>_field1_: Campo 1 definido por el usuario.</li>
<li>_field2_: Campo 2 definido por el usuario.</li>
<li>_field3_: Campo 3 definido por el usuario.</li>

View File

@ -37,6 +37,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_event_extra_id_ : (Solo alertas de evento) Id extra.</li>
<li>_event_id_: (Solo alertas de evento) Id del evento que disparó la alerta.</li>
<li>_event_text_severity_:(Solo alertas de evento) Prioridad en texto de el evento que dispara la alerta (Maintenance, Informational, Normal Minor, Warning, Major, Critical).</li>
<li>_eventTimestamp_: Timestamp en el que se creo el evento.</li>
<li>_field1_: Campo 1 definido por el usuario.</li>
<li>_field2_: Campo 2 definido por el usuario.</li>
<li>_field3_: Campo 3 definido por el usuario.</li>

View File

@ -53,6 +53,7 @@ email アクションを設定するには、_field1_ (送信先アドレス)、
<li>_event_extra_id_: (イベントアラートのみ) 拡張 ID</li>
<li>_event_id_ : (イベントアラートのみ) アラート発生元のイベントID</li>
<li>_event_text_severity_ : (イベントアラートのみ) イベント(アラートの発生元)のテキストでの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)</li>
<li>_eventTimestamp_: Timestamp in which the event was created.</li>
<li>_field1_ : ユーザ定義フィールド1</li>
<li>_field2_ : ユーザ定義フィールド2</li>
<li>_field3_ : ユーザ定義フィールド3</li>

View File

@ -37,6 +37,7 @@
<li>_event_extra_id_: (Only event alerts) Extra id.</li>
<li>_event_id_ : (イベントアラートのみ) アラート発生元のイベントID</li>
<li>_event_text_severity_ : (イベントアラートのみ) イベント(アラートの発生元)のテキストでの重要度 (Maintenance, Informational, Normal Minor, Warning, Major, Critical)</li>
<li>_eventTimestamp_: Timestamp in which the event was created.</li>
<li>_field1_ : ユーザ定義フィールド1</li>
<li>_field2_ : ユーザ定義フィールド2</li>
<li>_field3_ : ユーザ定義フィールド3</li>

View File

@ -164,6 +164,7 @@ function snmpGet(oid) {
var snmp3_privacy_method = $("#snmp3_browser_privacy_method").val();
var snmp3_privacy_pass = $("#password-snmp3_browser_privacy_pass").val();
var ajax_url = $("#hidden-ajax_url").val();
var server_to_exec = $("#server_to_exec").val();
// Check for a custom action
var custom_action = $("#hidden-custom_action").val();
@ -183,6 +184,7 @@ function snmpGet(oid) {
"snmp3_browser_auth_pass=" + snmp3_auth_pass,
"snmp3_browser_privacy_method=" + snmp3_privacy_method,
"snmp3_browser_privacy_pass=" + snmp3_privacy_pass,
"server_to_exec=" + server_to_exec,
"action=" + "snmpget",
"custom_action=" + custom_action,
"page=operation/snmpconsole/snmp_browser"

View File

@ -31,3 +31,36 @@ function progress_task_list(id, name, url) {
}
});
}
function show_map(id, name, url) {
var params = [];
params.push("page=include/ajax/task_list.ajax");
params.push("showmap=1");
params.push("id=" + id);
$("#progress_task")
.empty()
.hide()
.append("<p>Loading map</p>")
.dialog({
title: "Task: " + name,
resizable: true,
draggable: true,
modal: false,
width: 1280,
height: 700
})
.show();
jQuery.ajax({
data: params.join("&"),
type: "POST",
url: (action = url),
dataType: "html",
success: function(data) {
$("#progress_task")
.empty()
.append(data);
}
});
}

View File

@ -58,7 +58,7 @@
overflow-y: scroll;
}
#cluster_map {
#simple_map {
border: 1px solid lightgray;
width: 900px;
height: 500px;

View File

@ -29,41 +29,11 @@ div#error_buttons a {
width: 100%;
z-index: -9999;
position: absolute;
background-image: url("../../images/backgrounds/background_pandora_console_keys.jpg");
background: linear-gradient(74deg, #02020255 36%, transparent 36%),
url("../../images/backgrounds/background_pandora_console_keys.jpg");
background-repeat: repeat;
}
/*@media screen and (max-width: 1024px) { /* Specific to this particular image */
/* #login_body {
left: 50%;
margin-left: -512px; /* 50% */
/* }
}
@media screen and (max-width: 1100px) { /* Specific to this particular image */
/* #login_body {
background-image: url("../../images/backgrounds/background_pandora_console_keys.jpg");
background-repeat: repeat;
}
}
@media screen and (max-width: 1400px) { /* Specific to this particular image */
/* #login_body {
background-image: url("../../images/backgrounds/background_pandora_console_keys.jpg");
background-repeat: repeat;
}
}
@media screen and (max-width: 2000px) { /* Specific to this particular image */
/* #login_body {
background-image: url("../../images/backgrounds/background_pandora_console_keys.jpg");
background-repeat: repeat;
}
}
@media screen and (min-width: 2000px) { /* Specific to this particular image */
/* #login_body {
background-image: url("../../images/backgrounds/background_pandora_console_keys.jpg");
background-repeat: repeat;
}
}*/
p.log_in {
color: #fff !important;
padding: 0px 10px;
@ -77,7 +47,6 @@ h1#log_f {
}
div#error_login {
text-align: center;
margin-top: 5px;
margin-left: 5px;
width: 75%;
@ -104,8 +73,11 @@ div#login_f {
width: 100%;
position: absolute;
bottom: 10px;
color: #fff;
color: #878787;
text-align: center;
font-family: "Open Sans", sans-serif;
font-weight: 700;
font-size: 8.5pt;
}
/*
@ -118,23 +90,17 @@ div#login_f {
div#header_login {
width: 100%;
height: 65px;
background-color: rgba(255, 255, 255, 0.06);
}
div#icon_custom_pandora {
float: left;
margin-top: 5px;
margin-left: 4%;
}
div#list_icon_docs_support {
float: right;
margin-top: 8px;
margin-right: 4%;
float: left;
margin-top: 25px;
margin-left: 5%;
}
div#list_icon_docs_support ul {
margin-top: 5px;
line-height: 36px;
}
div#list_icon_docs_support ul li {
@ -145,6 +111,11 @@ div#list_icon_docs_support ul li {
font-size: 10pt;
}
div#list_icon_docs_support ul li a {
color: #979797;
font-size: 10pt;
}
li#li_margin_left {
margin-left: 30px;
}
@ -162,14 +133,6 @@ div.login_page {
float: left;
}
div.login_page form {
border-right: 1px solid #868686;
padding-top: 30px;
padding-bottom: 50px;
min-width: 400px;
max-height: 600px;
}
div.login_logo_icon {
margin-bottom: 40px;
text-align: center;
@ -177,7 +140,7 @@ div.login_logo_icon {
div.login_logo_icon img {
margin: 0 auto;
width: 150px;
max-width: 70%;
}
div.login_double_auth_code,
@ -186,27 +149,36 @@ div.login_pass {
margin: 0 auto;
width: 70%;
height: 40px;
background-color: rgba(255, 255, 255, 0.2) !important;
margin-bottom: 25px;
min-width: 260px;
background-color: #fff;
opacity: 0.77;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
border-radius: 3px;
}
div.login_nick img,
div.login_pass img {
vertical-align: middle;
margin: 3px;
div.login_nick input {
background-image: url("../../images/usuario_login.png");
}
div.login_pass input {
background-image: url("../../images/candado_login.png");
}
div.login_nick input,
div.login_pass input {
background-color: rgba(255, 255, 255, 0) !important;
border: 0px !important;
color: white !important;
border-radius: 0px;
width: 89%;
color: #343434;
border-radius: 3px;
width: 100%;
height: 40px;
font-size: 9pt;
padding: 0px !important;
font-size: 10pt;
padding: 0px 0px 0px 35px !important;
background-repeat: no-repeat;
background-size: 27px;
background-position: left center;
font-family: "Open Sans", sans-serif;
box-sizing: border-box;
}
div.login_nick input:focus,
@ -224,46 +196,76 @@ div.login_pass input:-webkit-autofill:focus,
div.login_pass input:-webkit-autofill:active {
transition: background-color 10000s ease-in-out 0s;
-webkit-box-shadow: 0 0 0px 0px transparent inset !important;
-webkit-text-fill-color: white !important;
-webkit-text-fill-color: #343434 !important;
border: 0px;
width: 89%;
}
div.login_nick input::-webkit-input-placeholder,
div.login_pass input::-webkit-input-placeholder {
color: white;
color: #343434;
}
div.login_pass img,
div.login_nick img {
width: 30px;
}
div.login_pass div,
div.login_nick div {
float: left;
width: 11%;
}
div.login_button {
div.login_button,
div.login_button_saml {
margin: 0 auto;
width: 70%;
width: 40%;
height: 40px;
background-color: rgb(25, 25, 25);
border: 1px solid white;
min-width: 260px;
margin-bottom: 20px;
}
div.login_button input {
width: 100%;
background-color: rgb(25, 25, 25) !important;
background-color: #82b92e !important;
text-align: center;
border: 0px;
border-radius: 0px;
height: 40px;
padding: 0px;
font-size: 9pt;
color: white;
font-size: 11pt;
color: #fff !important;
border: 1px solid #82b92e;
border-radius: 3px;
}
div.login_button_saml input {
border: 1px solid #fff;
background-color: #fff !important;
color: #000 !important;
background-image: url("../../images/saml_login.png");
background-repeat: no-repeat;
background-position: right 5% center;
}
div.login_button input:hover {
background-color: #fff !important;
color: #000 !important;
border: 1px solid #fff !important;
}
div.login_button_saml input:hover {
background-image: url("../../images/saml_login_hover.png");
background-color: transparent !important;
color: #fff !important;
border: 1px solid #fff !important;
}
#remove_button input {
background-image: url("../../images/user_login.png") !important;
background-repeat: no-repeat;
background-position: right 5% center;
}
#remove_button input:hover {
background-image: url("../../images/user_login_hover.png") !important;
}
.login_back input {
background-image: url("../../images/back_login.png") !important;
background-position: left 5% center !important;
}
.login_back input:hover {
background-image: url("../../images/back_login_hover.png") !important;
}
div.login_data {
@ -307,6 +309,21 @@ div.img_banner_login img {
min-height: 50%;
}
.reset_password {
width: 70%;
height: 40px;
margin-right: auto;
margin-left: auto;
margin-top: 20px;
text-align: center;
}
.reset_password a {
color: #ddd !important;
font-family: "Open Sans", sans-serif;
font-size: 8.5pt;
}
@media all and (max-width: 1200px) {
span.span1 {
font-size: 30pt;

View File

@ -4415,6 +4415,7 @@ div#header_discovery {
width: 9px;
font-weight: bold;
color: #fff;
margin-right: 15px;
}
div#header_discovery:hover {

View File

@ -128,8 +128,8 @@
</div>
<div style='height: 10px'>
<?php
$version = '7.0NG.732';
$build = '190311';
$version = '7.0NG.732';
$build = '190313';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -504,9 +504,9 @@ function create_loading_tooltip(d, x, y) {
}
function show_tooltip(d) {
x = d3.event.clientX + 10;
y = d3.event.clientY + 10;
x = d3.event.clientX 100;
y = d3.event.clientY 100;
if (d.default_tooltip) {
create_loading_tooltip(d, x, y);

View File

@ -1,18 +1,35 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2010 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
// Check user credentials
// Check user credentials.
check_login();
$id = (int) get_parameter('id_networkmap', 0);
@ -63,8 +80,7 @@ if ($edit_networkmap) {
} else {
$id_group = $values['id_group'];
// ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $id_group, "MR");
// ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $id_group, 'MW');
$networkmap_manage = check_acl($config['id_user'], $id_group, 'MM');
@ -221,7 +237,7 @@ if (!empty($result)) {
if ($not_found) {
ui_print_error_message(__('Not found networkmap.'));
} else {
$table = null;
$table = new stdClass();
$table->id = 'form_editor';
$table->width = '98%';

View File

@ -30,7 +30,6 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) {
}
require_once 'include/functions_networkmap.php';
require_once 'include/functions_pandora_networkmap.php';
$new_networkmap = (bool) get_parameter('new_networkmap', false);
$save_networkmap = (bool) get_parameter('save_networkmap', false);
@ -126,7 +125,14 @@ if (enterprise_installed()) {
$id = $result;
define('_id_', $id);
$tab = 'view';
if ($result !== false) {
$tab = 'view';
header(
'Location: '.ui_get_full_url(
'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab='.$tab.'&id_networkmap='.$id
)
);
}
} else if ($update_empty_networkmap) {
$id_group = (int) get_parameter('id_group', 0);
@ -189,9 +195,9 @@ if (enterprise_installed()) {
}
}
$result_txt = '';
// The networkmap doesn't exist yet
if ($new_networkmap || $save_networkmap) {
$result_txt = '';
if ($new_networkmap) {
if ($networkmaps_write || $networkmaps_manage) {
include 'pandora_networkmap.editor.php';
@ -244,8 +250,8 @@ if ($new_networkmap || $save_networkmap) {
$node_radius = (int) get_parameter('node_radius', 40);
$description = get_parameter('description', '');
$offset_x = get_parameter('pos_x');
$offset_y = get_parameter('pos_y');
$offset_x = get_parameter('pos_x', 0);
$offset_y = get_parameter('pos_y', 0);
$scale_z = get_parameter('scale_z', 0.5);
$node_sep = get_parameter('node_sep', '0.25');
@ -269,31 +275,31 @@ if ($new_networkmap || $save_networkmap) {
switch ($method) {
case 'twopi':
$values['generation_method'] = 2;
$values['generation_method'] = LAYOUT_RADIAL;
break;
case 'dot':
$values['generation_method'] = 1;
$values['generation_method'] = LAYOUT_FLAT;
break;
case 'circo':
$values['generation_method'] = 0;
$values['generation_method'] = LAYOUT_CIRCULAR;
break;
case 'neato':
$values['generation_method'] = 3;
$values['generation_method'] = LAYOUT_SPRING1;
break;
case 'fdp':
$values['generation_method'] = 4;
$values['generation_method'] = LAYOUT_SPRING2;
break;
case 'radial_dinamic':
$values['generation_method'] = 6;
$values['generation_method'] = LAYOUT_RADIAL_DYNAMIC;
break;
default:
$values['generation_method'] = 2;
$values['generation_method'] = LAYOUT_RADIAL;
break;
}
@ -349,14 +355,26 @@ if ($new_networkmap || $save_networkmap) {
$id = $result;
define('_id_', $id);
$tab = 'view';
if ($values['generation_method'] == 6) {
$tab = 'r_dinamic';
define('_activeTab_', 'radial_dynamic');
if ($result !== false) {
$tab = 'view';
if ($values['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
$tab = 'r_dinamic';
define('_activeTab_', 'radial_dynamic');
$url = 'index.php?sec=network&sec2=operation/agentes/networkmap.dinamic&activeTab=radial_dynamic';
header(
'Location: '.ui_get_full_url(
$url.'&id_networkmap='.$id
)
);
} else {
$url = 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap';
header(
'Location: '.ui_get_full_url(
$url.'&tab='.$tab.'&id_networkmap='.$id
)
);
}
}
header('Location: '.$_SERVER['HTTP_REFERER'].'&tab=view&id_networkmap='.$id);
}
}
// The networkmap exists
@ -421,8 +439,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
$source = (string) get_parameter('source', 'group');
$offset_x = get_parameter('pos_x');
$offset_y = get_parameter('pos_y');
$offset_x = get_parameter('pos_x', 0);
$offset_y = get_parameter('pos_y', 0);
$scale_z = get_parameter('scale_z', 0.5);
$values = [];
@ -714,6 +732,8 @@ switch ($tab) {
if (($count == 0) && ($network_map['source'] != 'empty')) {
if ($network_map['generated']) {
$data['nodes'] = __('Empty map');
} else if ($network_map['generation_method'] == LAYOUT_RADIAL_DYNAMIC) {
$data['nodes'] = __('Dynamic');
} else {
$data['nodes'] = __('Pending to generate');
}
@ -758,4 +778,3 @@ switch ($tab) {
}
break;
}

View File

@ -1,27 +1,44 @@
<?php
// ______ __ _______ _______ _______
// | __ \.---.-.-----.--| |.-----.----.---.-. | ___| | | __|
// | __/| _ | | _ || _ | _| _ | | ___| |__ |
// |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
//
// ============================================================================
// Copyright (c) 2007-2010 Artica Soluciones Tecnologicas, http://www.artica.es
// This code is NOT free software. This code is NOT licenced under GPL2 licence
// You cannnot redistribute it without written permission of copyright holder.
// ============================================================================
// Load global variables
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
global $config;
require_once 'include/functions_pandora_networkmap.php';
require_once 'include/functions_networkmap.php';
enterprise_include_once('include/functions_policies.php');
enterprise_include_once('include/functions_dashboard.php');
require_once 'include/functions_modules.php';
$public_hash = get_parameter('hash', false);
// Try to authenticate by hash on public dashboards
// Try to authenticate by hash on public dashboards.
if ($public_hash === false) {
// Login check
// Login check.
check_login();
} else {
$validate_hash = enterprise_hook(
@ -33,7 +50,10 @@ if ($public_hash === false) {
]
);
if ($validate_hash === false || $validate_hash === ENTERPRISE_NOT_HOOK) {
db_pandora_audit('Invalid public hash', 'Trying to access report builder');
db_pandora_audit(
'Invalid public hash',
'Trying to access report builder'
);
include 'general/noaccess.php';
exit;
}
@ -117,7 +137,7 @@ if (is_ajax()) {
);
$row['style'] = json_decode($row['style'], true);
$row['style']['shape'] = $shape;
// WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á
// WORK AROUND FOR THE JSON ENCODE WITH FOR EXAMPLE Ñ OR Á.
$row['style']['label'] = 'json_encode_crash_with_ut8_chars';
$row['style']['color'] = $color;
$row['style']['networkmap'] = $networkmap;
@ -215,52 +235,17 @@ if (is_ajax()) {
if ($get_tooltip_content) {
$id = (int) get_parameter('id', 0);
// Get all module from agent
switch ($config['dbtype']) {
case 'mysql':
case 'postgresql':
$sql = sprintf(
'
SELECT *
FROM tagente_estado, tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE tagente_modulo.id_agente_modulo = '.$id.'
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_modulo.delete_pending = 0
AND tagente_estado.utimestamp != 0'
);
break;
// If Dbms is Oracle then field_list in sql statement has to be recoded. See oracle_list_all_field_table()
case 'oracle':
$fields_tagente_estado = oracle_list_all_field_table(
'tagente_estado',
'string'
);
$fields_tagente_modulo = oracle_list_all_field_table(
'tagente_modulo',
'string'
);
$fields_tmodule_group = oracle_list_all_field_table(
'tmodule_group',
'string'
);
$sql = sprintf(
'
SELECT '.$fields_tagente_estado.', '.$fields_tagente_modulo.', '.$fields_tmodule_group.' FROM tagente_estado, tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE tagente_modulo.id_agente_modulo = '.$id.'
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_modulo.delete_pending = 0
AND tagente_estado.utimestamp != 0'
);
break;
}
$sql = sprintf(
'SELECT *
FROM tagente_estado, tagente_modulo
LEFT JOIN tmodule_group
ON tmodule_group.id_mg = tagente_modulo.id_module_group
WHERE tagente_modulo.id_agente_modulo = '.$id.'
AND tagente_estado.id_agente_modulo = tagente_modulo.id_agente_modulo
AND tagente_modulo.disabled = 0
AND tagente_modulo.delete_pending = 0
AND tagente_estado.utimestamp != 0'
);
$modules = db_get_all_rows_sql($sql);
if (empty($modules)) {
@ -377,7 +362,7 @@ if (is_ajax()) {
$return['content'] .= '<b>'.__('Status: ').'</b>'.ui_print_status_image($status, $title, true).'<br />';
if ($module['id_tipo_modulo'] == 24) {
// log4x
// Log4x.
switch ($module['datos']) {
case 10:
$salida = 'TRACE';
@ -410,7 +395,7 @@ if (is_ajax()) {
break;
}
$salida = "<span style='$style'>$salida</span>";
$salida = "<span style='".$style."'>".$salida.'</span>';
} else {
if (is_numeric($module['datos'])) {
$salida = format_numeric($module['datos']);
@ -513,7 +498,7 @@ if (is_ajax()) {
include_once 'include/functions_agents.php';
$id = (int) get_parameter('id', 0);
// q is what autocomplete plugin gives
// Q is what autocomplete plugin gives.
$string = (string) get_parameter('q');
$agents = db_get_all_rows_filter(
@ -586,8 +571,7 @@ if (is_ajax()) {
$filter = json_encode($array_filter);
// ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
// ACL for the network map.
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
@ -641,7 +625,7 @@ if (is_ajax()) {
return;
}
// Popup
// Popup.
$get_status_node = (bool) get_parameter('get_status_node', false);
$get_status_module = (bool) get_parameter(
'get_status_module',
@ -765,13 +749,14 @@ if (is_ajax()) {
// --------------END AJAX------------------------------------------------
$id = (int) get_parameter('id_networkmap', 0);
// Print some params to handle it in js
// Print some params to handle it in js.
html_print_input_hidden('product_name', get_product_name());
html_print_input_hidden('center_logo', ui_get_full_url(ui_get_logo_to_center_networkmap()));
$dash_mode = 0;
$map_dash_details = [];
$networkmap = db_get_row('tmap', 'id', $id);
if (enterprise_installed()) {
include_once 'enterprise/dashboard/widgets/network_map.php';
if ($id_networkmap) {
@ -783,7 +768,6 @@ if (enterprise_installed()) {
$map_dash_details['x_offs'] = $x_offs;
$map_dash_details['y_offs'] = $y_offs;
$map_dash_details['z_dash'] = $z_dash;
$networkmap = db_get_row('tmap', 'id', $id);
} else {
$networkmap_filter = json_decode($networkmap['filter'], true);
@ -819,7 +803,7 @@ if ($networkmap === false) {
return;
} else {
// ACL for the network map
// ACL for the network map.
$networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR');
$networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW');
$networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM');
@ -837,11 +821,11 @@ if ($networkmap === false) {
$pure = (int) get_parameter('pure', 0);
// Main code
// Main code.
if ($pure == 1) {
$buttons['screen'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;'.'sec2=operation/agentes/pandora_networkmap&amp;'.'tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap&amp;tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'images/normal_screen.png',
true,
['title' => __('Normal screen')]
@ -851,7 +835,7 @@ if ($networkmap === false) {
if (!$dash_mode) {
$buttons['screen'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;'.'sec2=operation/agentes/pandora_networkmap&amp;'.'pure=1&amp;tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap&amp;pure=1&amp;tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'images/full_screen.png',
true,
['title' => __('Full screen')]
@ -859,7 +843,7 @@ if ($networkmap === false) {
];
$buttons['list'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;'.'sec2=operation/agentes/pandora_networkmap">'.html_print_image(
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap">'.html_print_image(
'images/list.png',
true,
['title' => __('List of networkmap')]
@ -882,15 +866,8 @@ if ($networkmap === false) {
);
}
/*
$nodes_and_relations = networkmap_process_networkmap($id);
show_networkmap($id, $user_readonly, $nodes_and_relations, $dash_mode, $map_dash_details);
*/
include_once $config['homedir'].'/include/class/NetworkMap.class.php';
echo 'generado por clase';
$map_manager = new NetworkMap(
[ 'id_map' => $networkmap['id']]
);
@ -902,21 +879,16 @@ if ($networkmap === false) {
<script>
$(document).ready(function() {
$("*").on("click", function(){
if($("[aria-describedby=dialog_node_edit]").css('display') == 'block'){
$('#foot').css({'top':parseInt($("[aria-describedby=dialog_node_edit]").css('height')+$("[aria-describedby=dialog_node_edit]").css('top')),'position':'relative'});
}
else{
$('#foot').css({'position':'','top':'0'});
}
if($("[aria-describedby=dialog_node_edit]").css('display') == 'block'){
$('#foot').css({'top':parseInt($("[aria-describedby=dialog_node_edit]").css('height')+$("[aria-describedby=dialog_node_edit]").css('top')),'position':'relative'});
}
else{
$('#foot').css({'position':'','top':'0'});
}
});
$("[aria-describedby=dialog_node_edit]").on('dialogclose', function(event) {
$('#foot').css({'position':'','top':'0'});
$('#foot').css({'position':'','top':'0'});
});

View File

@ -88,6 +88,16 @@ $sort = get_parameter('sort', 'none');
$id_module = (int) get_parameter('id_module', 0);
$ag_custom_fields = (array) get_parameter('ag_custom_fields', []);
$module_option = (int) get_parameter('module_option', 1);
$autosearch = false;
// It is validated if it receives parameters different from those it has by default
if ($ag_freestring !== '' || $moduletype !== '' || $datatype !== ''
|| $ag_modulename !== '' || $refr !== 0 || $offset !== 0 || $status !== 4
|| $modulegroup !== -1 || $tag_filter !== 0 || $sortField !== ''
|| $sort !== 'none' || $id_module !== 0 || $module_option !== 1
) {
$autosearch = true;
}
if (!is_metaconsole()) {
$ag_group = (int) get_parameter('ag_group', 0);
@ -969,10 +979,8 @@ $sql = 'SELECT
ORDER BY '.$order['field'].' '.$order['order'].'
LIMIT '.$offset.','.$limit_sql;
// When you enter for the first time you have less than 4 query params in the url
$first_interaction = count($_GET) > 4;
// We do not show the modules until the user searches with the filter
if ($first_interaction) {
if ($autosearch) {
if (! defined('METACONSOLE')) {
$result = db_get_all_rows_sql($sql);
@ -1057,6 +1065,7 @@ if (($config['dbtype'] == 'oracle') && ($result !== false)) {
}
}
// Start Build List Result
//
if (!empty($result)) {

View File

@ -1068,9 +1068,6 @@ function validate_event_advanced(id, new_status) {
next_row_id = row_id_name + '-' + row_id_number_next;
$("#"+previous_row_id).css('display', 'none');
$("#"+current_row_id).css('display', 'none');
$("#"+selected_row_id).css('display', 'none');
$("#"+next_row_id).css('display', 'none');
}
});

View File

@ -1,24 +1,39 @@
<?php
/**
* Extension to manage a list of gateways and the node address where they should
* point to.
*
* @category Extensions
* @package Pandora FMS
* @subpackage Community
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation for version 2.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Load global vars
global $config;
require_once $config['homedir'].'/include/functions_snmp_browser.php';
ui_require_javascript_file('pandora_snmp_browser');
// AJAX call
// AJAX call.
if (is_ajax()) {
// Read the action to perform
// Read the action to perform.
$action = (string) get_parameter('action', '');
$target_ip = (string) get_parameter('target_ip', '');
$community = (string) get_parameter('community', '');
@ -29,9 +44,11 @@ if (is_ajax()) {
$snmp3_auth_method = get_parameter('snmp3_browser_auth_method');
$snmp3_auth_pass = io_safe_output(get_parameter('snmp3_browser_auth_pass'));
$snmp3_privacy_method = get_parameter('snmp3_browser_privacy_method');
$snmp3_privacy_pass = io_safe_output(get_parameter('snmp3_browser_privacy_pass'));
$snmp3_privacy_pass = io_safe_output(
get_parameter('snmp3_browser_privacy_pass')
);
// SNMP browser
// SNMP browser.
if ($action == 'snmptree') {
$starting_oid = (string) get_parameter('starting_oid', '.');
@ -83,9 +100,8 @@ if (is_ajax()) {
}
return;
}
// SNMP get
else if ($action == 'snmpget') {
} else if ($action == 'snmpget') {
// SNMP get.
$target_oid = htmlspecialchars_decode(get_parameter('oid', ''));
$custom_action = get_parameter('custom_action', '');
if ($custom_action != '') {
@ -102,8 +118,10 @@ if (is_ajax()) {
$snmp3_auth_method,
$snmp3_auth_pass,
$snmp3_privacy_method,
$snmp3_privacy_pass
$snmp3_privacy_pass,
$server_to_exec
);
snmp_browser_print_oid(
$oid,
$custom_action,
@ -117,7 +135,7 @@ if (is_ajax()) {
return;
}
// Check login and ACLs
// Check login and ACLs.
check_login();
if (! check_acl($config['id_user'], 0, 'AR')) {
db_pandora_audit(
@ -128,17 +146,36 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
exit;
}
// Header
// Header.
$url = 'index.php?sec=snmpconsole&sec2=operation/snmpconsole/snmp_browser&pure='.$config['pure'];
if ($config['pure']) {
// Windowed
$link['text'] = '<a target="_top" href="'.$url.'&pure=0&refr=30">'.html_print_image('images/normal_screen.png', true, ['title' => __('Normal screen')]).'</a>';
// Windowed.
$link['text'] = '<a target="_top" href="'.$url.'&pure=0&refr=30">';
$link['text'] .= html_print_image(
'images/normal_screen.png',
true,
['title' => __('Normal screen')]
);
$link['text'] .= '</a>';
} else {
// Fullscreen
$link['text'] = '<a target="_top" href="'.$url.'&pure=1&refr=0">'.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).'</a>';
// Fullscreen.
$link['text'] = '<a target="_top" href="'.$url.'&pure=1&refr=0">';
$link['text'] .= html_print_image(
'images/full_screen.png',
true,
['title' => __('Full screen')]
);
$link['text'] .= '</a>';
}
ui_print_page_header(__('SNMP Browser'), 'images/op_snmp.png', false, '', false, [$link]);
ui_print_page_header(
__('SNMP Browser'),
'images/op_snmp.png',
false,
'',
false,
[$link]
);
// SNMP tree container
// SNMP tree container.
snmp_browser_print_container();

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.732
%define release 190311
%define release 190313
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.732
%define release 190311
%define release 190313
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,10 +1,10 @@
package: pandorafms-server
Version: 7.0NG.732-190311
Version: 7.0NG.732-190313
Architecture: all
Priority: optional
Section: admin
Installed-Size: 640
Maintainer: Miguel de Dios <miguel.dedios@artica.es>
Maintainer: ÁRTICA ST <info@artica.es>
Homepage: http://pandorafms.org/
Depends: perl (>= 5.8), libdbi-perl, libdbd-mysql-perl, libtime-format-perl, libnetaddr-ip-perl, libtime-format-perl, libxml-simple-perl, libxml-twig-perl, libhtml-parser-perl, snmp, snmpd, traceroute, xprobe2, nmap, sudo, libwww-perl, libsocket6-perl, libio-socket-inet6-perl, snmp-mibs-downloader, libjson-perl, libnet-telnet-perl, libencode-locale-perl, libgeo-ip-perl
Description: Pandora FMS is a monitoring system for big IT environments. It uses remote tests, or local agents to grab information. Pandora supports all standard OS (Linux, AIX, HP-UX, Solaris and Windows XP,2000/2003), and support multiple setups in HA enviroments. This is the server package. Server makes the remote checks and process information transfer by Pandora FMS agents to the server.

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.732-190311"
pandora_version="7.0NG.732-190313"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732";
my $pandora_build = "190311";
my $pandora_build = "190313";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -32,7 +32,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.732";
my $pandora_build = "190311";
my $pandora_build = "190313";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.732
%define release 190311
%define release 190313
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.732
%define release 190311
%define release 190313
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.732"
PI_BUILD="190311"
PI_BUILD="190313"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.732 PS190311";
my $version = "7.0NG.732 PS190313";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.732 PS190311";
my $version = "7.0NG.732 PS190313";
# save program name for logging
my $progname = basename($0);