';
// CSV export button.
@@ -532,7 +532,7 @@ else {
// Create button.
if ($write_permisson) {
echo ' ';
- echo '
';
}
@@ -559,7 +559,7 @@ $(document).ready (function () {
if ( && ) {
if (confirm("")) {
- 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";
}
}
});
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index b59dbc2ee5..e7201ab155 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -482,51 +482,6 @@ switch ($action) {
$period = $item['period'];
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':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
@@ -791,11 +746,6 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
- /*
- case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'simple_baseline_graph':
case 'event_report_log':
case 'increment':
@@ -3757,10 +3707,6 @@ $(document).ready (function () {
case 'event_report_module':
case 'simple_graph':
case 'simple_baseline_graph':
-/* case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'prediction_date':
case 'projection_graph':
case 'avg_value':
@@ -3798,10 +3744,6 @@ $(document).ready (function () {
case 'event_report_module':
case 'simple_graph':
case 'simple_baseline_graph':
-/* case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'prediction_date':
case 'projection_graph':
case 'avg_value':
@@ -4833,38 +4775,6 @@ function chooseType() {
$("#row_period").show();
$("#row_historical_db_check").hide();
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':
$("#row_description").show();
@@ -5218,10 +5128,6 @@ function chooseType() {
case 'min_value':
case 'max_value':
case 'avg_value':
- /* case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'simple_baseline_graph':
$("#row_label").show();
break;
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index 40ce45b5bb..823713877b 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -2006,11 +2006,6 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
- /*
- case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
@@ -2613,11 +2608,6 @@ switch ($action) {
case 'avg_value':
case 'projection_graph':
case 'prediction_date':
- /*
- case 'TTRT':
- case 'TTO':
- case 'MTBF':
- case 'MTTR':*/
case 'simple_baseline_graph':
case 'nt_top_n':
if ($label != '') {
diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php
index 0011167308..505d057665 100644
--- a/pandora_console/include/class/NetworkMap.class.php
+++ b/pandora_console/include/class/NetworkMap.class.php
@@ -2642,8 +2642,17 @@ class NetworkMap
*/
public function loadMapData()
{
+ global $config;
+
$networkmap = $this->map;
+ // ACL.
+ $networkmap_write = check_acl(
+ $config['id_user'],
+ $networkmap['id_group'],
+ 'MW'
+ );
+
$simulate = false;
if (isset($networkmap['__simulated']) === false) {
$networkmap['filter'] = json_decode(
@@ -2711,6 +2720,7 @@ class NetworkMap
$output .= 'var networkmap_center = [ '.$networkmap['center_x'].', '.$networkmap['center_y']."];\n";
$output .= 'var networkmap_dimensions = [ '.$networkmap['width'].', '.$networkmap['height']."];\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 networkmap_holding_area_dimensions = '.json_encode($networkmap['filter']['holding_area']).";\n";
$output .= "var networkmap = {'nodes': [], 'links': []};\n";
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 9c1bd16952..484f8dd138 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC191028';
+$build_version = 'PC191029';
$pandora_version = 'v7.0NG.740';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 1d0355cf97..a5ae07df3e 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -506,43 +506,6 @@ function reporting_make_reporting_data(
);
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':
$report['contents'][] = io_safe_output(
reporting_agent_configuration(
@@ -3276,6 +3239,7 @@ function reporting_database_serialized($report, $content)
}
$return['keys'] = $keys;
+ $return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name'] = $agent_alias;
$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['module_name'] = $module_name;
@@ -4475,6 +4440,7 @@ function reporting_prediction_date($report, $content)
$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['subtitle'] = $agent_name.' - '.$module_name;
@@ -4482,6 +4448,7 @@ function reporting_prediction_date($report, $content)
$return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ $return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_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']));
$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['subtitle'] = $agent_name.' - '.$module_name;
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
+ $return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
@@ -4727,23 +4696,6 @@ function reporting_value($report, $content, $type, $pdf=false)
case 'sum':
$return['type'] = 'sumatory';
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'])) {
@@ -4763,23 +4715,6 @@ function reporting_value($report, $content, $type, $pdf=false)
case 'sum':
$content['name'] = __('Summatory');
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(
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',
'tagente_modulo',
@@ -4812,6 +4750,7 @@ function reporting_value($report, $content, $type, $pdf=false)
$return['id_agent'] = $content['id_agent'];
$return['id_agent_module'] = $content['id_agent_module'];
+ $return['agent_name_db'] = $agent_name_db;
$return['agent_name'] = $agent_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;
}
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'] = [
@@ -7755,6 +7649,7 @@ function reporting_simple_graph(
$return['title'] = $content['name'];
$return['subtitle'] = $agent_alias.' - '.$module_name;
+ $return['agent_name_db'] = agents_get_name($id_agent);
$return['agent_name'] = $agent_alias;
$return['module_name'] = $module_name;
$return['description'] = $content['description'];
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index cf1fa60e70..5dc38d3b9d 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -288,23 +288,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_html_sum_value($table, $item, $mini);
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':
reporting_html_agent_configuration($table, $item);
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)
{
reporting_html_value($table, $item, $mini);
diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php
index 319690946e..e20fdd01fa 100755
--- a/pandora_console/include/functions_reports.php
+++ b/pandora_console/include/functions_reports.php
@@ -679,24 +679,6 @@ function reports_get_report_types($template=false, $not_editor=false)
'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'] = [
'optgroup' => __('SLA'),
'name' => __('S.L.A.'),
diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js
index e5a0b87f7e..5d3477dca1 100644
--- a/pandora_console/include/javascript/functions_pandora_networkmap.js
+++ b/pandora_console/include/javascript/functions_pandora_networkmap.js
@@ -14,6 +14,7 @@
/* global holding_area_dimensions */
/* global networkmap_id */
/* global enterprise_installed */
+/* global networkmap_write */
/* global force */
/* global layer_graph_nodes */
/* global layer_graph_links */
@@ -2087,7 +2088,12 @@ function show_menu(item, data) {
icon: "add_node",
disabled: function() {
if (enterprise_installed) {
- return false;
+ // Check if user can write network maps.
+ if (networkmap_write) {
+ return false;
+ } else {
+ return true;
+ }
} else {
return true;
}
@@ -2099,6 +2105,14 @@ function show_menu(item, data) {
items_list["center"] = {
name: set_center_menu,
icon: "center",
+ disabled: function() {
+ // Check if user can write network maps.
+ if (networkmap_write) {
+ return false;
+ } else {
+ return true;
+ }
+ },
callback: function(key, options) {
set_center(networkmap_id);
}
@@ -2136,7 +2150,12 @@ function show_menu(item, data) {
icon: "restart_map",
disabled: function() {
if (enterprise_installed) {
- return false;
+ // Check if user can write network maps.
+ if (networkmap_write) {
+ return false;
+ } else {
+ return true;
+ }
} else {
return true;
}
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 130c31a047..4f668fcd81 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@
{'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
if ($counter >= ~0){
$counter = 0;
diff --git a/pandora_server/conf/pandora_server.conf.new b/pandora_server/conf/pandora_server.conf.new
index 1b76b1cf66..a5896e6050 100644
--- a/pandora_server/conf/pandora_server.conf.new
+++ b/pandora_server/conf/pandora_server.conf.new
@@ -376,6 +376,15 @@ self_monitoring 1
# Self monitoring interval (in seconds).
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 1
diff --git a/pandora_server/conf/pandora_server.conf.windows b/pandora_server/conf/pandora_server.conf.windows
index c7c5db64b4..a7232e459c 100644
--- a/pandora_server/conf/pandora_server.conf.windows
+++ b/pandora_server/conf/pandora_server.conf.windows
@@ -330,6 +330,15 @@ restart_delay 60
# Self monitoring interval (in seconds).
#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 1
diff --git a/pandora_server/lib/PandoraFMS/Config.pm b/pandora_server/lib/PandoraFMS/Config.pm
index e1ac6c3633..1a7d0b44dd 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -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 = "191028";
+my $pandora_build = "191029";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash
@@ -79,7 +79,7 @@ sub help_screen {
sub pandora_init {
my $pa_config = $_[0];
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 "You can download latest versions and documentation at official web page.\n\n";
@@ -397,6 +397,12 @@ sub pandora_load_config {
# Self monitoring interval
$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
$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) {
$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) {
$pa_config->{'update_parent'} = clean_blank($1);
}
diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm
index f575d8e02b..aaa2137cc4 100644
--- a/pandora_server/lib/PandoraFMS/Core.pm
+++ b/pandora_server/lib/PandoraFMS/Core.pm
@@ -100,6 +100,8 @@ Exported Functions:
=item * C
+=item * C
+
=back
=head1 METHODS
@@ -122,6 +124,7 @@ use threads::shared;
use JSON qw(decode_json encode_json);
use MIME::Base64;
use Text::ParseWords;
+use Math::Trig; # Math functions
# Debugging
#use Data::Dumper;
@@ -247,6 +250,7 @@ our @EXPORT = qw(
pandora_group_statistics
pandora_server_statistics
pandora_self_monitoring
+ pandora_sample_agent
pandora_process_policy_queue
subst_alert_macros
subst_column_macros
@@ -5235,6 +5239,83 @@ sub pandora_self_monitoring ($$) {
print XMLFILE $xml_output;
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 = "\n";
+
+ $module_name = "" if $module_name =~ /[\s+.]+/;
+ $module_data = "" if $module_data =~ /[\s+.]+/;
+
+ $output .= "\t".$module_name."\n";
+ $output .= "\t".$module_type."\n";
+ $output .= "\t".$module_data."\n";
+ $output .= "\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 = "\n";
+ # Header
+ $xml_output = "\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 .= "";
+ # 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>) >>
diff --git a/pandora_server/lib/PandoraFMS/PluginTools.pm b/pandora_server/lib/PandoraFMS/PluginTools.pm
index 707243398a..287b11e900 100644
--- a/pandora_server/lib/PandoraFMS/PluginTools.pm
+++ b/pandora_server/lib/PandoraFMS/PluginTools.pm
@@ -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 = "191028";
+my $pandora_build = "191029";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec
index 5d9aa0c75c..805efb4c41 100644
--- a/pandora_server/pandora_server.redhat.spec
+++ b/pandora_server/pandora_server.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.740
-%define release 1
+%define release 191029
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec
index 80e9f80d29..e2eb323b24 100644
--- a/pandora_server/pandora_server.spec
+++ b/pandora_server/pandora_server.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.740
-%define release 1
+%define release 191029
Summary: Pandora FMS Server
Name: %{name}
diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer
index 6f524cc715..6b1870fadf 100755
--- a/pandora_server/pandora_server_installer
+++ b/pandora_server/pandora_server_installer
@@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.740"
-PI_BUILD="191028"
+PI_BUILD="191029"
MODE=$1
if [ $# -gt 1 ]; then
diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl
index 4017ec63bf..a9cc09579b 100644
--- a/pandora_server/util/pandora_db.pl
+++ b/pandora_server/util/pandora_db.pl
@@ -34,7 +34,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
-my $version = "7.0NG.740 PS191028";
+my $version = "7.0NG.740 PS191029";
# Pandora server configuration
my %conf;
diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index cfaa9d8f41..a3ffd61ecb 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
-my $version = "7.0NG.740 PS191028";
+my $version = "7.0NG.740 PS191029";
# save program name for logging
my $progname = basename($0);
@@ -5895,9 +5895,16 @@ sub cli_stop_downtime () {
exist_check($downtime_id,'planned downtime',$downtime_id);
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";
exit;
}