Merge remote-tracking branch 'origin/ent-EDF' into ent-4769-modulos-ssh-php-perl

This commit is contained in:
fbsanchez 2019-11-13 13:34:35 +01:00
commit 19897c3894
70 changed files with 1304 additions and 557 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.740-191029
Version: 7.0NG.740-191113
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.740-191029"
pandora_version="7.0NG.740-191113"
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.740';
use constant AGENT_BUILD => '191029';
use constant AGENT_BUILD => '191113';
# 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.740
%define release 191029
%define release 191113
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

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

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.740"
PI_BUILD="191029"
PI_BUILD="191113"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{191029}
{191113}
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.740(Build 191029)")
#define PANDORA_VERSION ("7.0NG.740(Build 191113)")
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.740(Build 191029))"
VALUE "ProductVersion", "(7.0NG.740(Build 191113))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.740-191029
Version: 7.0NG.740-191113
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.740-191029"
pandora_version="7.0NG.740-191113"
package_pear=0
package_pandora=1

View File

@ -11,4 +11,11 @@ echo Restart the apache.
/etc/init.d/apache2 restart
fi
# Install pandora_websocket_engine service.
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
chmod +x /etc/init.d/pandora_websocket_engine
echo "You can now start the Pandora FMS Websocket service by executing"
echo " /etc/init.d/pandora_websocket_engine start"
echo "Please, now, point your browser to http://your_IP_address/pandora_console/install.php and follow all the steps described on it."

View File

@ -298,70 +298,86 @@ function quickShellSettings()
ui_require_css_file('wizard');
ui_require_css_file('discovery');
// Parser.
// Gotty settings. Internal communication (WS).
$gotty = get_parameter(
'gotty',
$config['gotty']
);
$gotty_host = get_parameter(
'gotty_host',
$config['gotty_host']
);
$gotty_ssh_port = get_parameter(
'gotty_ssh_port',
$config['gotty_ssh_port']
);
$gotty_telnet_port = get_parameter(
'gotty_telnet_port',
$config['gotty_telnet_port']
);
$gotty_user = get_parameter(
'gotty_user',
$config['gotty_user']
);
$gotty_pass = get_parameter(
'gotty_pass',
io_output_password($config['gotty_pass'])
);
$gotty_pass = io_input_password($gotty_pass);
$changes = 0;
$critical = 0;
if ($config['gotty'] != $gotty) {
config_update_value('gotty', $gotty);
$changes++;
$critical++;
if (isset($config['gotty_host']) === false) {
config_update_value('gotty_host', '127.0.0.1');
}
if ($config['gotty_host'] != $gotty_host) {
config_update_value('gotty_host', $gotty_host);
$changes++;
if (isset($config['gotty_telnet_port']) === false) {
config_update_value('gotty_telnet_port', 8082);
}
if ($config['gotty_telnet_port'] != $gotty_telnet_port) {
config_update_value('gotty_telnet_port', $gotty_telnet_port);
$changes++;
if (isset($config['gotty_ssh_port']) === false) {
config_update_value('gotty_ssh_port', 8081);
}
if ($config['gotty_ssh_port'] != $gotty_ssh_port) {
config_update_value('gotty_ssh_port', $gotty_ssh_port);
$changes++;
}
// Parser.
if (get_parameter('qs_update', false) !== false) {
// Gotty settings. Internal communication (WS).
$gotty = get_parameter(
'gotty',
''
);
$gotty_host = get_parameter(
'gotty_host',
$config['gotty_host']
);
$gotty_ssh_port = get_parameter(
'gotty_ssh_port',
$config['gotty_ssh_port']
);
$gotty_telnet_port = get_parameter(
'gotty_telnet_port',
$config['gotty_telnet_port']
);
if ($config['gotty_user'] != $gotty_user) {
config_update_value('gotty_user', $gotty_user);
$changes++;
$critical++;
}
$gotty_user = get_parameter(
'gotty_user',
''
);
if ($config['gotty_pass'] != $gotty_pass) {
config_update_value('gotty_pass', $gotty_pass);
$changes++;
$critical++;
$gotty_pass = get_parameter(
'gotty_pass',
''
);
$gotty_pass = io_input_password($gotty_pass);
$changes = 0;
$critical = 0;
if ($config['gotty'] != $gotty) {
config_update_value('gotty', $gotty);
$changes++;
$critical++;
}
if ($config['gotty_host'] != $gotty_host) {
config_update_value('gotty_host', $gotty_host);
$changes++;
}
if ($config['gotty_telnet_port'] != $gotty_telnet_port) {
config_update_value('gotty_telnet_port', $gotty_telnet_port);
$changes++;
}
if ($config['gotty_ssh_port'] != $gotty_ssh_port) {
config_update_value('gotty_ssh_port', $gotty_ssh_port);
$changes++;
}
if ($config['gotty_user'] != $gotty_user) {
config_update_value('gotty_user', $gotty_user);
$changes++;
$critical++;
}
if ($config['gotty_pass'] != $gotty_pass) {
$gotty_pass = io_input_password($gotty_pass);
config_update_value('gotty_pass', $gotty_pass);
$changes++;
$critical++;
}
}
// Interface.
@ -392,7 +408,8 @@ function quickShellSettings()
'inputs' => [
[
'label' => __('Gotty path').ui_print_help_tip(
__('Leave blank if using an external Gotty service')
__('Leave blank if using an external Gotty service'),
true
),
'arguments' => [
'type' => 'text',
@ -426,7 +443,8 @@ function quickShellSettings()
],
[
'label' => __('Gotty user').ui_print_help_tip(
__('Optional, set a user to access gotty service')
__('Optional, set a user to access gotty service'),
true
),
'arguments' => [
'type' => 'text',
@ -436,7 +454,8 @@ function quickShellSettings()
],
[
'label' => __('Gotty password').ui_print_help_tip(
__('Optional, set a password to access gotty service')
__('Optional, set a password to access gotty service'),
true
),
'arguments' => [
'type' => 'password',
@ -444,6 +463,13 @@ function quickShellSettings()
'value' => io_output_password($config['gotty_pass']),
],
],
[
'arguments' => [
'type' => 'hidden',
'name' => 'qs_update',
'value' => 1,
],
],
[
'arguments' => [
'type' => 'submit',

View File

@ -105,7 +105,7 @@ if (check_login()) {
echo __(
"This is the online help for %s console. This help is -in best cases- just a brief contextual help, not intented to teach you how to use %s. Official documentation of %s is about 900 pages, and you probably don't need to read it entirely, but sure, you should download it and take a look.<br><br>
<a href='%s' target='_blanck' style='color: #82b92e; font-size: 10pt; text-decoration: underline;'>Download the official documentation</a>",
<a href='%s' target='_blanck' class='pandora_green_text' style='font-size: 10pt; text-decoration: underline;'>Download the official documentation</a>",
get_product_name(),
get_product_name(),
get_product_name(),

View File

@ -349,19 +349,19 @@ if ($config['menu_type'] == 'classic') {
// Support.
if (enterprise_installed()) {
$header_support_link = 'https://support.artica.es/';
$header_support_link = $config['custom_support_url'];
} else {
$header_support_link = 'https://pandorafms.com/forums/';
}
$header_support = '<div id="header_support">';
$header_support .= '<a href="'.$header_support_link.'" target="_blank">';
$header_support .= '<a href="'.ui_get_full_external_url($header_support_link).'" target="_blank">';
$header_support .= html_print_image('/images/header_support.png', true, ['title' => __('Go to support'), 'class' => 'bot', 'alt' => 'user']);
$header_support .= '</a></div>';
// Documentation.
$header_docu = '<div id="header_docu">';
$header_docu .= '<a href="https://wiki.pandorafms.com/index.php?title=Main_Page" target="_blank">';
$header_docu .= '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">';
$header_docu .= html_print_image('/images/header_docu.png', true, ['title' => __('Go to documentation'), 'class' => 'bot', 'alt' => 'user']);
$header_docu .= '</a></div>';
@ -635,12 +635,6 @@ if ($config['menu_type'] == 'classic') {
* Loads modal from AJAX to add feedback.
*/
function show_feedback() {
<?php
// Require specific CSS and JS.
ui_require_css_file('wizard');
ui_require_css_file('discovery');
ui_require_css_file('diagnostics');
?>
var btn_ok_text = '<?php echo __('Send'); ?>';
var btn_cancel_text = '<?php echo __('Cancel'); ?>';
var title = '<?php echo __('Report an issue'); ?>';
@ -719,13 +713,15 @@ if ($config['menu_type'] == 'classic') {
$("#agent_access").css("display","");
});
// Feedback.
$("#feedback-header").click(function () {
// Clean DOM.
$("#feedback-header").empty();
// Function charge Modal.
show_feedback();
});
<?php if (enterprise_installed()) { ?>
// Feedback.
$("#feedback-header").click(function () {
// Clean DOM.
$("#feedback-header").empty();
// Function charge Modal.
show_feedback();
});
<?php } ?>
function blinkpubli(){
$(".publienterprise").delay(100).fadeTo(300,0.2).delay(100).fadeTo(300,1, blinkpubli);

View File

@ -87,7 +87,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
echo '</td>';
echo '<td style="border:1px solid #FFF; text-align:center;">';
echo '<a href="'.$config['custom_docs_url'].'" target="_blank" style="text-decoration:none;">'.html_print_image(
echo '<a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank" style="text-decoration:none;">'.html_print_image(
'images/documentation.png',
true,
[
@ -96,7 +96,7 @@ echo '<div id="login_help_dialog" title="'.__('Welcome to %s', get_product_name(
]
).'</a>';
echo '<br style="margin-bottom: 40px;" />';
echo '<a style="font-size: 9pt;" href="'.$config['custom_docs_url'].'" target="_blank">'.__('Documentation').'</span></a>';
echo '<a style="font-size: 9pt;"href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Documentation').'</span></a>';
echo '</td>';
echo '</tr>';
echo '</table>';

View File

@ -88,6 +88,24 @@ if (!empty($config['login_background'])) {
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
}
// Get alternative custom in case of db fail.
$custom_fields = [
'custom_logo_login',
'custom_splash_login',
'custom_title1_login',
'custom_title2_login',
'rb_product_name',
];
foreach ($custom_fields as $field) {
if (!isset($config[$field])) {
if (isset($config[$field.'_alt'])) {
$config[$field] = $config[$field.'_alt'];
$custom_conf_enabled = true;
}
}
}
// Get the custom icons.
$docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo();
@ -102,7 +120,7 @@ if ($docs_logo !== false) {
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 id="li_margin_left"><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
}
echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
@ -133,7 +151,7 @@ if (defined('METACONSOLE')) {
html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
}
} else {
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] == 0) {
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] === 0) {
html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else {
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
@ -423,9 +441,14 @@ if ($login_screen == 'logout') {
}
switch ($login_screen) {
case 'error_authconfig':
case 'error_dbconfig':
$title = __('Problem with %s database', get_product_name());
case 'error_authconfig':
if (!isset($config['rb_product_name_alt'])) {
$title = __('Problem with %s database', get_product_name());
} else {
$title = __('Problem with %s database', $config['rb_product_name_alt']);
}
$message = __(
'Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file.<i><br/><br/>
Probably your database, hostname, user or password values are incorrect or

View File

@ -83,7 +83,6 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
</style>
</head>
<body>
<div id="alert_messages_na">
<div class='modalheade'>
@ -100,10 +99,29 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
?>
</div>
</div>
<a href='https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration' target='_blank'>
<div class='modalwikibutto cerrar'>
<span class='modalwikibuttontex'> <?php echo __('Documentation'); ?></span>
</div>
<?php
$custom_conf_enabled = false;
foreach ($config as $key => $value) {
if (preg_match('/._alt/i', $key)) {
$custom_conf_enabled = true;
break;
}
}
if (!$custom_conf_enabled) {
echo '
<a href="https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration" target="_blank">
<div class="modalwikibutto cerrar">
<span class="modalwikibuttontex">'.__('Documentation').'
</span>
</div>
</a>
';
}
?>
</a>
</div>

View File

@ -275,7 +275,7 @@ if ($new_agent) {
$table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').': '.ui_print_help_tip(__('Characters /,\,|,%,#,&,$ will be ignored'), true).'</p>';
$table_alias .= '<div class='.$label_select_parent.'>';
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true).'</div>';
$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
if ($new_agent) {
$table_alias .= '<div class="label_select_child_right">'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'</div>';
}

View File

@ -14,7 +14,7 @@
// Load global vars
check_login();
// Take some parameters (GET)
// Take some parameters (GET).
$offset = (int) get_parameter('offset');
$group_id = (int) get_parameter('group_id');
$ag_group = get_parameter('ag_group_refresh', -1);
@ -47,10 +47,10 @@ require_once 'include/functions_users.php';
$search = get_parameter('search', '');
// Prepare the tab system to the future
// Prepare the tab system to the future.
$tab = 'view';
// Setup tab
// Setup tab.
$viewtab['text'] = '<a href="index.php?sec=estado&sec2=operation/agentes/estado_agente">'.html_print_image('images/operation.png', true, ['title' => __('View')]).'</a>';
$viewtab['operation'] = true;
@ -59,10 +59,10 @@ $viewtab['active'] = false;
$onheader = ['view' => $viewtab];
// Header
// Header.
ui_print_page_header(__('Agents defined in %s', get_product_name()), 'images/agent_mc.png', false, '', true, $onheader);
// Perform actions
// Perform actions.
$agent_to_delete = (int) get_parameter('borrar_agente');
$enable_agent = (int) get_parameter('enable_agent');
$disable_agent = (int) get_parameter('disable_agent');
@ -99,7 +99,7 @@ if ($agent_to_delete) {
ui_print_result_message($result, __('Success deleted agent.'), __('Could not be deleted.'));
if (enterprise_installed()) {
// Check if the remote config file still exist
// Check if the remote config file still exist.
if (isset($config['remote_config'])) {
enterprise_include_once('include/functions_config_agents.php');
if (enterprise_hook('config_agents_has_remote_configuration', [$id_agente])) {
@ -114,7 +114,7 @@ if ($enable_agent) {
$alias = agents_get_alias($enable_agent);
if ($result) {
// Update the agent from the metaconsole cache
// Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php');
$values = ['disabled' => 0];
enterprise_hook('agent_update_from_cache', [$enable_agent, $values, $server_name]);
@ -136,7 +136,7 @@ if ($disable_agent) {
$alias = agents_get_alias($disable_agent);
if ($result) {
// Update the agent from the metaconsole cache
// Update the agent from the metaconsole cache.
enterprise_include_once('include/functions_agents.php');
$values = ['disabled' => 1];
enterprise_hook('agent_update_from_cache', [$disable_agent, $values, $server_name]);
@ -223,6 +223,10 @@ switch ($config['dbtype']) {
case 'oracle':
$order_collation = '';
break;
default:
// Default.
break;
}
$selected = true;
@ -252,6 +256,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -274,6 +282,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -296,6 +308,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -318,6 +334,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -378,7 +398,7 @@ if ($os != 0) {
}
$user_groups_to_sql = '';
// Show only selected groups
// Show only selected groups.
if ($ag_group > 0) {
$ag_groups = [];
$ag_groups = (array) $ag_group;
@ -388,7 +408,7 @@ if ($ag_group > 0) {
$user_groups_to_sql = implode(',', $ag_groups);
} else {
// Concatenate AW and AD permisions to get all the possible groups where the user can manage
// Concatenate AW and AD permisions to get all the possible groups where the user can manage.
$user_groupsAW = users_get_groups($config['id_user'], 'AW');
$user_groupsAD = users_get_groups($config['id_user'], 'AD');
@ -431,24 +451,25 @@ $sql = sprintf(
$agents = db_get_all_rows_sql($sql);
// Delete rnum row generated by oracle_recode_query() function
// Delete rnum row generated by oracle_recode_query() function.
if (($config['dbtype'] == 'oracle') && ($agents !== false)) {
for ($i = 0; $i < count($agents); $i++) {
unset($agents[$i]['rnum']);
}
}
// Prepare pagination
// Prepare pagination.
ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset);
if ($agents !== false) {
// Urls to sort the table.
// Agent name size and description for Chinese and Japanese languages are adjusted
$agent_font_size = '7';
$description_font_size = '6.5';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = '15';
$description_font_size = '11';
if ($config['language'] == 'ja'
|| $config['language'] == 'zh_CN'
|| $own_info['language'] == 'ja'
|| $own_info['language'] == 'zh_CN'
) {
// Adds a custom font size for Japanese and Chinese language.
$custom_font_size = 'custom_font_size';
}
$url_up_agente = 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id='.$ag_group.'&recursion='.$recursion.'&search='.$search.'&os='.$os.'&offset='.$offset.'&sort_field=name&sort=up&disabled=$disabled';
@ -476,21 +497,21 @@ if ($agents !== false) {
$rowPair = true;
$iterator = 0;
foreach ($agents as $agent) {
// Begin Update tagente.remote 0/1 with remote agent function return
// Begin Update tagente.remote 0/1 with remote agent function return.
if (enterprise_hook('config_agents_has_remote_configuration', [$agent['id_agente']])) {
db_process_sql_update('tagente', ['remote' => 1], 'id_agente = '.$agent['id_agente'].'');
} else {
db_process_sql_update('tagente', ['remote' => 0], 'id_agente = '.$agent['id_agente'].'');
}
// End Update tagente.remote 0/1 with remote agent function return
// End Update tagente.remote 0/1 with remote agent function return.
$all_groups = agents_get_all_groups_agent($agent['id_agente'], $agent['id_grupo']);
$check_aw = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW');
$check_ad = check_acl_one_of_groups($config['id_user'], $all_groups, 'AD');
$cluster = db_get_row_sql('select id from tcluster where id_agent = '.$agent['id_agente']);
// Do not show the agent if there is not enough permissions
// Do not show the agent if there is not enough permissions.
if (!$check_aw && !$check_ad) {
continue;
}
@ -512,7 +533,7 @@ if ($agents !== false) {
$rowPair = !$rowPair;
$iterator++;
// Agent name
// Agent name.
echo "<tr class='$rowclass'><td class='$tdcolor' width='40%'>";
if ($agent['disabled']) {
echo '<em>';
@ -537,7 +558,7 @@ if ($agents !== false) {
} else {
echo '<a alt ='.$agent['nombre']." href='index.php?sec=gagente&
sec2=godmode/agentes/configurar_agente&tab=$main_tab&
id_agente=".$agent['id_agente']."'>".'<span style="font-size: '.$agent_font_size.'pt" title="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
id_agente=".$agent['id_agente']."'>".'<span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span>'.'</a>';
}
echo '</strong>';
@ -617,12 +638,12 @@ if ($agents !== false) {
echo '</td>';
// Operating System icon
// Operating System icon.
echo "<td class='$tdcolor' align='left' valign='middle'>";
ui_print_os_icon($agent['id_os'], false);
echo '</td>';
// Type agent (Networt, Software or Satellite)
// Type agent (Networt, Software or Satellite).
echo "<td class='$tdcolor' align='left' valign='middle'>";
echo ui_print_type_agent_icon(
$agent['id_os'],
@ -634,10 +655,12 @@ if ($agents !== false) {
echo '</td>';
// Group icon and name
// Group icon and name.
echo "<td class='$tdcolor' align='left' valign='middle'>".ui_print_group_icon($agent['id_grupo'], true).'</td>';
// Description
echo "<td class='".$tdcolor."f9'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]', 'font-size: '.$description_font_size.'pt;').'</td>';
// Description.
echo "<td class='".$tdcolor."f9'><span class='".$custom_font_size."'>".ui_print_truncate_text($agent['comentarios'], 'description', true, true, true, '[&hellip;]').'</span></td>';
// Action
// When there is only one element in page it's necesary go back page.
if ((count($agents) == 1) && ($offset >= $config['block_size'])) {
@ -695,7 +718,7 @@ if ($agents !== false) {
}
if (check_acl($config['id_user'], 0, 'AW')) {
// Create agent button
// Create agent button.
echo '<div style="text-align: right;">';
echo '<form method="post" action="index.php?sec=gagente&amp;sec2=godmode/agentes/configurar_agente">';
html_print_input_hidden('new_agent', 1);

View File

@ -184,9 +184,11 @@ if ($own_info['is_admin'] || check_acl($config['id_user'], 0, 'PM')) {
}
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('validate');
ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript">
/* <![CDATA[ */
@ -201,7 +203,25 @@ $(document).ready (function () {
}
});
<?php endif; ?>
// Rule.
$.validator.addMethod(
"valueNotEquals",
function(value, element, arg) {
return arg != value;
},
"Value must not equal arg."
);
// configure your validation
$("form.add_alert_form").validate({
rules: {
id_agent_module: { valueNotEquals: "0" }
},
messages: {
id_agent_module: { valueNotEquals: "Please select an item!" }
}
});
$("select#template").change (function () {
id = this.value;
$a = $(this).siblings ("a.template_details");

View File

@ -290,7 +290,7 @@ $table_aux = new stdClass();
foreach ($result_graphs as $graph) {
$data = [];
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text($graph['name'], 70).'</a>';
$data[0] = '<a href="index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id='.$graph['id_graph'].'">'.ui_print_truncate_text(io_safe_output($graph['name']), 70).'</a>';
$data[1] = ui_print_truncate_text($graph['description'], 70);

View File

@ -3777,11 +3777,14 @@ $(document).ready (function () {
});
$("#checkbox-checkbox_show_resume").change(function(){
if($(this).is(":checked")){
type = $("#type").val();
if($(this).is(":checked") && type !== 'general'){
$("#row_select_fields2").show();
$("#row_select_fields3").show();
}
else{
$("#row_select_fields2").hide();
$("#row_select_fields3").hide();
}
});

View File

@ -557,7 +557,7 @@ $row++;
// For 5.1 Autohidden menu feature
$table_styles->data['autohidden'][0] = __('Autohidden menu');
$table_styles->data['autohidden'][0] = __('Automatically hide submenu');
$table_styles->data['autohidden'][1] = html_print_checkbox_switch(
'autohidden_menu',
1,
@ -1032,6 +1032,12 @@ $row++;
);
$row++;
$table_other->data[$row][0] = __('Font size for items reports');
$table_other->data[$row][1] = "<input type ='number' value=".$config['font_size_item_report']." size='1' name='font_size_item_report' min='1' max='9' step='0.1'>";
$row++;
// ----------------------------------------------------------------------
$dirItems = scandir($config['homedir'].'/images/custom_logo');
foreach ($dirItems as $entryDir) {

View File

@ -418,7 +418,7 @@ if ($own_info['is_admin']) {
else {
foreach ($info1 as $key => $usr) {
$u = get_user_info($key);
$g = users_get_groups($key, 'AR', $u['is_admin']);
$g = users_get_groups($key, false, $u['is_admin']);
$result = array_intersect($g, $own_groups);
// Show users without profile too.

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 B

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

View File

@ -706,18 +706,34 @@ class Diagnostics extends Wizard
$bytes = 1048576;
$mega = 1024;
switch ($item['Variable_name']) {
case 'sql_mode':
$name = __('Sql mode');
$value = ($item['Value']);
$status = (empty($item['Value']) === true) ? 1 : 0;
$message = __('Must be empty');
case 'innodb_buffer_pool_size':
$name = __('InnoDB buffer pool size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 250) ? 1 : 0;
$message = __(
'It has to be 40% of the server memory not recommended to be greater or less'
);
break;
case 'innodb_log_file_size':
$name = __('InnoDB log file size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 64) ? 1 : 0;
$message = __('Min. Recommended Value').' 64M';
case 'innodb_file_per_table':
$name = __('InnoDB file per table');
$value = $item['Value'];
$status = ($item['Value'] === 'ON') ? 1 : 0;
$message = __('Recommended ON');
break;
case 'innodb_flush_log_at_trx_commit':
$name = __('InnoDB flush log at trx-commit');
$value = $item['Value'];
$status = ($item['Value'] == 2) ? 1 : 0;
$message = __('Recommended Value').' 2';
break;
case 'innodb_lock_wait_timeout':
$name = __('InnoDB lock wait timeout');
$value = $item['Value'];
$status = ($item['Value'] >= 90) ? 1 : 0;
$message = __('Min. Recommended Value').' 90s';
break;
case 'innodb_log_buffer_size':
@ -727,13 +743,29 @@ class Diagnostics extends Wizard
$message = __('Min. Recommended Value').' 16M';
break;
case 'innodb_flush_log_at_trx_commit':
$name = __('InnoDB flush log at trx-commit');
$value = $item['Value'];
$status = (($item['Value'] / $bytes) >= 0) ? 1 : 0;
$message = __('Min. Recommended Value').' 0';
case 'innodb_log_file_size':
$name = __('InnoDB log file size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 64) ? 1 : 0;
$message = __('Min. Recommended Value').' 64M';
break;
/*
case 'join_buffer_size':
$name = __('Join buffer size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 265) ? 1 : 0;
$message = __('Min. Recommended Value 265');
break;
case 'key_buffer_size':
$name = __('Key buffer size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 256) ? 1 : 0;
$message = __('Min. Recommended Value').' 256';
break;
*/
case 'max_allowed_packet':
$name = __('Maximun allowed packet');
$value = ($item['Value'] / $bytes);
@ -741,27 +773,34 @@ class Diagnostics extends Wizard
$message = __('Min. Recommended Value').' 32M';
break;
case 'innodb_buffer_pool_size':
$name = __('InnoDB buffer pool size');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 250) ? 1 : 0;
$message = __(
'It has to be 40% of the server memory not recommended to be greater or less'
);
case 'max_connections':
$name = __('Maximun connections');
$value = $item['Value'];
$status = (($item['Value']) >= 90) ? 1 : 0;
$message = __('Min. Recommended Value');
$message .= ' 90 ';
$message .= __('conections');
break;
case 'sort_buffer_size':
$name = __('Sort buffer size');
$value = number_format(($item['Value'] / $mega), 2);
case 'query_cache_limit':
$name = __('Query cache limit');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 8) ? 1 : 0;
$message = __('Min. Recommended Value').' 8M';
break;
case 'query_cache_min_res_unit':
$name = __('Query cache min-res-unit');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 2) ? 1 : 0;
$message = __('Min. Recommended Value').' 2M';
break;
case 'query_cache_size':
$name = __('Query cache size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32';
break;
case 'join_buffer_size':
$name = __('Join buffer size');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $bytes) >= 265) ? 1 : 0;
$message = __('Min. Recommended Value 265');
$message = __('Min. Recommended Value').' 32M';
break;
case 'query_cache_type':
@ -771,83 +810,48 @@ class Diagnostics extends Wizard
$message = __('Recommended ON');
break;
case 'query_cache_size':
$name = __('Query cache size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32MB';
case 'read_buffer_size':
$name = __('Read buffer size');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32K';
break;
case 'query_cache_limit':
$name = __('Query cache limit');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 256) ? 1 : 0;
$message = __('Min. Recommended Value').' 256K';
case 'read_rnd_buffer_size':
$name = __('Read rnd-buffer size');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32K';
break;
case 'innodb_lock_wait_timeout':
$name = __('InnoDB lock wait timeout');
$value = $item['Value'];
$status = (($item['Value'] / $bytes) >= 90) ? 1 : 0;
$message = __('Min. Recommended Value').' 90s';
case 'sort_buffer_size':
$name = __('Sort buffer size');
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32K';
break;
case 'sql_mode':
$name = __('Sql mode');
$value = ($item['Value']);
$status = (empty($item['Value']) === true) ? 1 : 0;
$message = __('Must be empty');
break;
case 'thread_cache_size':
$name = __('Thread cache size');
$value = $item['Value'];
$status = (($item['Value'] / $bytes) >= 8) ? 1 : 0;
$status = ($item['Value'] >= 8) ? 1 : 0;
$message = __('Min. Recommended Value').' 8';
break;
case 'thread_stack':
$name = __('Thread stack');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 256) ? 1 : 0;
$message = __('Min. Recommended Value').' 256K';
break;
case 'max_connections':
$name = __('Maximun connections');
$value = $item['Value'];
$status = (($item['Value'] / $bytes) >= 90) ? 1 : 0;
$message = __('Min. Recommended Value').' 90';
break;
case 'key_buffer_size':
$name = __('Key buffer size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 256) ? 1 : 0;
$value = ($item['Value'] / $mega);
$status = (($item['Value'] / $mega) >= 256) ? 1 : 0;
$message = __('Min. Recommended Value').' 256';
break;
case 'read_buffer_size':
$name = __('Read buffer size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32';
break;
case 'read_rnd_buffer_size':
$name = __('Read rnd-buffer size');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 32) ? 1 : 0;
$message = __('Min. Recommended Value').' 32';
break;
case 'query_cache_min_res_unit':
$name = __('Query cache min-res-unit');
$value = ($item['Value'] / $bytes);
$status = (($item['Value'] / $bytes) >= 2) ? 1 : 0;
$message = __('Min. Recommended Value').' 2k';
break;
case 'innodb_file_per_table':
$name = __('InnoDB file per table');
$value = $item['Value'];
$status = ($item['Value'] === 'ON') ? 1 : 0;
$message = __('Recommended ON');
break;
default:
$name = '';
$value = 0;

View File

@ -54,6 +54,7 @@ class HelpFeedBack extends Wizard
*/
public $ajaxController;
/**
* Checks if target method is available to be called using AJAX.
*
@ -61,8 +62,6 @@ class HelpFeedBack extends Wizard
*
* @return boolean True allowed, false not.
*/
public function ajaxMethod($method)
{
return in_array($method, $this->AJAXMethods);
@ -91,6 +90,7 @@ class HelpFeedBack extends Wizard
*/
public function run()
{
ui_require_css_File('discovery');
ui_require_css_file('help_feedback');
$help_url = get_parameter('url', null);
@ -105,10 +105,15 @@ class HelpFeedBack extends Wizard
<?php
}
$hidden = '<input type="hidden" value="'.$help_url.'" ';
$hidden .= ' form="feedback_form" name="help_url" />';
echo $hidden;
echo '<div class="help_feedback">';
// Load feedback form.
echo $this->loadFeedbackForm();
echo '</div>';
echo '</div><div id="back" style="display: none"></div>';
}
@ -123,8 +128,6 @@ class HelpFeedBack extends Wizard
{
global $config;
ui_require_css_file('helper');
$form = [
'action' => '#',
'id' => 'feedback_form',
@ -134,35 +137,38 @@ class HelpFeedBack extends Wizard
$inputs = [
[
'wrapper' => 'div',
'block_id' => 'btn_section',
'class' => 'btn_section',
'block_id' => 'flex-row-baseline w100p',
'class' => 'flex-row-baseline w100p',
'direct' => 1,
'block_content' => [
[
'arguments' => [
'label' => __('Sugesstion'),
'type' => 'button',
'attributes' => 'class="btn_sug"',
'name' => 'option_1',
'id' => 'option_1',
'script' => 'change_option1()',
'type' => 'radio_button',
'attributes' => 'class="btn"',
'name' => 'suggestion',
'id' => 'suggestion',
'script' => 'disableRadio(\'report\')',
'return' => true,
],
],
[
'arguments' => [
'label' => __('Something is not quite right'),
'type' => 'button',
'attributes' => 'class="btn_something"',
'name' => 'option_2',
'id' => 'option_2',
'script' => 'change_option2()',
'type' => 'radio_button',
'attributes' => 'class="btn"',
'name' => 'report',
'id' => 'report',
'script' => 'disableRadio(\'suggestion\')',
'return' => true,
],
],
],
],
[
'label' => __('What Happend?'),
'label' => __('What happened?'),
'class' => 'explain',
'arguments' => [
'class' => 'textarea_feedback',
'id' => 'feedback_text',
@ -177,7 +183,8 @@ class HelpFeedBack extends Wizard
'name' => 'feedback_email',
'input_class' => 'email_feedback',
'class' => 'email_feedback',
'type' => 'text',
'type' => 'email',
'required' => true,
],
],
[
@ -192,21 +199,23 @@ class HelpFeedBack extends Wizard
],
];
$output = ui_toggle(
$this->printForm(
[
'form' => $form,
'inputs' => $inputs,
],
true
),
__('Feedback'),
'',
'',
true,
false,
'',
'no-border'
$output = ui_print_toggle(
[
'id' => 'toggle_help_feedback',
'content' => $this->printForm(
[
'form' => $form,
'inputs' => $inputs,
],
true
),
'name' => __('Feedback'),
'return' => true,
'class' => 'no-border',
'img_a' => 'images/arrow_down_white.png',
'img_b' => 'images/arrow_up_white.png',
]
);
$output .= $this->loadJS();
@ -222,80 +231,152 @@ class HelpFeedBack extends Wizard
* @param string $feedback_text text mail.
* @param string $feedback_mail costumer mail.
*
* @return integer Status of the email send task.
* @return void.
*/
public function sendMailMethod()
{
$subject = get_parameter('feedback_option', null);
$suggestion = get_parameter('type', 'false');
$feedback_text = get_parameter('feedback_text', null);
$feedback_mail = get_parameter('feedback_email', null);
$help_url = get_parameter('help_url', 'unknown');
$subject;
$section = explode('title=', $help_url, 2);
if ($subject === null) {
echo json_encode(['error' => __('No ha seleccionado una opcion')]);
$subject = '';
if (is_array($section) === true && isset($section[1]) === true) {
$subject = '['.$section[1].']';
}
if ($suggestion !== 'false') {
$subject .= __('[pandorafms wiki] New suggestion');
} else {
$subject .= __('[pandorafms wiki] New report');
}
if (empty($feedback_mail) === true) {
$error = [
'error' => __(
'Please provide your email address, we promise not to bother you'
),
];
}
if (empty($feedback_text) === true) {
if ($suggestion !== 'false') {
$msg = 'Please provide some feedback. Write something awesome!';
} else {
$msg = 'Please provide some feedback. We\'ll appreciate it!';
}
$error = [
'error' => __($msg),
];
}
if ($error !== null) {
echo json_encode($error);
exit;
}
enterprise_include_once('include/functions_cron.php');
$feedback_text .= '
From '.$feedback_mail.' ';
$uid = $config['pandora_uid'];
if (empty($uid) === true) {
$uid = 'not registered';
}
$res = enterprise_hook('send_email_attachment', ['feedback@artica.es', $feedback_text, $subject]);
$body = '<ul><li><b>User mail</b> '.$feedback_mail.'</li>';
$body .= '<li><b>Console</b> <i>'.$uid.'</i></li>';
$body .= '<li><b>URL</b> '.$help_url.'</li></ul>';
$body .= '<h2>Message</h2>';
$body .= '<p>'.$feedback_text.'</p>';
return $res;
$res = enterprise_hook(
'send_email_attachment',
[
'feedback@artica.es',
$body,
$subject,
]
);
// Response.
if ($res == 1) {
$r = ['error' => ''];
} else {
$r = ['error' => __('Something went wrong while sending the report.')];
}
echo json_encode($r);
exit;
}
/**
* Load extra JS.
*
* @return string JS content.
*/
public function loadJS()
{
ob_start();
?>
<script type="text/javascript">
var option_selected = "";
function change_option1() {
option_selected = "<?php echo __('Suggestion'); ?>";
document.getElementById("button-option_1").className = "btn_sug_not_selected";
document.getElementById("button-option_2").className = "btn_sug";
;
function disableRadio(id) {
$('#'+id).prop('checked', false)
}
function change_option2() {
option_selected = "<?php echo __('Something is not quite rigth'); ?>";
document.getElementById("button-option_2").className = "btn_sug_not_selected";
document.getElementById("button-option_1").className = "btn_sug";
}
// Set values to data.
$("#feedback_form").on('submit', function() {
// Make the AJAX call to send mails.
$.ajax({
type: "POST",
url: "ajax.php",
dataType: "html",
dataType: "json",
data: {
page: "<?php echo $this->ajaxController; ?>",
method: 'sendMailMethod',
feedback_option: option_selected,
type: $('#suggestion').prop('checked'),
feedback_text: $("textarea[name=feedback_text]").val(),
feedback_email: $("input[name=feedback_email]").val()
feedback_email: $("input[name=feedback_email]").val(),
help_url: $("input[name=help_url]").val(),
},
success: function (data) {
console.log(data);
if (data == 1) {
alert('Message sent');
var title;
var content;
var failed = 0;
var className='submit-next';
if (data.error != "") {
title = '<?php echo __('Failed'); ?>';
content = data.error;
failed = 1;
className='submit-cancel';
} else {
console.error("Error in AJAX call to send help feedback mail")
title = '<?php echo __('Success'); ?>';
content = '<?php echo __('Your report had been successfully sent to Artica.').'<br>'.__('Thank you!'); ?>';
}
$('#back').html(content);
$('#back').dialog({
title: title,
buttons: [
{
class:
"ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd " + className,
text: '<?php echo __('OK'); ?>',
click: function() {
$(this).dialog("close");
if (failed == 0) {
$('#toggle_help_feedback').empty();
}
}
},
]
})
},
error: function (data) {
console.error("Fatal error in AJAX call to send help feedback mail")
console.error("Fatal error in AJAX call to send help feedback mail")
}
});
});
@ -307,4 +388,3 @@ class HelpFeedBack extends Wizard
}

View File

@ -47,6 +47,19 @@ class WelcomeWindow extends Wizard
'cancelWelcome',
];
/**
* Tasks.
*
* @var array
*/
private $tasks = [
'welcome_mail_configured',
'welcome_id_agent',
'welcome_module',
'welcome_alert',
'welcome_task',
];
/**
* Url of controller.
*
@ -142,8 +155,8 @@ class WelcomeWindow extends Wizard
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
modal: {
title: "<?php echo __('Welcome to Pandora FMS'); ?>",
cancel: '<?php echo __('Ignore'); ?>',
ok: '<?php echo __('Cancel'); ?>'
cancel: '<?php echo __('Do not show anymore'); ?>',
ok: '<?php echo __('Close'); ?>'
},
onshow: {
page: '<?php echo $this->ajaxController; ?>',
@ -197,6 +210,23 @@ class WelcomeWindow extends Wizard
global $config;
$this->step = $config['welcome_state'];
// Get step available.
if (empty($config['welcome_mail_configured']) === true
&& get_parameter('sec2') == 'godmode/setup/setup'
&& get_parameter('section', '') == 'general'
&& get_parameter('update_config', false) !== false
) {
$this->step = W_CONFIGURE_MAIL;
} else if (empty($config['welcome_id_agent']) === true) {
$this->step = W_CREATE_AGENT;
} else if (empty($config['welcome_module']) === true) {
$this->step = W_CREATE_MODULE;
} else if (empty($config['welcome_alert']) === true) {
$this->step = W_CREATE_ALERT;
} else if (empty($config['welcome_task']) === true) {
$this->step = W_CREATE_TASK;
}
return $this->step;
}
@ -212,7 +242,61 @@ class WelcomeWindow extends Wizard
{
$this->step = $step;
config_update_value('welcome_state', $step);
}
/**
* Completes current step.
*
* @return void
*/
public function completeStep()
{
switch ($this->step) {
case W_CONFIGURE_MAIL:
config_update_value('welcome_mail_configured', true);
break;
case W_CREATE_AGENT:
config_update_value('welcome_id_agent', true);
break;
case W_CREATE_MODULE:
config_update_value('welcome_module', true);
break;
case W_CREATE_ALERT:
config_update_value('welcome_alert', true);
break;
case W_CREATE_TASK:
config_update_value('welcome_task', true);
break;
default:
// Ignore.
break;
}
}
/**
* Check if all tasks had been completed.
*
* @return boolean All completed or not.
*/
public function checkAllTasks()
{
global $config;
foreach ($this->tasks as $t) {
if (empty($config[$t]) === true) {
return false;
}
}
return true;
}
@ -258,47 +342,46 @@ class WelcomeWindow extends Wizard
$btn_create_alert_class = '';
$btn_create_discovery_class = 'pending';
switch ($this->step) {
case W_CREATE_AGENT:
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' pending';
break;
$li_configure_mail_class = 'green';
$li_create_agent_class = 'green';
$li_create_module_class = 'grey';
$li_create_alert_class = 'grey';
$li_create_discovery_class = 'green';
case W_CREATE_MODULE:
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' pending';
break;
if (empty($config['welcome_mail_configured']) === false) {
$btn_configure_mail_class = ' completed';
}
case W_CREATE_ALERT:
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' pending';
break;
if (empty($config['welcome_id_agent']) === false) {
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' pending';
$li_create_module_class = 'green';
}
case W_CREATE_TASK:
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' completed';
$btn_create_discovery_class = ' pending';
break;
if (empty($config['welcome_module']) === false) {
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' pending';
$li_create_module_class = 'green';
}
case WELCOME_FINISHED:
// Nothing left to do.
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' completed';
$btn_create_discovery_class = ' completed';
break;
if (empty($config['welcome_alert']) === false) {
$btn_create_alert_class = ' completed';
$li_create_alert_class = 'green';
}
default:
case W_CONFIGURE_MAIL:
// Nothing done yet.
$btn_configure_mail_class = ' pending';
break;
if (empty($config['welcome_task']) === false) {
$btn_create_discovery_class = ' completed';
}
if ((int) $config['welcome_state'] === WELCOME_FINISHED) {
// Nothing left to do.
$btn_configure_mail_class = ' completed';
$btn_create_agent_class = ' completed';
$btn_create_module_class = ' completed';
$btn_create_alert_class = ' completed';
$btn_create_discovery_class = ' completed';
$li_create_module_class = 'green';
$li_create_alert_class = 'green';
}
$form = [
@ -308,11 +391,32 @@ class WelcomeWindow extends Wizard
'class' => 'modal',
];
$logo_url = '';
if (enterprise_installed()) {
$logo_url = ENTERPRISE_DIR.'/';
}
$logo_url .= 'images/custom_logo/'.$config['custom_logo_white_bg'];
$inputs = [
[
'class' => 'white_box',
'block_content' => [
[
'class' => 'centered_full',
'arguments' => [
'type' => 'image',
'src' => $logo_url,
'value' => 1,
'return' => true,
],
],
],
],
[
'wrapper' => 'div',
'block_id' => 'div_configure_mail',
'class' => 'flex-row w100p',
'class' => 'hole flex-row w100p '.$li_configure_mail_class,
'direct' => 1,
'block_content' => [
[
@ -333,10 +437,20 @@ class WelcomeWindow extends Wizard
],
],
],
],[
],
[
'label' => 'Learn to monitor',
'class' => 'extra',
'arguments' => [
'class' => 'class="lbl_learn"',
'name' => 'lbl_learn',
'id' => 'lbl_learn',
],
],
[
'wrapper' => 'div',
'block_id' => 'div_create_agent',
'class' => 'flex-row w100p',
'class' => 'learn_content_indented flex-row w100p '.$li_create_agent_class,
'direct' => 1,
'block_content' => [
[
@ -358,18 +472,10 @@ class WelcomeWindow extends Wizard
],
],
],
[
'label' => 'Learn to monitor',
'arguments' => [
'class' => 'class="lbl_learn"',
'name' => 'lbl_learn',
'id' => 'lbl_learn',
],
],
[
'wrapper' => 'div',
'block_id' => 'div_monitor_actions',
'class' => 'learn_content_indented flex-row w100p',
'class' => 'learn_content_indented flex-row w100p '.$li_create_module_class,
'direct' => 1,
'block_content' => [
[
@ -394,7 +500,7 @@ class WelcomeWindow extends Wizard
[
'wrapper' => 'div',
'block_id' => 'div_monitor_actions',
'class' => 'learn_content_indented flex-row w100p',
'class' => 'hole learn_content_indented flex-row w100p '.$li_create_alert_class,
'direct' => 1,
'block_content' => [
[
@ -419,7 +525,7 @@ class WelcomeWindow extends Wizard
[
'wrapper' => 'div',
'block_id' => 'div_discover',
'class' => 'flex-row w100p',
'class' => 'hole flex-row w100p '.$li_create_discovery_class,
'direct' => 1,
'block_content' => [
[
@ -444,7 +550,7 @@ class WelcomeWindow extends Wizard
[
'wrapper' => 'div',
'block_id' => 'div_not_working',
'class' => 'flex-row w100p',
'class' => 'hole flex-row w100p',
'direct' => 1,
'block_content' => [
[
@ -499,14 +605,20 @@ class WelcomeWindow extends Wizard
global $config;
if (isset($config['welcome_state']) === false) {
$this->completeStep();
$this->setStep(W_CONFIGURE_MAIL);
}
// Check current page.
$sec2 = get_parameter('sec2', '');
// Search also does not fulfill sec2.
if (empty($sec2) === true) {
$sec2 = get_parameter('keywords', '');
}
if ($must_run === false
|| $config['welcome_state'] === WELCOME_FINISHED
|| ((int) $config['welcome_state']) === WELCOME_FINISHED
) {
// Do not show if finished.
return false;
@ -523,13 +635,14 @@ class WelcomeWindow extends Wizard
* After mail configuration: enable agent step.
*/
if ($this->step == W_CONFIGURE_MAIL) {
if ($this->step === W_CONFIGURE_MAIL) {
if ($sec2 === 'godmode/setup/setup'
&& get_parameter('section', '') == 'general'
&& get_parameter('update_config', false) !== false
) {
// Mail configuration have been processed.
$_SESSION['configured_mail'] = true;
$this->step = W_CONFIGURE_MAIL;
$this->completeStep();
$this->setStep(W_CREATE_AGENT);
} else if ($sec2 === 'godmode/setup/setup'
&& get_parameter('section', '') === 'general'
@ -537,7 +650,7 @@ class WelcomeWindow extends Wizard
// Mail configuration is being processed.
return false;
} else if (empty($sec2) === true) {
// If at main page, show welcome.
// Show main page.
return true;
}
}
@ -545,21 +658,29 @@ class WelcomeWindow extends Wizard
/*
* Create agent. Control current flow.
*
* On empty sec2: show current step.
* On agent creation page: do not show.
* After agent creation: enable module step.
* Welcome wizard is shown if you create your first agent.
*
*/
if ($this->step === W_CREATE_AGENT) {
if (empty($config['welcome_id_agent']) === true) {
// Create agent is pending.
if ($sec2 === 'godmode/agentes/configurar_agente'
&& get_parameter('create_agent', false) !== false
) {
// Agent have been created. Store.
// Here complete step is not needed because is already done
// by setWelcomeAgent.
$this->setWelcomeAgent(
db_get_value(
'MAX(id_agente)',
'tagente'
// Non yet processed. Get next available ID.
db_get_value_sql(
sprintf(
'SELECT AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "%s"
AND TABLE_NAME = "%s"',
$config['dbname'],
'tagente'
)
)
);
$this->setStep(W_CREATE_MODULE);
@ -571,6 +692,8 @@ class WelcomeWindow extends Wizard
// If at main page, show welcome.
return true;
}
} else if ($this->step === W_CREATE_AGENT) {
$this->step = W_CREATE_MODULE;
}
/*
@ -588,6 +711,7 @@ class WelcomeWindow extends Wizard
&& get_parameter('create_module', false) !== false
) {
// Module have been created.
$this->completeStep();
$this->setStep(W_CREATE_ALERT);
return true;
} else if ($sec2 === 'godmode/agentes/configurar_agente'
@ -616,6 +740,7 @@ class WelcomeWindow extends Wizard
&& get_parameter('create_alert', false) !== false
) {
// Alert have been created.
$this->completeStep();
$this->setStep(W_CREATE_TASK);
return true;
} else if ($sec2 === 'godmode/agentes/configurar_agente'
@ -637,24 +762,36 @@ class WelcomeWindow extends Wizard
* After discovery task creation: finish.
*/
if ($this->step === W_CREATE_TASK) {
// Create Discovery task is pending.
// Host&Devices finishses on page 2.
if ($sec2 === 'godmode/servers/discovery'
&& get_parameter('page', 0) == 2
) {
// Discovery task have been created.
$this->setStep(WELCOME_FINISHED);
// Create Discovery task is pending.
// Host&Devices finishses on page 2.
if ($sec2 === 'godmode/servers/discovery'
&& get_parameter('page', 0) == 2
) {
// Discovery task have been created.
$this->step = W_CREATE_TASK;
$this->completeStep();
// Check if all other tasks had been completed.
if ($this->checkAllTasks() === true) {
// Finished! do not show.
$this->setStep(WELCOME_FINISHED);
return false;
} else if ($sec2 == 'godmode/servers/discovery') {
// Discovery task is being created.
return false;
} else if (empty($sec2) === true) {
// If at main page, show welcome.
return true;
}
return true;
} else if ($sec2 == 'godmode/servers/discovery') {
// Discovery task is being created.
return false;
}
// Check if all other tasks had been completed.
if ($this->checkAllTasks() === true) {
// Finished! do not show.
$this->setStep(WELCOME_FINISHED);
return false;
} else if (empty($sec2) === true) {
// Pending tasks.
return true;
}
if ($this->step === WELCOME_FINISHED) {

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC191029';
$build_version = 'PC191113';
$pandora_version = 'v7.0NG.740';
// Do not overwrite default timezone set if defined.
@ -148,8 +148,6 @@ if (!isset($config['homeurl_static'])) {
}
}
db_select_engine();
$config['dbconnection'] = db_connect();
if (! defined('EXTENSIONS_DIR')) {
@ -160,6 +158,9 @@ if (! defined('ENTERPRISE_DIR')) {
define('ENTERPRISE_DIR', 'enterprise');
}
db_select_engine();
$config['dbconnection'] = db_connect();
require_once $ownDir.'functions_config.php';
date_default_timezone_set('Europe/Madrid');

View File

@ -147,7 +147,7 @@ define('COL_UNKNOWN', '#B2B2B2');
define('COL_DOWNTIME', '#976DB1');
define('COL_IGNORED', '#DDD');
define('COL_ALERTFIRED', '#F36201');
define('COL_MINOR', '#B2B2B2');
define('COL_MINOR', '#F099A2');
define('COL_MAJOR', '#C97A4A');
define('COL_INFORMATIONAL', '#E4E4E4');
define('COL_MAINTENANCE', '#4a83f3');

View File

@ -4092,6 +4092,18 @@ function mask2cidr($mask)
}
/**
* convert the cidr prefix to subnet mask
*
* @param int cidr prefix
* @return string subnet mask
*/
function cidr2mask($int)
{
return long2ip(-1 << (32 - (int) $int));
}
function get_help_info($section_name)
{
global $config;

View File

@ -1905,7 +1905,7 @@ function api_set_delete_agent($id, $thrash1, $other, $thrash3)
*
* @param $thrash1 Don't use.
* @param $thrash2 Don't use.
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator> in this order
* @param array $other it's array, $other as param are the filters available <filter_so>;<filter_group>;<filter_modules_states>;<filter_name>;<filter_policy>;<csv_separator><recursion> in this order
* and separator char (after text ; ) and separator (pass in param othermode as othermode=url_encode_separator_<separator>)
* example for CSV:
*
@ -1934,17 +1934,25 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
}
if (isset($other['data'][0])) {
// Filter by SO
// Filter by SO.
if ($other['data'][0] != '') {
$where .= ' AND tconfig_os.id_os = '.$other['data'][0];
}
}
if (isset($other['data'][1])) {
// Filter by group
// Filter by group.
if ($other['data'][1] != '') {
$where .= ' AND id_grupo = '.$other['data'][1];
$ag_groups = $other['data'][1];
// Recursion.
if ($other['data'][6] === '1') {
$ag_groups = groups_get_id_recursive($ag_groups, true);
}
$ag_groups = implode(',', (array) $ag_groups);
}
$where .= ' AND (id_grupo IN ('.$ag_groups.') OR id_group IN ('.$ag_groups.'))';
}
if (isset($other['data'][3])) {
@ -1974,24 +1982,27 @@ function api_get_all_agents($thrash1, $thrash2, $other, $returnType)
// Initialization of array
$result_agents = [];
// Filter by state
if (defined('METACONSOLE')) {
$sql = "SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tconfig_os, tmetaconsole_agent
LEFT JOIN tagent_secondary_group
ON tmetaconsole_agent.id_agente = tagent_secondary_group.id_agent
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
AND disabled = 0 $where AND $groups";
if (is_metaconsole()) {
$sql = 'SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tconfig_os, tmetaconsole_agent
LEFT JOIN tmetaconsole_agent_secondary_group
ON tmetaconsole_agent.id_agente = tmetaconsole_agent_secondary_group.id_agent
WHERE tmetaconsole_agent.id_os = tconfig_os.id_os
AND disabled = 0 '.$where.' AND '.$groups;
} else {
$sql = "SELECT id_agente, alias, direccion, comentarios,
$sql = 'SELECT id_agente, alias, direccion, comentarios,
tconfig_os.name, url_address, nombre
FROM tconfig_os, tagente
LEFT JOIN tagent_secondary_group
ON tagente.id_agente = tagent_secondary_group.id_agent
WHERE tagente.id_os = tconfig_os.id_os
AND disabled = 0 $where AND $groups";
AND disabled = 0 '.$where.' AND '.$groups;
}
// Group by agent
$sql .= ' GROUP BY id_agente';
$all_agents = db_get_all_rows_sql($sql);
// Filter by status: unknown, warning, critical, without modules
@ -9080,7 +9091,9 @@ function api_set_delete_module($id, $id2, $other, $trash1)
function api_set_module_data($id, $thrash2, $other, $trash1)
{
if (defined('METACONSOLE')) {
global $config;
if (is_metaconsole()) {
return;
}
@ -9129,8 +9142,9 @@ function api_set_module_data($id, $thrash2, $other, $trash1)
);
if (false === @file_put_contents($config['remote_config'].'/'.io_safe_output($agent['nombre']).'.'.$time.'.data', $xml)) {
returnError('error_file', 'Can save agent data xml.');
returnError('error_file', 'XML file could not be generated in path: '.$config['remote_config']);
} else {
echo __('XML file was generated successfully in path: ').$config['remote_config'];
returnData('string', ['type' => 'string', 'data' => $xml]);
return;
}
@ -14226,6 +14240,46 @@ function api_get_agents_id_name_by_cluster_name($cluster_name, $trash1, $trash2,
}
/**
* Get agents alias, id and server id (if Metaconsole) given agent alias
* matching part of it.
*
* @param string $alias
* @param $trash1
* @param $trash2
* @param string $returnType
* Example:
* api.php?op=get&op2=agents_id_name_by_alias&return_type=json&apipass=1234&user=admin&pass=pandora&id=pandrora&id2=strict
*/
function api_get_agents_id_name_by_alias($alias, $strict, $trash2, $returnType)
{
global $config;
if ($strict == 'strict') {
$where_clause = " alias = '$alias'";
} else {
$where_clause = " upper(alias) LIKE upper('%$alias%')";
}
if (is_metaconsole()) {
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente, id_tagente,id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE $where_clause");
} else {
$all_agents = db_get_all_rows_sql("SELECT alias, id_agente from tagente WHERE $where_clause");
}
if ($all_agents !== false) {
$data = [
'type' => 'json',
'data' => $all_agents,
];
returnData('json', $data, JSON_FORCE_OBJECT);
} else {
returnError('error_agents', 'Alias did not match any agent.');
}
}
function api_get_modules_id_name_by_cluster_id($cluster_id)
{
global $config;

View File

@ -1281,6 +1281,10 @@ function config_update_config()
}
// Juanma (06/05/2014) New feature: Custom front page for reports.
if (!config_update_value('font_size_item_report', get_parameter('font_size_item_report', 2))) {
$error_update[] = __('Font size for items reports');
}
if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) {
$error_update[] = __('Custom report front');
}
@ -2809,6 +2813,10 @@ function config_process_config()
config_update_value('custom_report_front', 0);
}
if (!isset($config['font_size_item_report'])) {
config_update_value('font_size_item_report', 2);
}
if (!isset($config['custom_report_front_font'])) {
config_update_value('custom_report_front_font', 'FreeSans.ttf');
}

View File

@ -2279,33 +2279,47 @@ function html_print_table(&$table, $return=false)
/**
* Render a radio button input. Extended version, use html_print_radio_button() to simplify.
* Render a radio button input. Extended version, use html_print_input()
* to simplify.
*
* @param string Input name.
* @param string Input value.
* @param string Set the button to be marked (optional, unmarked by default).
* @param bool Disable the button (optional, button enabled by default).
* @param string Script to execute when onClick event is triggered (optional).
* @param string Optional HTML attributes. It's a free string which will be
inserted into the HTML tag, use it carefully (optional).
* @param bool Whether to return an output string or echo now (optional, echo by default).
* @param string $name Input name.
* @param string $value Input value.
* @param string $label Set the button to be marked (optional, unmarked by default).
* @param string $checkedvalue Checked value.
* @param string $disabled Disable the button (optional, button enabled by default).
* @param string $script Script to execute when onClick event is triggered (optional).
* @param string $attributes Optional HTML attributes. It's a free string which will be inserted tag, use it carefully (optional).
* @param string $returnparam Whether to return an output string or echo now (optional, echo by default).
* @param string $modalparam Modal param.
* @param string $message Message.
* @param string $id Use custom id.
*
* @return string HTML code if return parameter is true.
*/
/*
Hello there! :)
We added some of what seems to be "buggy" messages to the openSource version recently. This is not to force open-source users to move to the enterprise version, this is just to inform people using Pandora FMS open source that it requires skilled people to maintain and keep it running smoothly without professional support. This does not imply open-source version is limited in any way. If you check the recently added code, it contains only warnings and messages, no limitations except one: we removed the option to add custom logo in header. In the Update Manager section, it warns about the 'danger of applying automated updates without a proper backup, remembering in the process that the Enterprise version comes with a human-tested package. Maintaining an OpenSource version with more than 500 agents is not so easy, that's why someone using a Pandora with 8000 agents should consider asking for support. It's not a joke, we know of many setups with a huge number of agents, and we hate to hear that “its becoming unstable and slow” :(
You can of course remove the warnings, that's why we include the source and do not use any kind of trick. And that's why we added here this comment, to let you know this does not reflect any change in our opensource mentality of does the last 14 years.
*/
function html_print_radio_button_extended($name, $value, $label, $checkedvalue, $disabled, $script, $attributes, $return=false, $modal=false, $message='visualmodal')
{
function html_print_radio_button_extended(
$name,
$value,
$label,
$checkedvalue,
$disabled,
$script,
$attributes,
$return=false,
$modal=false,
$message='visualmodal',
$id=null
) {
static $idcounter = 0;
$output = '';
$output = '<input type="radio" name="'.$name.'" value="'.$value.'"';
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
if (empty($id) === false) {
$htmlid = $id;
} else {
$htmlid = 'radiobtn'.sprintf('%04d', ++$idcounter);
}
$output .= ' id="'.$htmlid.'"';
if ($value == $checkedvalue) {
@ -3464,6 +3478,26 @@ function html_print_input($data, $wrapper='div', $input_only=false)
);
break;
case 'radio_button':
$output .= html_print_radio_button_extended(
$data['name'],
$data['value'],
$data['label'],
((isset($data['checkedvalue']) === true) ? $data['checkedvalue'] : 1),
((isset($data['disabled']) === true) ? $data['disabled'] : ''),
((isset($data['script']) === true) ? $data['script'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : true),
((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['modal']) === true) ? $data['modal'] : false),
((isset($data['message']) === true) ? $data['message'] : 'visualmodal'),
((isset($data['id']) === true) ? $data['id'] : null)
);
break;
case 'email':
$output .= html_print_input_email($data);
break;
default:
// Ignore.
break;

View File

@ -179,6 +179,10 @@ function reporting_make_reporting_data(
$report['group_name'] = groups_get_name($report['id_group']);
$report['contents'] = [];
if (empty($report['period'])) {
$report['period'] = $period;
}
if (empty($contents)) {
return reporting_check_structure_report($report);
}

View File

@ -121,12 +121,9 @@ function html_do_report_info($report)
</tr>
<tr>
<td><b>'.__('Report date').': </b></td>';
if (isset($report['period'])) {
if (is_numeric($report['datetime']) && is_numeric($report['period'])) {
$html .= '<td>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</td>';
}
$html .= '<td></td>';
if (is_numeric($report['datetime']) && is_numeric($report['period']) && ($report['period'] != 0)) {
$html .= '<td>'.__('From').' <b>'.date($config['date_format'], ($report['datetime'] - $report['period'])).'</b></td>';
$html .= '<td>'.__('to').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
} else {
$html .= '<td>'.__('Items period before').' <b>'.date($config['date_format'], $report['datetime']).'</b></td>';
}
@ -450,7 +447,7 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($mini) {
$font_size = '1.5';
} else {
$font_size = '3';
$font_size = $config['font_size_item_report'];
}
$metaconsole_on = is_metaconsole();
@ -2496,7 +2493,7 @@ function reporting_html_monitor_report($table, $item, $mini, $pdf=0)
if ($mini) {
$font_size = '1.5';
} else {
$font_size = '3';
$font_size = $config['font_size_item_report'];
}
$table->colspan['module']['cell'] = 3;
@ -2738,10 +2735,12 @@ function reporting_html_min_value(&$table, $item, $mini)
function reporting_html_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
global $config;
if ($mini) {
$font_size = '1.5';
} else {
$font_size = '3';
$font_size = $config['font_size_item_report'];
}
if (isset($item['visual_format']) && $item['visual_format'] != 0
@ -3583,10 +3582,10 @@ function reporting_html_general($table, $item, $pdf=0)
}
$table1->head[3] = __('Value');
$table1->style[0] = 'text-align: left';
$table1->style[1] = 'text-align: left';
$table1->style[2] = 'text-align: left';
$table1->style[3] = 'text-align: left';
$table1->style[0] = 'text-align: center';
$table1->style[1] = 'text-align: center';
$table1->style[2] = 'text-align: center';
$table1->style[3] = 'text-align: center';
// Begin - Order by agent.
foreach ($item['data'] as $key => $row) {
@ -3717,12 +3716,16 @@ function reporting_html_general($table, $item, $pdf=0)
$table_summary->head = [];
$table_summary->head_colspan = [];
$table_summary->align = [];
$table_summary->headstyle = [];
$table_summary->headstyle[0] = 'text-align: center;';
$table_summary->headstyle[1] = 'text-align: center;';
$table_summary->headstyle[2] = 'text-align: center;';
$table_summary->align[0] = 'left';
$table_summary->align[1] = 'right';
$table_summary->align[2] = 'right';
$table_summary->align[3] = 'left';
$table_summary->align[4] = 'right';
$table_summary->align[0] = 'center';
$table_summary->align[1] = 'center';
$table_summary->align[2] = 'center';
$table_summary->align[3] = 'center';
$table_summary->align[4] = 'center';
$table_summary->head_colspan[0] = 2;
$table_summary->head[0] = __('Min Value');
@ -3730,11 +3733,11 @@ function reporting_html_general($table, $item, $pdf=0)
$table_summary->head_colspan[2] = 2;
$table_summary->head[2] = __('Max Value');
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'];
$table_summary->data[0][1] = $item['min']['formated_value'];
$table_summary->data[0][0] = $item['min']['agent'].' - '.$item['min']['module'].str_repeat('&nbsp;', 20).$item['min']['formated_value'];
$table_summary->data[0][1] = '';
$table_summary->data[0][2] = format_for_graph($item['avg_value'], 2);
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'];
$table_summary->data[0][4] = $item['max']['formated_value'];
$table_summary->data[0][3] = $item['max']['agent'].' - '.$item['max']['module'].str_repeat('&nbsp;', 20).$item['max']['formated_value'];
$table_summary->data[0][4] = '';
if ($pdf !== 0) {
$return_pdf .= html_print_table($table_summary, true);

View File

@ -3169,6 +3169,9 @@ function ui_print_datatable(array $parameters)
);
}
// Languages.
$processing = __('Processing');
// Extra html.
$extra = '';
if (isset($parameters['extra_html']) && !empty($parameters['extra_html'])) {
@ -3233,10 +3236,15 @@ function ui_print_datatable(array $parameters)
searching: false,
responsive: true,
dom: "plfrtiBp",
language: {
processing:"'.$processing.'"
},
buttons: [
{
extend: "csv",
text : "'.__('Export current page to CSV').'",
title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'",
fieldSeparator: "'.$config['csv_divider'].'",
exportOptions : {
modifier : {
// DataTables core
@ -3533,6 +3541,8 @@ function ui_print_event_priority(
* @param string $toggle_class Toggle class.
* @param string $container_class Container class.
* @param string $main_class Main object class.
* @param string $img_a Image (closed).
* @param string $img_b Image (opened).
*
* @return string HTML.
*/
@ -3545,20 +3555,22 @@ function ui_toggle(
$return=false,
$toggle_class='',
$container_class='white-box-content',
$main_class='box-shadow white_table_graph'
$main_class='box-shadow white_table_graph',
$img_a='images/arrow_down_green.png',
$img_b='images/arrow_right_green.png'
) {
// Generate unique Id.
$uniqid = uniqid('');
$image_a = html_print_image('images/arrow_down_green.png', true, false, true);
$image_b = html_print_image('images/arrow_right_green.png', true, false, true);
$image_a = html_print_image($img_a, true, false, true);
$image_b = html_print_image($img_b, true, false, true);
// Options.
if ($hidden_default) {
$style = 'display:none';
$original = 'images/arrow_right_green.png';
$original = $img_b;
} else {
$style = '';
$original = 'images/arrow_down_green.png';
$original = $img_a;
}
// Link to toggle.
@ -3611,6 +3623,31 @@ function ui_toggle(
}
/**
* Simplified way of ui_toggle ussage.
*
* @param array $data Arguments.
*
* @return string HTML code with toggle content.
*/
function ui_print_toggle($data)
{
return ui_toggle(
$data['content'],
$data['name'],
(isset($data['title']) === true) ? $data['title'] : '',
(isset($data['id']) === true) ? $data['id'] : '',
(isset($data['hidden_default']) === true) ? $data['hidden_default'] : true,
(isset($data['return']) === true) ? $data['return'] : false,
(isset($data['toggle_class']) === true) ? $data['toggle_class'] : '',
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-shadow white_table_graph',
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png',
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png'
);
}
/**
* Construct and return the URL to be used in order to refresh the current page correctly.
*
@ -5745,3 +5782,23 @@ function ui_print_comments($comments)
return io_safe_output($comentario);
}
/**
* Get complete external pandora url.
*
* @param string $url Url to be parsed.
*
* @return string Full url.
*/
function ui_get_full_external_url(string $url)
{
$url_parsed = parse_url($url);
if ($url_parsed) {
if (!isset($url_parsed['scheme'])) {
$url = 'http://'.$url;
}
}
return $url;
}

View File

@ -77,6 +77,7 @@ Besides the defined module macros, the following macros are available:
<li>_policy_: Name of the policy that the module belongs to (if applies).</li>
<li>_prevdata_: Module previous data before the alert has been triggered.</li>
<li>_rca_: Root cause analysis chain (only for services).</li>
<li>_secondarygroups_: List of all secondary groups of the agent.</li>
<li>_server_ip_: Ip of server assigned to agent. </li>
<li>_server_name_: Name of server assigned to agent. </li>
<li>_target_ip_: IP address for the modules target.</li>

View File

@ -77,6 +77,7 @@ Además de las macros de módulo definidas, las siguientes macros están disponi
<li>_policy_: Nombre de la política a la que pertenece el módulo (si aplica).</li>
<li>_prevdata_: Dato previo antes de disparase la alerta.</li>
<li>_rca_: Cadena de análasis de causa raíz (sólo para servicios).</li>
<li>_secondarygroups_: Lista de todos los grupos secundarios del agente.</li>
<li>_server_ip_: Ip del servidor al que el agente está asignado. </li>
<li>_server_name_: Nombre del servidor al que el agente está asignado. </li>
<li>_target_ip_: Dirección IP del objetivo del módulo.</li>

View File

@ -77,6 +77,7 @@
<li>_policy_ : モジュールが属するポリシー名 (存在する場合)</li>
<li>_prevdata_ : アラートを発報する前のモジュールデータ</li>
<li>_rca_: Root cause analysis chain (only for services).</li>
<li>_secondarygroups_: エージェントのすべてのセカンダリグループのリスト</li>
<li>_server_ip_ : エージェントが割り当てられているサーバ IP。</li>
<li>_server_name_ : エージェントが割り当てられているサーバ名。 </li>
<li>_target_ip_ : モジュールの対象IPアドレス</li>

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,10 @@
text-align: justify;
}
.dataTables_wrapper {
min-height: 150px;
}
.datatables-td-title {
width: 25% !important;
font-weight: bolder;

View File

@ -207,6 +207,7 @@ label {
li > input[type="text"],
li > input[type="email"],
li > input[type="password"],
li > input[type="email"],
.discovery_text_input > input[type="password"],
.discovery_text_input > input[type="text"],
#interval_manual > input[type="text"] {

View File

@ -4,64 +4,55 @@ body {
height: 100%;
}
div#main_pure {
background-color: #fefefe;
text-align: left;
margin-bottom: 0px;
margin-top: 0px;
margin-left: 0px;
margin-right: 0px;
width: 100%;
position: static;
}
div.help_feedback {
position: fixed;
bottom: 0;
background: white;
height: auto;
width: 365px;
padding-left: 10px;
padding-right: 10px;
background-color: #fff;
right: 3em;
}
.btn_sug {
margin-right: 10px;
margin-top: 10px;
margin-left: 10px;
.help_feedback label {
font-weight: normal;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
font-size: 1.2em;
background-repeat: no-repeat;
background-position: 92% 10px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 10px;
border: none;
font-family: "lato", "Open Sans", sans-serif;
cursor: pointer;
padding-right: 30px;
}
.btn_something {
margin-top: 10px;
margin-left: 10px;
.help_feedback * {
font-family: "lato", "courier", sans-serif;
font-size: 8pt;
}
font-weight: normal;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
font-size: 1.2em;
background-repeat: no-repeat;
background-position: 92% 10px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 10px;
border: none;
font-family: "lato", "Open Sans", sans-serif;
cursor: pointer;
padding-right: 30px;
.help_feedback .white_table_graph_header {
background: #82b92e;
color: #fff;
}
.help_feedback .white_table_graph {
margin-bottom: 0;
box-shadow: 0px 5px 6px 2px #888;
}
.help_feedback .white-box-content form {
margin-bottom: 0;
padding: 0;
}
.help_feedback .explain {
margin: 10px auto;
}
.textarea_feedback {
margin-left: 11px;
max-width: 200px;
margin-top: 10px;
font-weight: bolder;
}
.email_feedback {
@ -73,33 +64,14 @@ div.help_feedback {
}
.btn_submit_feed_back {
margin-right: 50px;
margin-top: 5px;
margin-bottom: 10px;
margin: 15px 0 0 0;
}
.btn_sug_not_selected {
font-weight: normal;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
font-size: 1.2em;
background-repeat: no-repeat;
background-position: 92% 10px;
color: #000;
padding-bottom: 10px;
padding-top: 10px;
padding-left: 10px;
border: 1px solid #888;
font-family: "lato", "Open Sans", sans-serif;
.btn {
margin: 0 auto;
cursor: pointer;
margin-right: 20px;
margin-top: 10px;
margin-left: 10px;
background-image: url(../../images/input_tick.png);
padding-right: 30px;
}
.btn_section {
display: flex;
.flex-row-baseline.w100p label {
cursor: pointer;
}

View File

@ -17,10 +17,11 @@
*/
}
#welcome_form ul.wizard li {
#welcome_form ul.wizard > li {
padding: 1em;
padding-bottom: 0;
padding-top: 1em;
padding-bottom: 0.6em;
padding-top: 0.6em;
padding-left: 0.7em;
}
#welcome_form label {
@ -55,8 +56,44 @@
.pending {
background-image: url(../../images/darrowright.png);
background-image: url(../../images/arrow-icon.png);
}
.completed {
background-image: url(../../images/input_tick.png);
background-image: url(../../images/input_tick_badge.png);
}
.centered_full {
padding: 1em;
text-align: center;
}
#welcome_form li.centered_full > label {
width: auto;
}
#welcome_form ul.wizard li.white_box {
padding: 0;
margin-bottom: 2em;
}
#welcome_form ul.wizard li.centered_full {
padding-top: 1em;
padding-bottom: 1em;
}
#welcome_form li:not(.centered_full):not(.white_box) {
border-left: 4px solid #79a930;
}
#welcome_form li:not(.centered_full):not(.white_box).grey {
border-left: 4px solid #d6d6d6;
}
#welcome_form li.hole {
margin-bottom: 0.8em;
}
#welcome_form li.extra {
padding-bottom: 2.5em;
}

View File

@ -5896,6 +5896,12 @@ table.table_modal_alternate tr td:first-child {
width: 100%;
}
/*
* ---------------------------------------------------------------------
* - VISUAL STYLES FOR HISTOGRAM GRAPHS
* ---------------------------------------------------------------------
*/
.slicebar-box-hover-styles {
position: absolute;
background-color: #fff;
@ -5910,3 +5916,65 @@ table.table_modal_alternate tr td:first-child {
.flot-text {
width: 101%;
}
/*Font header feedback*/
form#modal_form_feedback {
padding: 10px;
}
form#modal_form_feedback label {
margin-bottom: 10px;
color: #343434;
font-weight: bold;
font-size: 10pt;
}
form#modal_form_feedback input[type="email"] {
background-color: transparent;
border: none;
border-radius: 0;
border-bottom: 1px solid #ccc;
font-family: "lato-bolder", "Open Sans", sans-serif;
font-weight: lighter;
padding: 0px 0px 2px 0px;
box-sizing: border-box;
margin-bottom: 4px;
}
form#modal_form_feedback ul.wizard li {
padding-bottom: 10px;
padding-top: 10px;
}
form#modal_form_feedback ul.wizard li > label:not(.p-switch) {
width: 250px;
vertical-align: top;
display: inline-block;
}
form#modal_form_feedback ul.wizard li > textarea {
width: 600px;
height: 15em;
display: inline-block;
font-family: monospace;
}
/*
* ---------------------------------------------------------------------
* - FONT SIZES IN AGENT VIEW. This changes the font size of the agent
* name and the description when the language is Japanese or Chinese
* ---------------------------------------------------------------------
*/
.custom_font_size {
font-size: 14px;
font-weight: bold;
}
/* Generic classes to reuse and facilitate the creation of custom themes */
.pandora_green_text {
color: #82b92e;
}
.pandora_green_bg {
background-color: #82b92e;
}

View File

@ -10,7 +10,8 @@ button.submit-cancel {
cursor: pointer;
text-align: center;
height: 30px;
width: 90px;
width: auto;
min-width: 90px;
}
input[type="submit"].submit-cancel:hover,
@ -32,6 +33,8 @@ input[type="button"].submit-next {
cursor: pointer;
text-align: center;
height: 30px;
width: auto;
min-width: 90px;
}
input[type="submit"].submit-next:hover,

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.740';
$build = '191029';
$build = '191113';
$banner = "v$version Build $build";
error_reporting(0);
@ -872,7 +872,16 @@ function install_step4()
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir
$config["homedir"]="'.$path.'"; // Config homedir
// ----------Rebranding--------------------
// Uncomment this lines and add your customs text and paths.
// $config["custom_logo_login_alt"] ="login_logo.png";
// $config["custom_splash_login_alt"] = "splash_image_default.png";
// $config["custom_title1_login_alt"] = "WELCOME TO Pandora FMS";
// $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS";
/*
----------Attention--------------------
Please note that in certain installations:
@ -974,7 +983,15 @@ function install_step4()
$config["dbuser"]="pandora"; // DB User
$config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir
$config["homedir"]="'.$path.'"; // Config homedir
// ----------Rebranding--------------------
// Uncomment this lines and add your customs text and paths.
// $config["custom_logo_login_alt"] ="login_logo.png";
// $config["custom_splash_login_alt"] = "splash_image_default.png";
// $config["custom_title1_login_alt"] = "WELCOME TO Pandora FMS";
// $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS";
/*
----------Attention--------------------
Please note that in certain installations:

View File

@ -155,7 +155,7 @@ if (is_ajax()) {
ob_end_clean();
// Take some parameters (GET)
// Take some parameters (GET).
$group_id = (int) get_parameter('group_id', 0);
$search = trim(get_parameter('search', ''));
$search_custom = trim(get_parameter('search_custom', ''));
@ -172,10 +172,10 @@ $access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR');
$onheader = [];
if (check_acl($config['id_user'], 0, 'AW')) {
// Prepare the tab system to the future
// Prepare the tab system to the future.
$tab = 'setup';
// Setup tab
// Setup tab.
$setuptab['text'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/modificar_agente">'.html_print_image('images/setup.png', true, ['title' => __('Setup')]).'</a>';
$setuptab['godmode'] = true;
@ -193,7 +193,7 @@ if (!$strict_user) {
}
}
// User is deleting agent
// User is deleting agent.
if (isset($result_delete)) {
if ($result_delete) {
ui_print_success_message(__('Sucessfully deleted agent'));
@ -283,7 +283,7 @@ $order = null;
$order_collation = '';
switch ($config['dbtype']) {
case 'mysql':
// $order_collation = " COLLATE utf8_general_ci";
// $order_collation = " COLLATE utf8_general_ci";.
$order_collation = '';
break;
@ -314,6 +314,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -336,6 +340,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -358,6 +366,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -380,6 +392,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -402,6 +418,10 @@ switch ($sortField) {
'order' => 'DESC',
];
break;
default:
// Default.
break;
}
break;
@ -424,6 +444,10 @@ switch ($sortField) {
'order' => 'ASC',
];
break;
default:
// Default.
break;
}
break;
@ -446,6 +470,10 @@ switch ($sortField) {
'order' => 'ASC',
];
break;
default:
// Default.
break;
}
break;
@ -505,7 +533,7 @@ if (!empty($search_custom)) {
$search_sql_custom = '';
}
// Show only selected groups
// Show only selected groups.
if ($group_id > 0) {
$groups = [$group_id];
if ($recursion) {
@ -624,11 +652,13 @@ if (empty($agents)) {
$agents = [];
}
$agent_font_size = 'font-size: 7px';
$description_font_size = 'font-size: 6.5px';
if ($config['language'] == 'ja' || $config['language'] == 'zh_CN' || $own_info['language'] == 'ja' || $own_info['language'] == 'zh_CN') {
$agent_font_size = 'font-size: 15px';
$description_font_size = 'font-size: 11px';
if ($config['language'] == 'ja'
|| $config['language'] == 'zh_CN'
|| $own_info['language'] == 'ja'
|| $own_info['language'] == 'zh_CN'
) {
// Adds a custom font size for Japanese and Chinese language.
$custom_font_size = 'custom_font_size';
}
// Urls to sort the table.
@ -648,7 +678,7 @@ $url_up_last = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;
$url_down_last = 'index.php?sec=view&amp;sec2=operation/agentes/estado_agente&amp;refr='.$refr.'&amp;offset='.$offset.'&amp;group_id='.$group_id.'&amp;recursion='.$recursion.'&amp;search='.$search.'&amp;status='.$status.'&amp;sort_field=last_contact&amp;sort=down';
// Prepare pagination
// Prepare pagination.
ui_pagination(
$total_agents,
ui_get_url_refresh(['group_id' => $group_id, 'recursion' => $recursion, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort, 'status' => $status])
@ -744,10 +774,8 @@ foreach ($agents as $agent) {
$data = [];
$data[0] = '<div class="left_'.$agent['id_agente'].'">';
$data[0] .= '<span>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"> <span style="'.$agent_font_size.';font-weight:bold" title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></a>';
$data[0] .= '</span>';
$data[0] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent['id_agente'].'"><b><span class="'.$custom_font_size.' title ="'.$agent['nombre'].'">'.$agent['alias'].'</span></b></a>';
if ($agent['quiet']) {
$data[0] .= '&nbsp;';
@ -779,7 +807,7 @@ foreach ($agents as $agent) {
$data[0] .= '</div></div>';
$data[1] = ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]', $description_font_size);
$data[1] = '<span class="'.$custom_font_size.'">'.ui_print_truncate_text($agent['description'], 'description', false, true, true, '[&hellip;]').'</span>';
$data[10] = '';

View File

@ -432,7 +432,7 @@ if (!empty($addresses)) {
// $data_opcional = [];
$data_opcional[] = '<b>'.__('Other IP addresses').'</b>';
if (!empty($addresses)) {
$data_opcional[] = '<div style="overflow-y: scroll;">'.implode('<br>', $addresses).'</div>';
$data_opcional[] = '<div style="overflow-y: scroll; max-height:50px;">'.implode('<br>', $addresses).'</div>';
}
}
@ -825,7 +825,15 @@ $table_events = '<div class="white_table_graph" id="table_events">
$agent_contact = html_print_table($table_contact, true);
$agent_info = empty($table_data->data) ? '' : html_print_table($table_data, true);
if (empty($table_data->data)) {
$agent_info = '';
} else {
if (count($table_data->data) === 1 && $config['activate_gis'] && $dataPositionAgent === false) {
$agent_info = '';
} else {
$agent_info = html_print_table($table_data, true);
}
}
$agent_incidents = !isset($table_incident) ? '' : html_print_table($table_incident, true);

View File

@ -1018,7 +1018,7 @@ $adv_inputs[] = $in;
$user_users = users_get_user_users(
$config['id_user'],
$access,
users_can_manage_group_all()
true
);
$data = html_print_select(
@ -1539,7 +1539,7 @@ function process_datatables_callback(table, settings) {
// Agent id.
target = i;
}
if(label == '<?php echo __('Agent name'); ?>') {
if(label == '<?php echo addslashes(__('Agent name')); ?>') {
// Agent id.
target = i;
break;
@ -1619,15 +1619,13 @@ function process_datatables_item(item) {
// Show comments events.
item.user_comment = item.comments
if(item.comments.length > 80){
item.user_comment += '&nbsp;&nbsp;<a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
if(typeof item.comments !== 'undefined' && item.comments.length > 80) {
item.user_comment += '&nbsp;&nbsp;<a id="show_comments" href="javascript:" onclick="show_event_dialog(\'';
item.user_comment += item.b64+"','comments'," + $("#group_rep").val()+');">';
item.user_comment += '<?php echo html_print_image('images/eye.png', true, ['title' => __('Show more')]); ?></a>';
}
// Grouped events.
if(item.max_id_evento) {
item.id_evento = item.max_id_evento

View File

@ -767,7 +767,7 @@ $data[0] = __('User ack.').$jump;
$user_users = users_get_user_users(
$config['id_user'],
$access,
users_can_manage_group_all()
users_can_manage_group_all($access)
);
$data[0] .= html_print_select(

View File

@ -118,7 +118,7 @@ $now = date('Y-m-d');
// Download header.
header('Content-type: text/txt');
header('Content-Disposition: attachment; filename="pandora_export_event'.$now.'.csv"');
header('Content-Disposition: attachment; filename="export_events_'.$now.'.csv"');
try {
$fb64 = get_parameter('fb64', null);

View File

@ -91,10 +91,6 @@ check_login();
$id_report = (int) get_parameter('id');
$filename = (string) get_parameter('filename');
if (empty($filename)) {
$filename = 'pandorafms_report_'.date('Y-m-d_His');
}
$date_mode = get_parameter('date_mode', 'none');
$period = null;
@ -132,6 +128,10 @@ $report = reporting_make_reporting_data(
'static'
);
if (empty($filename)) {
$filename = $report['name'].'_report_'.date('Y-m-d_His');
}
reporting_xml_get_report($report, $filename);
exit;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191029
%define release 191113
# User and Group under which Apache is running
%define httpd_name httpd
@ -57,6 +57,13 @@ install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/l
rm -rf $RPM_BUILD_ROOT
%post
# Install pandora_websocket_engine service.
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
chmod +x /etc/init.d/pandora_websocket_engine
echo "You can now start the Pandora FMS Websocket service by executing"
echo " /etc/init.d/pandora_websocket_engine start"
# Has an install already been done, if so we only want to update the files
# push install.php aside so that the console works immediately using existing
# configuration.

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191029
%define release 191113
# User and Group under which Apache is running
%define httpd_name httpd
@ -57,6 +57,13 @@ install -m 0644 pandora_console_logrotate_centos $RPM_BUILD_ROOT%{_sysconfdir}/l
rm -rf $RPM_BUILD_ROOT
%post
# Install pandora_websocket_engine service.
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
chmod +x /etc/init.d/pandora_websocket_engine
echo "You can now start the Pandora FMS Websocket service by executing"
echo " /etc/init.d/pandora_websocket_engine start"
# Has an install already been done, if so we only want to update the files
# push install.php aside so that the console works immediately using existing
# configuration.

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.740
%define release 191029
%define release 191113
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2
@ -58,6 +58,13 @@ fi
rm -rf $RPM_BUILD_ROOT
%post
# Install pandora_websocket_engine service.
cp -pf %{prefix}/pandora_console/pandora_websocket_engine /etc/init.d/
chmod +x /etc/init.d/pandora_websocket_engine
echo "You can now start the Pandora FMS Websocket service by executing"
echo " /etc/init.d/pandora_websocket_engine start"
# Has an install already been done, if so we only want to update the files
# push install.php aside so that the console works immediately using existing
# configuration.

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.740-191029
Version: 7.0NG.740-191113
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.740-191029"
pandora_version="7.0NG.740-191113"
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.740";
my $pandora_build = "191029";
my $pandora_build = "191113";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -1130,6 +1130,7 @@ sub pandora_execute_action ($$$$$$$$$;$) {
_name_tag_ => undef,
_all_address_ => undef,
'_address_\d+_' => undef,
_secondarygroups_ => undef,
);
if ((defined ($extra_macros)) && (ref($extra_macros) eq "HASH")) {
@ -4118,6 +4119,15 @@ sub on_demand_macro($$$$$$;$) {
}
return(defined($field_value)) ? $field_value : '';
} elsif ($macro eq '_secondarygroups_') {
my $field_value = '';
my @groups = get_db_rows ($dbh, 'SELECT tg.nombre from tagent_secondary_group as tsg INNER JOIN tgrupo tg ON tsg.id_group = tg.id_grupo WHERE tsg.id_agent = ?', $module->{'id_agente'});
foreach my $element (@groups) {
$field_value .= $element->{'nombre'} .",";
}
chop($field_value);
return(defined($field_value)) ? '('.$field_value.')' : '';
}
}

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.740";
my $pandora_build = "191029";
my $pandora_build = "191113";
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.740
%define release 191029
%define release 191113
Summary: Pandora FMS Server
Name: %{name}

View File

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

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.740"
PI_BUILD="191029"
PI_BUILD="191113"
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.740 PS191029";
my $version = "7.0NG.740 PS191113";
# 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.740 PS191029";
my $version = "7.0NG.740 PS191113";
# save program name for logging
my $progname = basename($0);
@ -118,12 +118,22 @@ sub help_screen{
help_screen_line('--get_planned_downtimes_items', '<name> [<id_group> <type_downtime> <type_execution> <type_periodicity>]', 'Get all items of planned downtimes');
help_screen_line('--set_planned_downtimes_deleted', '<name> ', 'Deleted a planned downtime');
help_screen_line('--get_module_id', '<agent_id> <module_name>', 'Get the id of an module');
<<<<<<< HEAD
help_screen_line('--get_agent_group', '<agent_name>', 'Get the group name of an agent');
help_screen_line('--get_agent_group_id', '<agent_name>', 'Get the group ID of an agent');
help_screen_line('--get_agent_modules', '<agent_name>', 'Get the modules of an agent');
help_screen_line('--get_agents_id_name_by_alias', '<agent_alias>', '[<strict>]', 'List id and alias of agents mathing given alias');
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name>]', "Get \n\t list of agents with optative filter parameters");
help_screen_line('--delete_conf_file', '<agent_name>', 'Delete a local conf of a given agent');
help_screen_line('--clean_conf_file', '<agent_name>', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
=======
help_screen_line('--get_agent_group', '<agent_name> [<use_alias>]', 'Get the group name of an agent');
help_screen_line('--get_agent_group_id', '<agent_name> [<use_alias>]', 'Get the group ID of an agent');
help_screen_line('--get_agent_modules', '<agent_name> [<use_alias>]', 'Get the modules of an agent');
help_screen_line('--get_agents', '[<group_name> <os_name> <status> <max_modules> <filter_substring> <policy_name> <use_alias>]', "Get \n\t list of agents with optative filter parameters");
help_screen_line('--delete_conf_file', '<agent_name> [<use_alias>]', 'Delete a local conf of a given agent');
help_screen_line('--clean_conf_file', '<agent_name> [<use_alias>]', "Clean a local conf of a given agent deleting all modules, \n\t policies, file collections and comments");
>>>>>>> origin/develop
help_screen_line('--get_bad_conf_files', '', 'Get the files bad configured (without essential tokens)');
help_screen_line('--locate_agent', '<agent_name> [<use_alias>]', 'Search a agent into of nodes of metaconsole. Only Enterprise.');
help_screen_line('--migration_agent_queue', '<id_node> <source_node_name> <target_node_name> [<db_only>]', 'Migrate agent only metaconsole');
@ -4849,6 +4859,49 @@ sub cli_get_agent_modules() {
}
}
##############################################################################
# Show id, name and id_server of an agent given alias
# Related option: --get_agents_id_name_by_alias
##############################################################################
sub cli_get_agents_id_name_by_alias() {
my $agent_alias = @ARGV[2];
my $strict = @ARGV[3];
my @agents;
my $where_value;
if($strict eq 'strict') {
$where_value = $agent_alias;
} else {
$where_value = "%".$agent_alias."%";
}
if(is_metaconsole($conf) == 1) {
@agents = get_db_rows($dbh,"SELECT alias, id_agente, id_tagente, id_tmetaconsole_setup as 'id_server', server_name FROM tmetaconsole_agent WHERE UPPER(alias) LIKE UPPER(?)", $where_value);
} else {
@agents = get_db_rows($dbh,"SELECT alias, id_agente FROM tagente WHERE UPPER(alias) LIKE UPPER(?)", $where_value);
}
if(scalar(@agents) == 0) {
print "[ERROR] No agents retrieved.\n\n";
} else {
if(is_metaconsole($conf) == 1) {
print "alias, id_agente, id_tagente, id_server, server_name\n";
foreach my $agent (@agents) {
print safe_output($agent->{'alias'}).", ".$agent->{'id_agente'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n";
}
} else {
print "alias, id_agente\n";
foreach my $agent (@agents) {
print $agent->{'id_agente'}.",".safe_output($agent->{'alias'})."\n";
}
}
}
}
sub cli_create_synthetic() {
my $name_module = @ARGV[2];
my $synthetic_type = @ARGV[3];
@ -7426,6 +7479,10 @@ sub pandora_manage_main ($$$) {
param_check($ltotal, 2, 1);
cli_get_agent_modules();
}
elsif ($param eq '--get_agents_id_name_by_alias') {
param_check($ltotal, 2,1);
cli_get_agents_id_name_by_alias();
}
elsif ($param eq '--get_policy_modules') {
param_check($ltotal, 1);
cli_get_policy_modules();