Merge remote-tracking branch 'origin/develop' into ent-3178-integrar-terminal-web-en-la-consola-de-pandora-y-explorar-otras-utilidades-anyterm-replace

Conflicts:
	pandora_console/pandoradb_data.sql
This commit is contained in:
fbsanchez 2019-11-05 11:16:26 +01:00
commit b1d4bfe149
48 changed files with 307 additions and 353 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.740 Version: 7.0NG.740-191029
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{191028} {191029}
ViewReadme ViewReadme
{Yes} {Yes}
@ -2387,7 +2387,7 @@ Windows,BuildSeparateArchives
{No} {No}
Windows,Executable Windows,Executable
{<%AppName%>-Setup<%Ext%>} {<%AppName%>-<%Version%>-Setup<%Ext%>}
Windows,FileDescription Windows,FileDescription
{<%AppName%> <%Version%> Setup} {<%AppName%> <%Version%> Setup}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.740(Build 191028)") #define PANDORA_VERSION ("7.0NG.740(Build 191029)")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST" VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.740(Build 191028))" VALUE "ProductVersion", "(7.0NG.740(Build 191029))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.740 Version: 7.0NG.740-191029
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -238,19 +238,6 @@ function output_xml_report($id)
echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>'; echo '<line_separator><![CDATA['.io_safe_output($item['line_separator']).']]></line_separator>';
echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>'; echo '<column_separator><![CDATA['.io_safe_output($item['header_definition']).']]></column_separator>';
break; break;
/*
case 'TTRT':
break;
case 'TTO':
break;
case 'MTBF':
break;
case 'MTTR':
break;*/
} }
echo "</item>\n"; echo "</item>\n";

View File

@ -375,19 +375,6 @@ function process_upload_xml_report($xml, $group_filter=0)
$values['line_separator'] = io_safe_input($item['line_separator']); $values['line_separator'] = io_safe_input($item['line_separator']);
$values['column_separator'] = io_safe_input($item['column_separator']); $values['column_separator'] = io_safe_input($item['column_separator']);
break; break;
/*
case 'TTRT':
break;
case 'TTO':
break;
case 'MTBF':
break;
case 'MTTR':
break;*/
} }
if (empty($agents_item)) { if (empty($agents_item)) {

View File

@ -0,0 +1,66 @@
<?php
// Pandora FMS - http://pandorafms.com
// ==================================================
// Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
// Please see http://pandorafms.org for full contribution list
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; version 2
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
require_once __DIR__.'/../include/config.php';
require_once __DIR__.'/../include/auth/mysql.php';
require_once __DIR__.'/../include/functions.php';
require_once __DIR__.'/../include/functions_db.php';
/*
* Review if sample agent is active and deploys configuration for
* visual consoles if necessary
*/
global $config;
// Deployment of sample agent for visual consoles.
if ($config['sample_agent'] == 1 && !isset($config['sample_agent_deployed'])) {
$id_agente = db_get_sql('SELECT id_agente FROM tagente WHERE nombre = "Sample_Agent";');
$modules = db_get_all_rows_filter('tagente_modulo', ['id_agente' => $id_agente], 'id_agente_modulo');
$count_modules = count($modules);
// Update of layout 1 (Rack sample).
$images_rack_server = [
'rack_server_rack',
'rack_server',
'rack_switch',
'rack_firewall',
'rack_double_server',
'rack_frame',
'rack_pdu',
];
$query = 'UPDATE `tlayout_data` SET `id_agent` = '.$id_agente.', `id_agente_modulo` = CASE ';
for ($i = 0; $i < $count_modules; $i++) {
$query .= 'WHEN `image` = "'.$images_rack_server[$i].'" THEN '.$modules[$i]['id_agente_modulo'].' ';
}
$query .= 'END WHERE `id_layout` = 1 AND `image` IN ("'.implode('","', $images_rack_server).'");';
db_process_sql($query);
// Update of layout 2 (Dashboard).
$query = 'UPDATE `tlayout_data` SET `id_agent`= '.$id_agente.', `id_agente_modulo` = CASE ';
$query .= 'WHEN `id` = 107 THEN '.$modules[0]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 108 THEN '.$modules[1]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 109 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 110 THEN '.$modules[2]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 111 THEN '.$modules[3]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 112 THEN '.$modules[4]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 113 THEN '.$modules[5]['id_agente_modulo'].' ';
$query .= 'WHEN `id` = 114 THEN '.$modules[6]['id_agente_modulo'].' ';
$query .= 'END WHERE `id_layout` = 2 AND `id` IN (107,108,109,110,111,112,113,114);';
db_process_sql($query);
// This setting will avoid regenerate all the times the visual consoles.
config_update_value('sample_agent_deployed', 1);
}
extensions_add_main_function('sample_agent_deployment');

View File

@ -0,0 +1,5 @@
START TRANSACTION;
ALTER TABLE `tlayout_template_data` ADD COLUMN `cache_expiration` INTEGER UNSIGNED NOT NULL DEFAULT 0;
COMMIT;

View File

@ -1907,6 +1907,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0, `linked_layout_status_as_service_warning` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0, `linked_layout_status_as_service_critical` FLOAT(20, 3) NOT NULL default 0,
`linked_layout_node_id` INT(10) NOT NULL default 0, `linked_layout_node_id` INT(10) NOT NULL default 0,
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -33,7 +33,7 @@ ui_require_css_file('firts_task');
); );
?> ?>
</p> </p>
<form action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" method="post"> <form action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" method="post">
<input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" /> <input type="submit" class="button_task" value="<?php echo __('Create Planned Downtime'); ?>" />
</form> </form>
</div> </div>

View File

@ -827,7 +827,7 @@ $table->data[5][1] = "
</table> </table>
</div>'; </div>';
echo '<form method="POST" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor">'; echo '<form method="POST" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor">';
if ($id_downtime > 0) { if ($id_downtime > 0) {
echo '<table width=100% border=0 cellpadding=4 >'; echo '<table width=100% border=0 cellpadding=4 >';
@ -929,7 +929,7 @@ if ($id_downtime > 0) {
$disabled_add_button = true; $disabled_add_button = true;
} }
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>"; echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&id_downtime=$id_downtime'>";
html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;'); html_print_select_groups(false, $access, true, 'filter_group', $filter_group, '', '', '', false, false, true, '', false, 'min-width:180px;margin-right:15px;');
html_print_checkbox('recursion', 1, $recursion, false, false, ''); html_print_checkbox('recursion', 1, $recursion, false, false, '');
@ -939,7 +939,7 @@ if ($id_downtime > 0) {
echo '</form>'; echo '</form>';
// Show available agents to include into downtime // Show available agents to include into downtime
echo '<h4>'.__('Available agents').':</h4>'; echo '<h4>'.__('Available agents').':</h4>';
echo "<form method=post action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>"; echo "<form method=post action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&insert_downtime_agent=1&id_downtime=$id_downtime'>";
echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;'); echo html_print_select($agents, 'id_agents[]', -1, '', _('Any'), -2, false, true, true, '', false, 'width: 180px;');
@ -1085,7 +1085,7 @@ if ($id_downtime > 0) {
$data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; $data[5] = '<a href="javascript:show_editor_module('.$downtime_agent['id_agente'].');">'.html_print_image('images/config.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
} }
$data[5] .= '<a href="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>'; $data[5] .= '<a href="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor&id_agent='.$downtime_agent['id_agente'].'&delete_downtime_agent=1&id_downtime_agent='.$downtime_agent['id'].'&id_downtime='.$id_downtime.'">'.html_print_image('images/cross.png', true, ['border' => '0', 'alt' => __('Delete')]).'</a>';
} }
$table->data['agent_'.$downtime_agent['id_agente']] = $data; $table->data['agent_'.$downtime_agent['id_agente']] = $data;

View File

@ -357,7 +357,7 @@ if (!$downtimes && !$filter_performed) {
// No downtimes cause the user performed a search. // No downtimes cause the user performed a search.
else if (!$downtimes) { else if (!$downtimes) {
// Filter form. // Filter form.
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>"; echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
html_print_table($table_form); html_print_table($table_form);
echo '</form>'; echo '</form>';
@ -369,7 +369,7 @@ else if (!$downtimes) {
// Create button. // Create button.
if ($write_permisson) { if ($write_permisson) {
echo '&nbsp;'; echo '&nbsp;';
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">'; echo '<form method="post" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '</form>'; echo '</form>';
} }
@ -378,11 +378,11 @@ else if (!$downtimes) {
} }
// Has downtimes. // Has downtimes.
else { else {
echo "<form method='post' action='index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list'>"; echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
html_print_table($table_form); html_print_table($table_form);
echo '</form>'; echo '</form>';
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset); ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
// User groups with AR, AD or AW permission. // User groups with AR, AD or AW permission.
$groupsAD = users_get_groups($config['id_user'], $access); $groupsAD = users_get_groups($config['id_user'], $access);
@ -476,7 +476,7 @@ else {
if (in_array($downtime['id_group'], $groupsAD)) { if (in_array($downtime['id_group'], $groupsAD)) {
// Stop button // Stop button
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) { if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
$data['stop'] = '<a href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]); $data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
} else { } else {
$data['stop'] = ''; $data['stop'] = '';
} }
@ -484,12 +484,12 @@ else {
// Edit & delete buttons. // Edit & delete buttons.
if ($downtime['executed'] == 0) { if ($downtime['executed'] == 0) {
// Edit. // Edit.
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>'; $data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete. // Delete.
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]); $data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete')]);
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') { } else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
// Edit. // Edit.
$data['edit'] = '<a href="index.php?sec=estado&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>'; $data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update')]).'</a>';
// Delete. // Delete.
$data['delete'] = __('N/A'); $data['delete'] = __('N/A');
} else { } else {
@ -515,7 +515,7 @@ else {
} }
html_print_table($table); html_print_table($table);
ui_pagination($downtimes_number, "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom'); ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
echo '<div class="action-buttons" style="width: '.$table->width.'">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
// CSV export button. // CSV export button.
@ -532,7 +532,7 @@ else {
// Create button. // Create button.
if ($write_permisson) { if ($write_permisson) {
echo '&nbsp;'; echo '&nbsp;';
echo '<form method="post" action="index.php?sec=estado&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">'; echo '<form method="post" action="index.php?sec=extensions&amp;sec2=godmode/agentes/planned_downtime.editor" style="display: inline;">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"'); html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
echo '</form>'; echo '</form>';
} }
@ -559,7 +559,7 @@ $(document).ready (function () {
if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) { if (<?php echo json_encode($malformed_downtimes_exist); ?> && <?php echo json_encode($migrate_malformed == false); ?>) {
if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) { if (confirm("<?php echo __('WARNING: There are malformed planned downtimes').'.\n'.__('Do you want to migrate automatically the malformed items?'); ?>")) {
window.location.href = "index.php?sec=estado&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1"; window.location.href = "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&migrate_malformed=1";
} }
} }
}); });

View File

@ -482,51 +482,6 @@ switch ($action) {
$period = $item['period']; $period = $item['period'];
break; break;
/*
case 'TTRT':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
case 'TTO':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
case 'MTBF':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
case 'MTTR':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter(
'id_agente',
'tagente_modulo',
['id_agente_modulo' => $idAgentModule]
);
$period = $item['period'];
break;
*/
case 'alert_report_module': case 'alert_report_module':
$description = $item['description']; $description = $item['description'];
$idAgentModule = $item['id_agent_module']; $idAgentModule = $item['id_agent_module'];
@ -791,11 +746,6 @@ switch ($action) {
case 'avg_value': case 'avg_value':
case 'projection_graph': case 'projection_graph':
case 'prediction_date': case 'prediction_date':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'event_report_log': case 'event_report_log':
case 'increment': case 'increment':
@ -3757,10 +3707,6 @@ $(document).ready (function () {
case 'event_report_module': case 'event_report_module':
case 'simple_graph': case 'simple_graph':
case 'simple_baseline_graph': case 'simple_baseline_graph':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'prediction_date': case 'prediction_date':
case 'projection_graph': case 'projection_graph':
case 'avg_value': case 'avg_value':
@ -3798,10 +3744,6 @@ $(document).ready (function () {
case 'event_report_module': case 'event_report_module':
case 'simple_graph': case 'simple_graph':
case 'simple_baseline_graph': case 'simple_baseline_graph':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'prediction_date': case 'prediction_date':
case 'projection_graph': case 'projection_graph':
case 'avg_value': case 'avg_value':
@ -4833,38 +4775,6 @@ function chooseType() {
$("#row_period").show(); $("#row_period").show();
$("#row_historical_db_check").hide(); $("#row_historical_db_check").hide();
break; break;
/*
case 'TTRT':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
break;
case 'TTO':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
break;
case 'MTBF':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
break;
case 'MTTR':
$("#row_description").show();
$("#row_agent").show();
$("#row_module").show();
$("#row_period").show();
$("#row_historical_db_check").hide();
break;*/
case 'alert_report_module': case 'alert_report_module':
$("#row_description").show(); $("#row_description").show();
@ -5218,10 +5128,6 @@ function chooseType() {
case 'min_value': case 'min_value':
case 'max_value': case 'max_value':
case 'avg_value': case 'avg_value':
/* case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph': case 'simple_baseline_graph':
$("#row_label").show(); $("#row_label").show();
break; break;

View File

@ -2006,11 +2006,6 @@ switch ($action) {
case 'avg_value': case 'avg_value':
case 'projection_graph': case 'projection_graph':
case 'prediction_date': case 'prediction_date':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n': case 'nt_top_n':
if ($label != '') { if ($label != '') {
@ -2613,11 +2608,6 @@ switch ($action) {
case 'avg_value': case 'avg_value':
case 'projection_graph': case 'projection_graph':
case 'prediction_date': case 'prediction_date':
/*
case 'TTRT':
case 'TTO':
case 'MTBF':
case 'MTTR':*/
case 'simple_baseline_graph': case 'simple_baseline_graph':
case 'nt_top_n': case 'nt_top_n':
if ($label != '') { if ($label != '') {

View File

@ -2642,8 +2642,17 @@ class NetworkMap
*/ */
public function loadMapData() public function loadMapData()
{ {
global $config;
$networkmap = $this->map; $networkmap = $this->map;
// ACL.
$networkmap_write = check_acl(
$config['id_user'],
$networkmap['id_group'],
'MW'
);
$simulate = false; $simulate = false;
if (isset($networkmap['__simulated']) === false) { if (isset($networkmap['__simulated']) === false) {
$networkmap['filter'] = json_decode( $networkmap['filter'] = json_decode(
@ -2711,6 +2720,7 @@ class NetworkMap
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n"; $output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n"; $output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\n";
$output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n"; $output .= 'var enterprise_installed = '.((int) enterprise_installed()).";\n";
$output .= 'var networkmap_write = '.$networkmap_write.";\n";
$output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n"; $output .= 'var node_radius = '.$networkmap['filter']['node_radius'].";\n";
$output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n"; $output .= 'var networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
$output .= "var networkmap = {'nodes': [], 'links': []};\n"; $output .= "var networkmap = {'nodes': [], 'links': []};\n";

View File

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

View File

@ -506,43 +506,6 @@ function reporting_make_reporting_data(
); );
break; break;
/*
case 'MTTR':
$report['contents'][] = reporting_value(
$report,
$content,
'MTTR',
$pdf
);
break;
case 'MTBF':
$report['contents'][] = reporting_value(
$report,
$content,
'MTBF',
$pdf
);
break;
case 'TTO':
$report['contents'][] = reporting_value(
$report,
$content,
'TTO',
$pdf
);
break;
case 'TTRT':
$report['contents'][] = reporting_value(
$report,
$content,
'TTRT',
$pdf
);
break;
*/
case 'agent_configuration': case 'agent_configuration':
$report['contents'][] = io_safe_output( $report['contents'][] = io_safe_output(
reporting_agent_configuration( reporting_agent_configuration(
@ -3276,6 +3239,7 @@ function reporting_database_serialized($report, $content)
} }
$return['keys'] = $keys; $return['keys'] = $keys;
$return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name'] = $agent_alias; $return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
@ -4303,6 +4267,7 @@ function reporting_monitor_report($report, $content)
); );
} }
$return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name'] = $agent_alias; $return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
@ -4475,6 +4440,7 @@ function reporting_prediction_date($report, $content)
$agent_name = io_safe_output( $agent_name = io_safe_output(
modules_get_agentmodule_agent_alias($content['id_agent_module']) modules_get_agentmodule_agent_alias($content['id_agent_module'])
); );
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
$return['title'] = $content['name']; $return['title'] = $content['name'];
$return['subtitle'] = $agent_name.' - '.$module_name; $return['subtitle'] = $agent_name.' - '.$module_name;
@ -4482,6 +4448,7 @@ function reporting_prediction_date($report, $content)
$return['date'] = reporting_get_date_text($report, $content); $return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name; $return['agent_name'] = $agent_name;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
@ -4526,12 +4493,14 @@ function reporting_projection_graph(
$module_name = io_safe_output(modules_get_agentmodule_name($content['id_agent_module'])); $module_name = io_safe_output(modules_get_agentmodule_name($content['id_agent_module']));
$agent_name = io_safe_output(modules_get_agentmodule_agent_alias($content['id_agent_module'])); $agent_name = io_safe_output(modules_get_agentmodule_agent_alias($content['id_agent_module']));
$agent_name_db = io_safe_output(modules_get_agentmodule_agent_name($content['id_agent_module']));
$return['title'] = $content['name']; $return['title'] = $content['name'];
$return['subtitle'] = $agent_name.' - '.$module_name; $return['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description']; $return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content); $return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : ''; $return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name; $return['agent_name'] = $agent_name;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
@ -4727,23 +4696,6 @@ function reporting_value($report, $content, $type, $pdf=false)
case 'sum': case 'sum':
$return['type'] = 'sumatory'; $return['type'] = 'sumatory';
break; break;
/*
case 'MTTR':
$return['type'] = 'MTTR';
break;
case 'MTBF':
$return['type'] = 'MTBF';
break;
case 'TTO':
$return['type'] = 'TTO';
break;
case 'TTRT':
$return['type'] = 'TTRT';
break;*/
} }
if (empty($content['name'])) { if (empty($content['name'])) {
@ -4763,23 +4715,6 @@ function reporting_value($report, $content, $type, $pdf=false)
case 'sum': case 'sum':
$content['name'] = __('Summatory'); $content['name'] = __('Summatory');
break; break;
/*
case 'MTTR':
$content['name'] = __('MTTR');
break;
case 'MTBF':
$content['name'] = __('MTBF');
break;
case 'TTO':
$content['name'] = __('TTO');
break;
case 'TTRT':
$content['name'] = __('TTRT');
break;*/
} }
} }
@ -4796,6 +4731,9 @@ function reporting_value($report, $content, $type, $pdf=false)
$agent_name = io_safe_output( $agent_name = io_safe_output(
modules_get_agentmodule_agent_alias($content['id_agent_module']) modules_get_agentmodule_agent_alias($content['id_agent_module'])
); );
$agent_name_db = io_safe_output(
modules_get_agentmodule_agent_name($content['id_agent_module'])
);
$unit = db_get_value( $unit = db_get_value(
'unit', 'unit',
'tagente_modulo', 'tagente_modulo',
@ -4812,6 +4750,7 @@ function reporting_value($report, $content, $type, $pdf=false)
$return['id_agent'] = $content['id_agent']; $return['id_agent'] = $content['id_agent'];
$return['id_agent_module'] = $content['id_agent_module']; $return['id_agent_module'] = $content['id_agent_module'];
$return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name; $return['agent_name'] = $agent_name;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
@ -4952,51 +4891,6 @@ function reporting_value($report, $content, $type, $pdf=false)
$formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit; $formated_value = format_for_graph($value, $config['graph_precision']).' '.$unit;
} }
break; break;
/*
case 'MTTR':
$value = reporting_get_agentmodule_mttr(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
$formated_value = null;
break;
case 'MTBF':
$value = reporting_get_agentmodule_mtbf(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
$formated_value = null;
break;
case 'TTO':
$value = reporting_get_agentmodule_tto(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
if ($value == 0) {
$formated_value = null;
} else {
$formated_value = human_time_description_raw($value);
}
break;
case 'TTRT':
$value = reporting_get_agentmodule_ttr(
$content['id_agent_module'],
$content['period'],
$report['datetime']
);
if ($value == 0) {
$formated_value = null;
} else {
$formated_value = human_time_description_raw($value);
}
break;*/
} }
$return['data'] = [ $return['data'] = [
@ -7755,6 +7649,7 @@ function reporting_simple_graph(
$return['title'] = $content['name']; $return['title'] = $content['name'];
$return['subtitle'] = $agent_alias.' - '.$module_name; $return['subtitle'] = $agent_alias.' - '.$module_name;
$return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name'] = $agent_alias; $return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
$return['description'] = $content['description']; $return['description'] = $content['description'];

View File

@ -288,23 +288,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_sum_value($table, $item, $mini); reporting_html_sum_value($table, $item, $mini);
break; break;
/*
case 'MTTR':
reporting_html_MTTR_value($table, $item, $mini, true, true);
break;
case 'MTBF':
reporting_html_MTBF_value($table, $item, $mini, true, true);
break;
case 'TTO':
reporting_html_TTO_value($table, $item, $mini, false, true);
break;
case 'TTRT':
reporting_html_TTRT_value($table, $item, $mini, false, true);
break;
*/
case 'agent_configuration': case 'agent_configuration':
reporting_html_agent_configuration($table, $item); reporting_html_agent_configuration($table, $item);
break; break;
@ -2729,31 +2712,6 @@ function reporting_html_agent_configuration(
} }
/*
function reporting_html_TTRT_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
function reporting_html_TTO_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
function reporting_html_MTBF_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
function reporting_html_MTTR_value(&$table, $item, $mini, $only_value=false, $check_empty=false)
{
reporting_html_value($table, $item, $mini, $only_value, $check_empty);
}
*/
function reporting_html_sum_value(&$table, $item, $mini) function reporting_html_sum_value(&$table, $item, $mini)
{ {
reporting_html_value($table, $item, $mini); reporting_html_value($table, $item, $mini);

View File

@ -679,24 +679,6 @@ function reports_get_report_types($template=false, $not_editor=false)
'name' => __('Module Histogram graph'), 'name' => __('Module Histogram graph'),
]; ];
/*
$types['TTRT'] = [
'optgroup' => __('ITIL'),
'name' => __('TTRT'),
];
$types['TTO'] = [
'optgroup' => __('ITIL'),
'name' => __('TTO'),
];
$types['MTBF'] = [
'optgroup' => __('ITIL'),
'name' => __('MTBF'),
];
$types['MTTR'] = [
'optgroup' => __('ITIL'),
'name' => __('MTTR'),
];
*/
$types['SLA'] = [ $types['SLA'] = [
'optgroup' => __('SLA'), 'optgroup' => __('SLA'),
'name' => __('S.L.A.'), 'name' => __('S.L.A.'),

View File

@ -14,6 +14,7 @@
/* global holding_area_dimensions */ /* global holding_area_dimensions */
/* global networkmap_id */ /* global networkmap_id */
/* global enterprise_installed */ /* global enterprise_installed */
/* global networkmap_write */
/* global force */ /* global force */
/* global layer_graph_nodes */ /* global layer_graph_nodes */
/* global layer_graph_links */ /* global layer_graph_links */
@ -2087,7 +2088,12 @@ function show_menu(item, data) {
icon: "add_node", icon: "add_node",
disabled: function() { disabled: function() {
if (enterprise_installed) { if (enterprise_installed) {
return false; // Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
} else { } else {
return true; return true;
} }
@ -2099,6 +2105,14 @@ function show_menu(item, data) {
items_list["center"] = { items_list["center"] = {
name: set_center_menu, name: set_center_menu,
icon: "center", icon: "center",
disabled: function() {
// Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
},
callback: function(key, options) { callback: function(key, options) {
set_center(networkmap_id); set_center(networkmap_id);
} }
@ -2136,7 +2150,12 @@ function show_menu(item, data) {
icon: "restart_map", icon: "restart_map",
disabled: function() { disabled: function() {
if (enterprise_installed) { if (enterprise_installed) {
return false; // Check if user can write network maps.
if (networkmap_write) {
return false;
} else {
return true;
}
} else { } else {
return true; return true;
} }

View File

@ -129,7 +129,7 @@
<div style='height: 10px'> <div style='height: 10px'>
<?php <?php
$version = '7.0NG.740'; $version = '7.0NG.740';
$build = '191028'; $build = '191029';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

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

View File

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

View File

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

View File

@ -3522,6 +3522,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`time_format` varchar(60) NOT NULL default "time", `time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid", `timezone` varchar(60) NOT NULL default "Europe/Madrid",
`show_last_value` tinyint(1) UNSIGNED NULL default '0', `show_last_value` tinyint(1) UNSIGNED NULL default '0',
`cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8; ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

View File

@ -139,6 +139,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('cr_incident_status', ''), ('cr_incident_status', ''),
('cr_incident_title', ''), ('cr_incident_title', ''),
('cr_incident_content', ''), ('cr_incident_content', ''),
('sample_agent', '0'),
('gotty', '/usr/bin/gotty'); ('gotty', '/usr/bin/gotty');
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.740 Version: 7.0NG.740-191029
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -348,6 +348,15 @@ self_monitoring 1
# Self monitoring interval (in seconds). # Self monitoring interval (in seconds).
self_monitoring_interval 300 self_monitoring_interval 300
# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent
# will make sample data. Disabled by default.
sample_agent 0
# Pandora Sample Agent interval (in seconds).
sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
#update_parent 1 #update_parent 1

View File

@ -340,6 +340,15 @@ restart_delay 60
self_monitoring 1 self_monitoring 1
# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent
# will make sample data. Disabled by default.
sample_agent 0
# Pandora Sample Agent interval (in seconds).
sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
#update_parent 1 #update_parent 1

View File

@ -382,6 +382,16 @@ sub pandora_server_tasks ($) {
pandora_self_monitoring ($pa_config, $dbh); pandora_self_monitoring ($pa_config, $dbh);
} }
# Pandora sample agent
if (defined($pa_config->{'sample_agent'})) {
if ($pa_config->{'sample_agent'} == 1
&& !is_metaconsole($pa_config)
&& $counter % $pa_config->{'sample_agent_interval'} == 0){
pandora_sample_agent ($pa_config);
}
pandora_update_config_token ($dbh, 'sample_agent', $pa_config->{'sample_agent'});
}
# Avoid counter overflow # Avoid counter overflow
if ($counter >= ~0){ if ($counter >= ~0){
$counter = 0; $counter = 0;

View File

@ -376,6 +376,15 @@ self_monitoring 1
# Self monitoring interval (in seconds). # Self monitoring interval (in seconds).
self_monitoring_interval 300 self_monitoring_interval 300
# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent
# will make sample data. Disabled by default.
sample_agent 0
# Pandora Sample Agent interval (in seconds).
sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
#update_parent 1 #update_parent 1

View File

@ -330,6 +330,15 @@ restart_delay 60
# Self monitoring interval (in seconds). # Self monitoring interval (in seconds).
#self_monitoring_interval 300 #self_monitoring_interval 300
# Pandora Sample Agent. If enabled, every 10 minutes, this embedded agent
# will make sample data. Disabled by default.
sample_agent 0
# Pandora Sample Agent interval (in seconds).
sample_agent_interval 600
# Update parent from the agent xml # Update parent from the agent xml
#update_parent 1 #update_parent 1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.740"; my $pandora_version = "7.0NG.740";
my $pandora_build = "191028"; my $pandora_build = "191029";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash
@ -79,7 +79,7 @@ sub help_screen {
sub pandora_init { sub pandora_init {
my $pa_config = $_[0]; my $pa_config = $_[0];
my $init_string = $_[1]; my $init_string = $_[1];
print "\n$init_string $pandora_version Build $pandora_build Copyright (c) 2004-2018 " . pandora_get_initial_copyright_notice() . "\n"; print "\n$init_string $pandora_version Build $pandora_build Copyright (c) 2004-20".substr($pandora_build,0,2)." " . pandora_get_initial_copyright_notice() . "\n";
print "This program is OpenSource, licensed under the terms of GPL License version 2.\n"; print "This program is OpenSource, licensed under the terms of GPL License version 2.\n";
print "You can download latest versions and documentation at official web page.\n\n"; print "You can download latest versions and documentation at official web page.\n\n";
@ -397,6 +397,12 @@ sub pandora_load_config {
# Self monitoring interval # Self monitoring interval
$pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1 $pa_config->{'self_monitoring_interval'} = 300; # 5.1SP1
# Sample Agent
$pa_config->{'sample_agent'} = 0;
# Sample agent interval
$pa_config->{'sample_agent_interval'} = 600;
# Process XML data files as a stack # Process XML data files as a stack
$pa_config->{"dataserver_lifo"} = 0; # 5.0 $pa_config->{"dataserver_lifo"} = 0; # 5.0
@ -946,6 +952,12 @@ sub pandora_load_config {
elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) { elsif ($parametro =~ m/^self_monitoring_interval\s+([0-9]*)/i) {
$pa_config->{'self_monitoring_interval'} = clean_blank($1); $pa_config->{'self_monitoring_interval'} = clean_blank($1);
} }
elsif ($parametro =~ m/^sample_agent\s+([0-1])/i) {
$pa_config->{'sample_agent'} = clean_blank($1);
}
elsif ($parametro =~ m/^sample_agent_interval\s+([0-9]*)/i) {
$pa_config->{'sample_agent_interval'} = clean_blank($1);
}
elsif ($parametro =~ m/^update_parent\s+([0-1])/i) { elsif ($parametro =~ m/^update_parent\s+([0-1])/i) {
$pa_config->{'update_parent'} = clean_blank($1); $pa_config->{'update_parent'} = clean_blank($1);
} }

View File

@ -100,6 +100,8 @@ Exported Functions:
=item * C<pandora_self_monitoring> =item * C<pandora_self_monitoring>
=item * C<pandora_sample_agent>
=back =back
=head1 METHODS =head1 METHODS
@ -122,6 +124,7 @@ use threads::shared;
use JSON qw(decode_json encode_json); use JSON qw(decode_json encode_json);
use MIME::Base64; use MIME::Base64;
use Text::ParseWords; use Text::ParseWords;
use Math::Trig; # Math functions
# Debugging # Debugging
#use Data::Dumper; #use Data::Dumper;
@ -247,6 +250,7 @@ our @EXPORT = qw(
pandora_group_statistics pandora_group_statistics
pandora_server_statistics pandora_server_statistics
pandora_self_monitoring pandora_self_monitoring
pandora_sample_agent
pandora_process_policy_queue pandora_process_policy_queue
subst_alert_macros subst_alert_macros
subst_column_macros subst_column_macros
@ -5235,6 +5239,83 @@ sub pandora_self_monitoring ($$) {
print XMLFILE $xml_output; print XMLFILE $xml_output;
close (XMLFILE); close (XMLFILE);
} }
##########################################################################
=head2 C<< xml_module_template (I<$module_name>, I<$module_type>, I<$module_data>) >>
Module template for sample agent
=cut
##########################################################################
sub xml_module_template ($$$) {
my ($module_name, $module_type, $module_data) = @_;
my $output = "<module>\n";
$module_name = "<![CDATA[".$module_name."]]>" if $module_name =~ /[\s+.]+/;
$module_data = "<![CDATA[".$module_data."]]>" if $module_data =~ /[\s+.]+/;
$output .= "\t<name>".$module_name."</name>\n";
$output .= "\t<type>".$module_type."</type>\n";
$output .= "\t<data>".$module_data."</data>\n";
$output .= "</module>\n";
return $output;
}
##########################################################################
=head2 C<< pandora_sample_agent (I<$pa_config>) >>
Pandora agent for make sample data
=cut
##########################################################################
sub pandora_sample_agent ($) {
my ($pa_config) = @_;
my $utimestamp = time ();
my $timestamp = strftime ("%Y-%m-%d %H:%M:%S", localtime());
# First line
my $xml_output = "<?xml version='1.0' encoding='UTF-8'?>\n";
# Header
$xml_output = "<agent_data agent_name='Sample_Agent' agent_alias='Sample_Agent' description='Agent for sample generation purposes' group='Servers' os_name='$OS' os_version='$OS_VERSION' interval='".$pa_config->{'sample_agent_interval'}."' version='" . $pa_config->{'version'} . "' timestamp='".$timestamp."'>\n";
# Boolean ever return TRUE
$xml_output .= xml_module_template ("Boolean ever true", "generic_proc","1");
# Boolean return TRUE at 80% of times
my $sample_boolean_mostly_true = 1;
$sample_boolean_mostly_true = 0 if rand(9) > 7;
$xml_output .= xml_module_template ("Boolean mostly true", "generic_proc",$sample_boolean_mostly_true);
# Boolean return false at 80% of times
my $sample_boolean_mostly_false = 0;
$sample_boolean_mostly_false = 1 if rand(9) > 7;
$xml_output .= xml_module_template ("Boolean mostly false", "generic_proc", $sample_boolean_mostly_false);
# Boolean ever return FALSE
$xml_output .= xml_module_template ("Boolean ever false", "generic_proc","0");
# Random integer between 0 and 100
$xml_output .= xml_module_template ("Random integer values", "generic_data",int(rand(100)));
# Random values obtained with sinusoidal curves between 0 and 100 values
my $b = 1;
my $sample_serie_curve = 1 + cos(deg2rad($b));
$b = $b + rand(20)/10;
$b = 0 if ($b > 180);
$sample_serie_curve = $sample_serie_curve * $b * 10;
$sample_serie_curve =~ s/\,/\./g;
$xml_output .= xml_module_template ("Random serie curve", "generic_data", $sample_serie_curve);
# String with 10 random characters
my $sample_random_text = "";
my @characters = ('a'..'z','A'..'Z');
for (1...10){
$sample_random_text .= $characters[int(rand(@characters))];
}
$xml_output .= xml_module_template ("Random text", "generic_data_string", $sample_random_text);
# End of xml
$xml_output .= "</agent_data>";
# File path definition
my $filename = $pa_config->{"incomingdir"}."/".$pa_config->{'servername'}.".sample.".$utimestamp.".data";
# Opening, Writing and closing of XML
open (my $xmlfile, ">", $filename) or die "[FATAL] Could not open sample XML file for deploying monitorization at '$filename'";
print $xmlfile $xml_output;
close ($xmlfile);
}
########################################################################## ##########################################################################
=head2 C<< set_master (I<$pa_config>, I<$dbh>) >> =head2 C<< set_master (I<$pa_config>, I<$dbh>) >>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.740 PS191028"; my $version = "7.0NG.740 PS191029";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);
@ -5895,9 +5895,16 @@ sub cli_stop_downtime () {
exist_check($downtime_id,'planned downtime',$downtime_id); exist_check($downtime_id,'planned downtime',$downtime_id);
my $current_time = time; my $current_time = time;
my $downtime_date_to = get_db_value ($dbh, 'SELECT date_to FROM tplanned_downtime WHERE id=?', $downtime_id);
if($current_time >= $downtime_date_to) { my $data = get_db_single_row ($dbh, 'SELECT date_to, type_execution, executed FROM tplanned_downtime WHERE id=?', $downtime_id);
if( $data->{'type_execution'} eq 'periodically' && $data->{'executed'} == 1){
print_log "[ERROR] Planned_downtime '$downtime_name' cannot be stopped.\n";
print_log "[INFO] Periodical and running planned downtime cannot be stopped.\n\n";
exit;
}
if($current_time >= $data->{'date_to'}) {
print_log "[INFO] Planned_downtime '$downtime_name' is already stopped\n\n"; print_log "[INFO] Planned_downtime '$downtime_name' is already stopped\n\n";
exit; exit;
} }