';
// 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/ajax/welcome_window.php b/pandora_console/include/ajax/welcome_window.php
new file mode 100644
index 0000000000..fc2e278a6f
--- /dev/null
+++ b/pandora_console/include/ajax/welcome_window.php
@@ -0,0 +1,62 @@
+ajaxMethod($method) === true) {
+ $welcome_actions->{$method}();
+ } else {
+ $welcome_actions->error('Unavailable method.');
+ }
+} else {
+ $welcome_actions->error('Method not found. ['.$method.']');
+}
+
+
+// Stop any execution.
+exit;
diff --git a/pandora_console/include/class/Diagnostics.class.php b/pandora_console/include/class/Diagnostics.class.php
index 43f3d948b4..af65aa8066 100644
--- a/pandora_console/include/class/Diagnostics.class.php
+++ b/pandora_console/include/class/Diagnostics.class.php
@@ -1801,6 +1801,7 @@ class Diagnostics extends Wizard
'id' => 'modal_form_feedback',
'onsubmit' => 'return false;',
'class' => 'modal',
+ 'extra' => 'novalidate',
];
$inputs = [];
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/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php
new file mode 100644
index 0000000000..4381323439
--- /dev/null
+++ b/pandora_console/include/class/WelcomeWindow.class.php
@@ -0,0 +1,760 @@
+ $msg]
+ );
+ }
+
+
+ /**
+ * Checks if target method is available to be called using AJAX.
+ *
+ * @param string $method Target method.
+ *
+ * @return boolean True allowed, false not.
+ */
+ public function ajaxMethod($method)
+ {
+ global $config;
+
+ // Check access.
+ check_login();
+
+ return in_array($method, $this->AJAXMethods);
+ }
+
+
+ /**
+ * Constructor.
+ *
+ * @param boolean $must_run Must run or not.
+ * @param string $ajax_controller Controller.
+ *
+ * @return object
+ * @throws Exception On error.
+ */
+ public function __construct(
+ bool $must_run=false,
+ $ajax_controller='include/ajax/welcome_window'
+ ) {
+ $this->ajaxController = $ajax_controller;
+
+ if ($this->initialize($must_run) !== true) {
+ throw new Exception('Must not be shown');
+ }
+
+ return $this;
+ }
+
+
+ /**
+ * Main method.
+ *
+ * @return void
+ */
+ public function run()
+ {
+ ui_require_css_file('new_installation_welcome_window');
+ echo '
';
+
+ ?>
+
+
+ ';
+ }
+
+
+ /**
+ * Method to cancel welcome modal window.
+ *
+ * @return void
+ */
+ public function cancelWelcome()
+ {
+ // Config update value.
+ $this->setStep(WELCOME_FINISHED);
+ }
+
+
+ /**
+ * Return current step.
+ *
+ * @return integer Step.
+ */
+ public function getStep(): int
+ {
+ global $config;
+ $this->step = $config['welcome_state'];
+
+ return $this->step;
+ }
+
+
+ /**
+ * Sets current step.
+ *
+ * @param integer $step Current step.
+ *
+ * @return void
+ */
+ public function setStep(int $step)
+ {
+ $this->step = $step;
+ config_update_value('welcome_state', $step);
+
+ }
+
+
+ /**
+ * Retrieve current welcome agent id.
+ *
+ * @return integer Agent id (created).
+ */
+ public function getWelcomeAgent()
+ {
+ global $config;
+
+ return $config['welcome_id_agent'];
+ }
+
+
+ /**
+ * Saves current welcome agent (latest created).
+ *
+ * @param integer $id_agent Agent id.
+ *
+ * @return void
+ */
+ public function setWelcomeAgent(int $id_agent)
+ {
+ config_update_value('welcome_id_agent', $id_agent);
+ }
+
+
+ /**
+ * Loads a welcome window form
+ *
+ * @return​ ​string HTML code for form.
+ *
+ * @return void Runs loadWelcomeWindow (AJAX).
+ */
+ public function loadWelcomeWindow()
+ {
+ global $config;
+ $btn_configure_mail_class = 'pending';
+ $btn_create_agent_class = 'pending';
+ $btn_create_module_class = '';
+ $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;
+
+ case W_CREATE_MODULE:
+ $btn_configure_mail_class = ' completed';
+ $btn_create_agent_class = ' completed';
+ $btn_create_module_class = ' pending';
+ break;
+
+ 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;
+
+ 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;
+
+ 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;
+
+ default:
+ case W_CONFIGURE_MAIL:
+ // Nothing done yet.
+ $btn_configure_mail_class = ' pending';
+ break;
+ }
+
+ $form = [
+ 'action' => '#',
+ 'id' => 'welcome_form',
+ 'onsubmit' => 'this.dialog("close");',
+ 'class' => 'modal',
+ ];
+
+ $inputs = [
+ [
+ 'wrapper' => 'div',
+ 'block_id' => 'div_configure_mail',
+ 'class' => 'flex-row w100p',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('Please ensure mail configuration matches your needs'),
+ 'arguments' => [
+ 'class' => 'first_lbl',
+ 'name' => 'lbl_create_agent',
+ 'id' => 'lbl_create_agent',
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'label' => '',
+ 'type' => 'button',
+ 'attributes' => 'class="go '.$btn_configure_mail_class.'"',
+ 'name' => 'btn_email_conf',
+ 'id' => 'btn_email_conf',
+ ],
+ ],
+ ],
+ ],[
+ 'wrapper' => 'div',
+ 'block_id' => 'div_create_agent',
+ 'class' => 'flex-row w100p',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('Create an agent'),
+ 'arguments' => [
+ 'class' => 'first_lbl',
+ 'name' => 'lbl_create_agent',
+ 'id' => 'lbl_create_agent',
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'label' => '',
+ 'type' => 'button',
+ 'attributes' => 'class="go '.$btn_create_agent_class.'"',
+ 'name' => 'btn_create_agent',
+ 'id' => 'btn_create_agent',
+ ],
+ ],
+ ],
+ ],
+ [
+ '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',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('Create a module to check if an agent is online'),
+ 'arguments' => [
+ 'class' => 'second_lbl',
+ 'name' => 'lbl_check_agent',
+ 'id' => 'lbl_check_agent',
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'label' => '',
+ 'type' => 'button',
+ 'attributes' => 'class="go '.$btn_create_module_class.'"',
+ 'name' => 'btn_create_module',
+ 'id' => 'btn_create_module',
+ ],
+ ],
+ ],
+ ],
+ [
+ 'wrapper' => 'div',
+ 'block_id' => 'div_monitor_actions',
+ 'class' => 'learn_content_indented flex-row w100p',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('Be warned if something is wrong, create an alert on the module'),
+ 'arguments' => [
+ 'class' => 'second_lbl',
+ 'name' => 'lbl_create_alert',
+ 'id' => 'lbl_create_alert',
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'label' => '',
+ 'type' => 'button',
+ 'attributes' => 'class="go '.$btn_create_alert_class.'"',
+ 'name' => 'btn_create_alert',
+ 'id' => 'btn_create_alert',
+ ],
+ ],
+ ],
+ ],
+ [
+ 'wrapper' => 'div',
+ 'block_id' => 'div_discover',
+ 'class' => 'flex-row w100p',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('Discover hosts and devices in your network'),
+ 'arguments' => [
+ 'class' => 'first_lbl',
+ 'name' => 'lbl_discover_devices',
+ 'id' => 'lbl_discover_devices',
+ ],
+ ],
+ [
+ 'arguments' => [
+ 'label' => '',
+ 'type' => 'button',
+ 'attributes' => 'class="go '.$btn_create_discovery_class.'"',
+ 'name' => 'btn_discover_devices',
+ 'id' => 'btn_discover_devices',
+ ],
+ ],
+ ],
+ ],
+ [
+ 'wrapper' => 'div',
+ 'block_id' => 'div_not_working',
+ 'class' => 'flex-row w100p',
+ 'direct' => 1,
+ 'block_content' => [
+ [
+ 'label' => __('If something is not working as expected, look for this icon and report!'),
+ 'arguments' => [
+ 'class' => 'first_lbl',
+ 'name' => 'lbl_not_working',
+ 'id' => 'lbl_not_working',
+ ],
+ ],
+ [
+ 'label' => html_print_image(
+ 'images/feedback-header.png',
+ true,
+ [
+ 'onclick' => '$(\'#feedback-header\').click()',
+ 'style' => 'cursor: pointer;',
+ ]
+ ),
+
+ ],
+ ],
+ ],
+ ];
+
+ $output = $this->printForm(
+ [
+ 'form' => $form,
+ 'inputs' => $inputs,
+ ],
+ true
+ );
+
+ $output .= $this->loadJS();
+ echo $output;
+
+ // Ajax methods does not continue.
+ exit();
+ }
+
+
+ /**
+ * This function acts as a constructor. Receive the condition to check with
+ * the global config (welcome_state) if continues
+ *
+ * @param boolean $must_run Must be run or not (check register.php).
+ *
+ * @return boolean True if initialized or false if must not run.
+ */
+ public function initialize($must_run)
+ {
+ global $config;
+
+ if (isset($config['welcome_state']) === false) {
+ $this->setStep(W_CONFIGURE_MAIL);
+ }
+
+ // Check current page.
+ $sec2 = get_parameter('sec2', '');
+
+ if ($must_run === false
+ || $config['welcome_state'] === WELCOME_FINISHED
+ ) {
+ // Do not show if finished.
+ return false;
+ }
+
+ $this->step = $this->getStep();
+ $this->agent = $this->getWelcomeAgent();
+
+ /*
+ * Configure mail. Control current flow.
+ *
+ * On empty sec2: show current step.
+ * On setup page: do not show.
+ * After mail configuration: enable agent step.
+ */
+
+ 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->setStep(W_CREATE_AGENT);
+ } else if ($sec2 === 'godmode/setup/setup'
+ && get_parameter('section', '') === 'general'
+ ) {
+ // Mail configuration is being processed.
+ return false;
+ } else if (empty($sec2) === true) {
+ // If at main page, show welcome.
+ return true;
+ }
+ }
+
+ /*
+ * Create agent. Control current flow.
+ *
+ * On empty sec2: show current step.
+ * On agent creation page: do not show.
+ * After agent creation: enable module step.
+ */
+
+ if ($this->step === W_CREATE_AGENT) {
+ // Create agent is pending.
+ if ($sec2 === 'godmode/agentes/configurar_agente'
+ && get_parameter('create_agent', false) !== false
+ ) {
+ // Agent have been created. Store.
+ $this->setWelcomeAgent(
+ db_get_value(
+ 'MAX(id_agente)',
+ 'tagente'
+ )
+ );
+ $this->setStep(W_CREATE_MODULE);
+ return true;
+ } else if ($sec2 === 'godmode/agentes/configurar_agente') {
+ // Agent is being created.
+ return false;
+ } else if (empty($sec2) === true) {
+ // If at main page, show welcome.
+ return true;
+ }
+ }
+
+ /*
+ * Create module. Control current flow.
+ *
+ * On empty sec2: show current step.
+ * On module creation page: do not show.
+ * After module creation: enable alert step.
+ */
+
+ if ($this->step === W_CREATE_MODULE) {
+ // Create module is pending.
+ if ($sec2 === 'godmode/agentes/configurar_agente'
+ && get_parameter('tab', '') === 'module'
+ && get_parameter('create_module', false) !== false
+ ) {
+ // Module have been created.
+ $this->setStep(W_CREATE_ALERT);
+ return true;
+ } else if ($sec2 === 'godmode/agentes/configurar_agente'
+ && get_parameter('tab', '') === 'module'
+ ) {
+ // Module is being created.
+ return false;
+ } else if (empty($sec2) === true) {
+ // If at main page, show welcome.
+ return true;
+ }
+ }
+
+ /*
+ * Create alert. Control current flow.
+ *
+ * On empty sec2: show current step.
+ * On alert creation page: do not show.
+ * After alert creation: enable discovery task step.
+ */
+
+ if ($this->step === W_CREATE_ALERT) {
+ // Create alert is pending.
+ if ($sec2 === 'godmode/agentes/configurar_agente'
+ && get_parameter('tab', '') === 'alert'
+ && get_parameter('create_alert', false) !== false
+ ) {
+ // Alert have been created.
+ $this->setStep(W_CREATE_TASK);
+ return true;
+ } else if ($sec2 === 'godmode/agentes/configurar_agente'
+ && get_parameter('tab', '') === 'alert'
+ ) {
+ // Alert is being created.
+ return false;
+ } else if (empty($sec2) === true) {
+ // If at main page, show welcome.
+ return true;
+ }
+ }
+
+ /*
+ * Create discovery task. Control current flow.
+ *
+ * On empty sec2: show current step.
+ * On discovery task creation page: do not show.
+ * 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);
+
+ // Finished! do not show.
+ 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;
+ }
+ }
+
+ if ($this->step === WELCOME_FINISHED) {
+ // Welcome tutorial finished.
+ return false;
+ }
+
+ // Return a reference to the new object.
+ return false;
+ }
+
+
+ /**
+ * Load JS content.
+ * function that enables the functions to the buttons when its action is
+ * completed.
+ * Assign the url of each button.
+ *
+ * @return string HTML code for javascript functionality.
+ */
+ public function loadJS()
+ {
+ ob_start();
+ ?>
+
+ ';
+ $output = '
';
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 1d0355cf97..799b22cae2 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -224,7 +224,12 @@ function reporting_make_reporting_data(
// General reports with 0 period means last value
// Avoid to overwrite it by template value.
- if (!empty($period) && ($content['type'] !== 'general' && $content['period'] != 0)) {
+ $general_last_value = false;
+ if ($content['type'] === 'general' && $content['period'] == 0) {
+ $general_last_value = true;
+ }
+
+ if (!empty($period) && $general_last_value === false) {
$content['period'] = $period;
}
@@ -506,43 +511,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 +3244,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 +4272,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 +4445,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 +4453,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 +4498,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 +4701,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 +4720,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 +4736,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 +4755,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 +4896,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 +7654,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/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js
index f3737eabdf..c3ed855213 100644
--- a/pandora_console/include/javascript/pandora.js
+++ b/pandora_console/include/javascript/pandora.js
@@ -1900,6 +1900,169 @@ function load_modal(settings) {
buttons: []
})
.show();
+ var required_buttons = [];
+ if (settings.modal.cancel != undefined) {
+ //The variable contains a function
+ // that is responsible for executing the method it receives from settings
+ // which confirms the closure of a modal
+ var cancelModal = function() {
+ settings.target.dialog("close");
+ if (AJAX_RUNNING) return;
+ AJAX_RUNNING = 1;
+ var formdata = new FormData();
+
+ formdata.append("page", settings.oncancel.page);
+ formdata.append("method", settings.oncancel.method);
+
+ $.ajax({
+ method: "post",
+ url: settings.url,
+ processData: false,
+ contentType: false,
+ data: formdata,
+ success: function(data) {
+ if (typeof settings.oncancel.callback == "function") {
+ settings.oncancel.callback(data);
+ settings.target.dialog("close");
+ }
+ AJAX_RUNNING = 0;
+ },
+ error: function(data) {
+ // console.log(data);
+ AJAX_RUNNING = 0;
+ }
+ });
+ };
+
+ required_buttons.push({
+ class:
+ "ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
+ text: settings.modal.cancel,
+ click: function() {
+ if (settings.oncancel != undefined) {
+ if (typeof settings.oncancel.confirm == "function") {
+ //receive function
+ settings.oncancel.confirm(cancelModal);
+ } else if (settings.oncancel != undefined) {
+ cancelModal();
+ }
+ } else {
+ $(this).dialog("close");
+ }
+ }
+ });
+ }
+
+ if (settings.modal.ok != undefined) {
+ required_buttons.push({
+ class:
+ "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
+ text: settings.modal.ok,
+ click: function() {
+ if (AJAX_RUNNING) return;
+
+ if (settings.onsubmit != undefined) {
+ if (settings.onsubmit.preaction != undefined) {
+ settings.onsubmit.preaction();
+ }
+ AJAX_RUNNING = 1;
+ if (settings.onsubmit.dataType == undefined) {
+ settings.onsubmit.dataType = "html";
+ }
+
+ var formdata = new FormData();
+ if (settings.extradata) {
+ settings.extradata.forEach(function(item) {
+ if (item.value != undefined)
+ formdata.append(item.name, item.value);
+ });
+ }
+ formdata.append("page", settings.onsubmit.page);
+ formdata.append("method", settings.onsubmit.method);
+
+ var flagError = false;
+
+ $("#" + settings.form + " :input").each(function() {
+ if (this.checkValidity() === false) {
+ $(this).attr("title", this.validationMessage);
+ $(this).tooltip({
+ tooltipClass: "uitooltip",
+ position: {
+ my: "right bottom",
+ at: "right top",
+ using: function(position, feedback) {
+ $(this).css(position);
+ $("
")
+ .addClass("arrow")
+ .addClass(feedback.vertical)
+ .addClass(feedback.horizontal)
+ .appendTo(this);
+ }
+ }
+ });
+ $(this).tooltip("open");
+
+ var element = $(this);
+ setTimeout(
+ function(element) {
+ element.tooltip("destroy");
+ element.removeAttr("title");
+ },
+ 3000,
+ element
+ );
+
+ flagError = true;
+ }
+
+ if (this.type == "file") {
+ if ($(this).prop("files")[0]) {
+ formdata.append(this.name, $(this).prop("files")[0]);
+ }
+ } else {
+ if ($(this).attr("type") == "checkbox") {
+ if (this.checked) {
+ formdata.append(this.name, "on");
+ }
+ } else {
+ formdata.append(this.name, $(this).val());
+ }
+ }
+ });
+
+ if (flagError === false) {
+ $.ajax({
+ method: "post",
+ url: settings.url,
+ processData: false,
+ contentType: false,
+ data: formdata,
+ dataType: settings.onsubmit.dataType,
+ success: function(data) {
+ if (settings.ajax_callback != undefined) {
+ if (settings.idMsgCallback != undefined) {
+ settings.ajax_callback(data, settings.idMsgCallback);
+ } else {
+ settings.ajax_callback(data);
+ }
+ }
+ AJAX_RUNNING = 0;
+ }
+ });
+ } else {
+ AJAX_RUNNING = 0;
+ }
+ } else {
+ // No onsumbit configured. Directly close.
+ $(this).dialog("close");
+ }
+ },
+ error: function(data) {
+ // console.log(data);
+ AJAX_RUNNING = 0;
+ }
+ });
+ }
$.ajax({
method: "post",
@@ -1922,105 +2085,63 @@ function load_modal(settings) {
opacity: 0.5,
background: "black"
},
- buttons: [
- {
- class:
- "ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
- text: settings.modal.cancel,
- click: function() {
- $(this).dialog("close");
- if (typeof settings.cleanup == "function") {
- settings.cleanup();
- }
- }
- },
- {
- class:
- "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
- text: settings.modal.ok,
- click: function() {
- if (AJAX_RUNNING) return;
- AJAX_RUNNING = 1;
- if (settings.onsubmit.preaction != undefined) {
- settings.onsubmit.preaction();
- }
- if (settings.onsubmit.dataType == undefined) {
- settings.onsubmit.dataType = "html";
- }
-
- var formdata = new FormData();
- if (settings.extradata) {
- settings.extradata.forEach(function(item) {
- if (item.value != undefined)
- formdata.append(item.name, item.value);
- });
- }
- formdata.append("page", settings.onsubmit.page);
- formdata.append("method", settings.onsubmit.method);
-
- var flagError = false;
-
- $("#" + settings.form + " :input").each(function() {
- if (this.checkValidity() === false) {
- $(this).prop("title", this.validationMessage);
- $(this).tooltip({
- tooltipClass: "uitooltip",
- position: { my: "right bottom", at: "right bottom" },
- show: { duration: 200 }
- });
- $(this).tooltip("open");
- flagError = true;
- }
-
- if (this.type == "file") {
- if ($(this).prop("files")[0]) {
- formdata.append(this.name, $(this).prop("files")[0]);
- }
- } else {
- if ($(this).attr("type") == "checkbox") {
- if (this.checked) {
- formdata.append(this.name, "on");
- }
- } else {
- formdata.append(this.name, $(this).val());
- }
- }
- });
-
- if (flagError === false) {
- $.ajax({
- method: "post",
- url: settings.url,
- processData: false,
- contentType: false,
- data: formdata,
- dataType: settings.onsubmit.dataType,
- success: function(data) {
- if (settings.ajax_callback != undefined) {
- if (settings.idMsgCallback != undefined) {
- settings.ajax_callback(data, settings.idMsgCallback);
- } else {
- settings.ajax_callback(data);
- }
- }
- AJAX_RUNNING = 0;
- }
- });
- } else {
- AJAX_RUNNING = 0;
- }
- }
- }
- ],
+ buttons: required_buttons,
closeOnEscape: false,
open: function() {
$(".ui-dialog-titlebar-close").hide();
}
});
+ },
+ error: function(data) {
+ // console.log(data);
}
});
}
+//Function that shows a dialog box to confirm closures of generic manners. The modal id is random
+function confirmDialog(settings) {
+ var randomStr =
+ Math.random()
+ .toString(36)
+ .substring(2, 15) +
+ Math.random()
+ .toString(36)
+ .substring(2, 15);
+
+ $("body").append(
+ '
' + settings.message + "
"
+ );
+ $("#confirm_" + randomStr);
+ $("#confirm_" + randomStr)
+ .dialog({
+ title: settings.title,
+ close: false,
+ width: 350,
+ modal: true,
+ buttons: [
+ {
+ text: "Cancel",
+ class:
+ "ui-widget ui-state-default ui-corner-all ui-button-text-only sub upd submit-cancel",
+ click: function() {
+ $(this).dialog("close");
+ if (typeof settings.onDeny == "function") settings.onDeny();
+ }
+ },
+ {
+ text: "Ok",
+ class:
+ "ui-widget ui-state-default ui-corner-all ui-button-text-only sub ok submit-next",
+ click: function() {
+ $(this).dialog("close");
+ if (typeof settings.onAccept == "function") settings.onAccept();
+ }
+ }
+ ]
+ })
+ .show();
+}
+
/**
* Function to show modal with message Validation.
*
diff --git a/pandora_console/include/styles/diagnostics.css b/pandora_console/include/styles/diagnostics.css
index 3b541ac523..8de918e308 100644
--- a/pandora_console/include/styles/diagnostics.css
+++ b/pandora_console/include/styles/diagnostics.css
@@ -56,3 +56,11 @@
margin: 30px;
font-style: italic;
}
+
+#modal_form_feedback {
+ margin: 10px;
+}
+
+#div-what-happened label {
+ margin-bottom: 10px;
+}
diff --git a/pandora_console/include/styles/discovery.css b/pandora_console/include/styles/discovery.css
index 2095e98b8e..5e19c2ed51 100644
--- a/pandora_console/include/styles/discovery.css
+++ b/pandora_console/include/styles/discovery.css
@@ -272,20 +272,11 @@ a.ext_link {
font-size: 8pt;
}
-input:invalid,
-input[type="email"]:invalid {
- border-bottom-color: #fb4444;
-}
-
-textarea:invalid {
- border-color: #fb4444;
-}
-
div.ui-tooltip.ui-corner-all.ui-widget-shadow.ui-widget.ui-widget-content.uitooltip {
background: grey;
opacity: 0.9;
border-radius: 4px;
- box-shadow: 0 0 0px #fff;
+ box-shadow: 6px 5px 9px -9px black;
padding: 6px;
}
@@ -297,3 +288,37 @@ div.ui-tooltip.ui-corner-all.ui-widget-shadow.ui-widget.ui-widget-content.uitool
letter-spacing: 0.03pt;
font-size: 8pt;
}
+
+.arrow {
+ width: 70px;
+ height: 16px;
+ overflow: hidden;
+ position: absolute;
+ left: 50%;
+ margin-left: -35px;
+ bottom: -16px;
+}
+.arrow.top {
+ top: -16px;
+ bottom: auto;
+}
+.arrow.left {
+ left: 50%;
+}
+.arrow:after {
+ background: grey;
+ content: "";
+ position: absolute;
+ left: 20px;
+ top: -20px;
+ width: 25px;
+ height: 25px;
+ box-shadow: 6px 5px 9px -9px black;
+ -webkit-transform: rotate(45deg);
+ -ms-transform: rotate(45deg);
+ transform: rotate(45deg);
+}
+.arrow.top:after {
+ bottom: -20px;
+ top: auto;
+}
diff --git a/pandora_console/include/styles/new_installation_welcome_window.css b/pandora_console/include/styles/new_installation_welcome_window.css
new file mode 100644
index 0000000000..4aba16193d
--- /dev/null
+++ b/pandora_console/include/styles/new_installation_welcome_window.css
@@ -0,0 +1,62 @@
+.modal {
+ overflow: hidden;
+}
+
+.welcome_modal_window {
+ overflow: hidden;
+}
+
+#welcome_modal_window {
+ /*
+ max-height: 100%;
+ height: 100%;
+ border-left: 1em solid #82b92f;
+ margin-bottom: -59px;
+ padding-bottom: 100px;
+ margin-left: -1px;
+ */
+}
+
+#welcome_form ul.wizard li {
+ padding: 1em;
+ padding-bottom: 0;
+ padding-top: 1em;
+}
+
+#welcome_form label {
+ font-family: "lato-lighter", "Open Sans", sans-serif;
+ font-weight: normal;
+}
+.content_position {
+ display: flex;
+ margin-top: 5px;
+ font-family: "lato-lighter", "Open Sans", sans-serif;
+ font-weight: normal;
+}
+
+.learn_content_indented {
+ text-indent: 1.5em;
+ font-family: "lato-lighter", "Open Sans", sans-serif;
+ font-weight: normal;
+}
+
+#lbl_learn {
+ font-family: "lato-lighter", "Open Sans", sans-serif;
+ font-weight: normal;
+}
+
+.go {
+ background-repeat: no-repeat;
+ background-size: cover;
+ width: 20px;
+ height: 20px;
+ border: none;
+}
+
+.pending {
+ background-image: url(../../images/darrowright.png);
+}
+
+.completed {
+ background-image: url(../../images/input_tick.png);
+}
diff --git a/pandora_console/operation/snmpconsole/snmp_view.php b/pandora_console/operation/snmpconsole/snmp_view.php
index 72f24e0575..649a3814c5 100755
--- a/pandora_console/operation/snmpconsole/snmp_view.php
+++ b/pandora_console/operation/snmpconsole/snmp_view.php
@@ -430,15 +430,38 @@ if ($date_to_trap != '') {
}
if ($filter_severity != -1) {
- // Test if install the enterprise to search oid in text or oid field in ttrap.
- if ($config['enterprise_installed']) {
- $whereSubquery .= ' AND (
- (alerted = 0 AND severity = '.$filter_severity.') OR
- (alerted = 1 AND priority = '.$filter_severity.'))';
- } else {
- $whereSubquery .= ' AND (
- (alerted = 0 AND 1 = '.$filter_severity.') OR
- (alerted = 1 AND priority = '.$filter_severity.'))';
+ // There are two special severity values aimed to match two different trap standard severities in database: warning/critical and critical/normal.
+ if ($filter_severity != EVENT_CRIT_OR_NORMAL && $filter_severity != EVENT_CRIT_WARNING_OR_CRITICAL) {
+ // Test if enterprise is installed to search oid in text or oid field in ttrap.
+ if ($config['enterprise_installed']) {
+ $whereSubquery .= ' AND (
+ (alerted = 0 AND severity = '.$filter_severity.') OR
+ (alerted = 1 AND priority = '.$filter_severity.'))';
+ } else {
+ $whereSubquery .= ' AND (
+ (alerted = 0 AND 1 = '.$filter_severity.') OR
+ (alerted = 1 AND priority = '.$filter_severity.'))';
+ }
+ } else if ($filter_severity === EVENT_CRIT_WARNING_OR_CRITICAL) {
+ // Test if enterprise is installed to search oid in text or oid field in ttrap.
+ if ($config['enterprise_installed']) {
+ $whereSubquery .= ' AND (
+ (alerted = 0 AND (severity = '.EVENT_CRIT_WARNING.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
+ (alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
+ } else {
+ $whereSubquery .= ' AND (
+ (alerted = 1 AND (priority = '.EVENT_CRIT_WARNING.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
+ }
+ } else if ($filter_severity === EVENT_CRIT_OR_NORMAL) {
+ // Test if enterprise is installed to search oid in text or oid field in ttrap.
+ if ($config['enterprise_installed']) {
+ $whereSubquery .= ' AND (
+ (alerted = 0 AND (severity = '.EVENT_CRIT_NORMAL.' OR severity = '.EVENT_CRIT_CRITICAL.')) OR
+ (alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
+ } else {
+ $whereSubquery .= ' AND (
+ (alerted = 1 AND (priority = '.EVENT_CRIT_NORMAL.' OR priority = '.EVENT_CRIT_CRITICAL.')))';
+ }
}
}
diff --git a/pandora_console/websocket.sh b/pandora_console/pandora_websocket_engine
similarity index 100%
rename from pandora_console/websocket.sh
rename to pandora_console/pandora_websocket_engine
diff --git a/pandora_console/websocket.service b/pandora_console/pandora_websocket_engine.service
similarity index 100%
rename from pandora_console/websocket.service
rename to pandora_console/pandora_websocket_engine.service
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 1b235f6d01..9e35ad44f8 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -3522,6 +3522,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_template_data` (
`time_format` varchar(60) NOT NULL default "time",
`timezone` varchar(60) NOT NULL default "Europe/Madrid",
`show_last_value` tinyint(1) UNSIGNED NULL default '0',
+ `cache_expiration` INTEGER UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id`),
FOREIGN KEY (`id_layout_template`) REFERENCES tlayout_template(`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index c2868a214e..ba9c4f66da 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -139,6 +139,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('cr_incident_status', ''),
('cr_incident_title', ''),
('cr_incident_content', ''),
+('sample_agent', '0'),
('gotty', '/usr/bin/gotty');
UNLOCK TABLES;
@@ -269,7 +270,7 @@ INSERT INTO `torigen` VALUES
--
-- Identifiers 30 and 31 are reserved for Enterprise data types
-INSERT INTO `ttipo_modulo` VALUES
+INSERT INTO `ttipo_modulo` VALUES
(1,'generic_data',0,'Generic numeric','mod_data.png'),
(2,'generic_proc',1,'Generic boolean','mod_proc.png'),
(3,'generic_data_string',2,'Generic string','mod_string.png'),
@@ -284,19 +285,15 @@ INSERT INTO `ttipo_modulo` VALUES
(15,'remote_snmp',3,'Remote SNMP network agent, numeric data','mod_snmp_data.png'),
(16,'remote_snmp_inc',3,'Remote SNMP network agent, incremental data','mod_snmp_inc.png'),
(17,'remote_snmp_string',5,'Remote SNMP network agent, alphanumeric data','mod_snmp_string.png'),
-(18,'remote_snmp_proc',4,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'),
-(21,'async_proc', 7, 'Asyncronous proc data', 'mod_async_proc.png'),
-(22,'async_data', 6, 'Asyncronous numeric data', 'mod_async_data.png'),
+(18,'remote_snmp_proc',4,'Remote SNMP network agent, boolean data','mod_snmp_proc.png'),
+(21,'async_proc', 7, 'Asyncronous proc data', 'mod_async_proc.png'),
+(22,'async_data', 6, 'Asyncronous numeric data', 'mod_async_data.png'),
(23,'async_string', 8, 'Asyncronous string data', 'mod_async_string.png'),
(25,'web_analysis', 8, 'Web analysis data', 'module-wux.png'),
(30,'web_data',9,'Remote HTTP module to check latency','mod_web_data.png'),
(31,'web_proc',9,'Remote HTTP module to check server response','mod_web_proc.png'),
(32,'web_content_data',9,'Remote HTTP module to retrieve numeric data','mod_web_data.png'),
(33,'web_content_string',9,'Remote HTTP module to retrieve string data','mod_web_data.png'),
-(34,'remote_cmd', 10, 'Remote execution, numeric data', 'mod_remote_cmd.png'),
-(35,'remote_cmd_proc', 10, 'Remote execution, boolean data', 'mod_remote_cmd_proc.png'),
-(36,'remote_cmd_string', 10, 'Remote execution, alphanumeric data', 'mod_remote_cmd_string.png'),
-(37,'remote_cmd_inc', 10, 'Remote execution, incremental data', 'mod_remote_cmd_inc.png'),
(100,'keep_alive',-1,'KeepAlive','mod_keepalive.png');
--
diff --git a/pandora_server/FreeBSD/pandora_server.conf.new b/pandora_server/FreeBSD/pandora_server.conf.new
index 93d9abbc75..01ff859fa5 100644
--- a/pandora_server/FreeBSD/pandora_server.conf.new
+++ b/pandora_server/FreeBSD/pandora_server.conf.new
@@ -348,6 +348,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/NetBSD/pandora_server.conf.new b/pandora_server/NetBSD/pandora_server.conf.new
index 5f38a678da..66743aee36 100644
--- a/pandora_server/NetBSD/pandora_server.conf.new
+++ b/pandora_server/NetBSD/pandora_server.conf.new
@@ -340,6 +340,15 @@ restart_delay 60
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 1
diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server
index a367eb7bca..1ce3e3da5e 100755
--- a/pandora_server/bin/pandora_server
+++ b/pandora_server/bin/pandora_server
@@ -382,6 +382,16 @@ sub pandora_server_tasks ($) {
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
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 1a8ca659a0..159990b9d6 100644
--- a/pandora_server/lib/PandoraFMS/Config.pm
+++ b/pandora_server/lib/PandoraFMS/Config.pm
@@ -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";
@@ -398,6 +398,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
@@ -950,6 +956,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 09ef9d7878..2cfb8a056b 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;
@@ -248,6 +251,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
@@ -5236,6 +5240,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/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl
index 3b72f91063..a3ffd61ecb 100755
--- a/pandora_server/util/pandora_manage.pl
+++ b/pandora_server/util/pandora_manage.pl
@@ -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;
}