diff --git a/README.md b/README.md
index 5e3a56c5df..3187ac8487 100644
--- a/README.md
+++ b/README.md
@@ -8,31 +8,34 @@ Pandora FMS is a monitoring software for IT infrastructure management which incl
For community support you can visit our forums at http://forums.pandorafms.org. Visit our community page at http://pandorafms.org and if you need commercial information or/and professional support visit http://pandorafms.com.
-
### How to install Pandora FMS
Installing Pandora FMS is a very easy task. Please visit our wiki and follow all the steps described for a quick and proper installation. http://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Installing
### What is Pandora FMS?
-Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
+
+Pandora FMS is a monitoring application to watch systems and applications that allows to know the status of any element of the business systems. Pandora FMS watches your hardware, software, your multilayer system and, of course, your OS. Pandora FMS can detect if a network interface is down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails or when Google stock value drops below 330 US\$. Pandora FMS will fit your systems and requirements, because it has been designed to be open, modular, multiplattform and easy to customize.
### Other things Pandora FMS can do
-Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
+
+Pandora FMS is a monitoring tool that not only measures if a parameter is right or wrong. Pandora FMS can quantify the state (right or wrong), or store a value (numeric or alphanumeric) for months if necessary. Pandora FMS can measure performances, compare values among different systems and set alarms over thresholds. Pandora FMS works against a Database so it can generate reports, statistics, SLA and meausre anything: OS, applications and hardware systems, such as firewalls, proxies, Databases, web servers, VPN, routers, switches, processes, services, [remote accesses to servers](https://pandorafms.com/server-monitoring/), etc. Everything integrated in an open and distributed architecture. Pandora FMS can be deployed over any OS, with specific agents for each platform. There are agents for Windows (2000, XP, 2003), GNU/Linux, Solaris, HP-UX, BSD, AIX, IPSO and OpenWRT. Pandora FMS not only gathers information through its agents, but it can also monitor any hardware system with TCP/IP connectivity, such as load balancing systems, routers, switches or printers, through SNMP and TCP/ICMP checks.
### Main features
-* Network monitoring
-* WMI monitoring
-* Agent monitoring (for all OS)
-* Graphical reporting, based on it's own SQL backend
-* SLA, and ITIL KPI metrics on reporting
-* Status & Performance monitoring
-* GIS tracking and viewing
-* Inventory management (Local and remote)
-* User defined visual console screens and Dashboards WYSIWYG
-* Very high capacity (Thousands of devices)
-* Multiuser, several levels of ACL management.
+
+- Network monitoring
+- WMI monitoring
+- Agent monitoring (for all OS)
+- Graphical reporting, based on it's own SQL backend
+- SLA, and ITIL KPI metrics on reporting
+- Status & Performance monitoring
+- GIS tracking and viewing
+- Inventory management (Local and remote)
+- User defined visual console screens and Dashboards WYSIWYG
+- Very high capacity (Thousands of devices)
+- Multiuser, several levels of ACL management.
### Screenshots
+
![screenshot 1](http://wolf359.artica.es/public_images/captura-pantalla-pandora3.png)
diff --git a/pandora_console/extras/mr/41.sql b/pandora_console/extras/mr/41.sql
index 58cf54f69f..6c875c832d 100644
--- a/pandora_console/extras/mr/41.sql
+++ b/pandora_console/extras/mr/41.sql
@@ -1,5 +1,8 @@
START TRANSACTION;
+ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
+ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
+
ALTER TABLE `talert_templates` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_actions` ADD COLUMN `previous_name` text;
ALTER TABLE `talert_commands` ADD COLUMN `previous_name` text;
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index d741afb9ae..a8e1deae9a 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -849,6 +849,7 @@ ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1)
MODIFY COLUMN `visual_format` tinyint(1) unsigned NOT NULL DEFAULT '0';
ALTER TABLE `treport_content_template` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content_template` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
+ALTER TABLE `treport_content_template` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
-- ----------------------------------------------------------------------
-- Table `tnews`
@@ -1351,13 +1352,13 @@ ALTER TABLE `ttag` ADD COLUMN `previous_name` text NULL;
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
-INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 40);
+INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 41);
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_docs_logo', 'default_docs.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_support_logo', 'default_support.png');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('custom_logo_white_bg_preview', 'pandora_logo_head_white_bg.png');
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
-INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '748');
+INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '749');
INSERT INTO `tconfig` (`token`, `value`) VALUES ('status_monitor_fields', 'policy,agent,data_type,module_name,server_type,interval,status,graph,warn,data,timestamp');
UPDATE `tconfig` SET `value` = 'mini_severity,evento,id_agente,estado,timestamp' WHERE `token` LIKE 'event_fields';
DELETE FROM `tconfig` WHERE `token` LIKE 'integria_api_password';
@@ -1673,6 +1674,7 @@ ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned
MODIFY COLUMN `failover_type` tinyint(1) NULL DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `landscape` tinyint(1) UNSIGNED NOT NULL default 0;
ALTER TABLE `treport_content` ADD COLUMN `pagebreak` tinyint(1) UNSIGNED NOT NULL default 0;
+ALTER TABLE `treport_content` add column `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tmodule_relationship`
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 2bfd736fe3..5228e08507 100755
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -107,6 +107,7 @@ $saturday = true;
$sunday = true;
$time_from = '00:00:00';
$time_to = '00:00:00';
+$compare_work_time = false;
$show_graph = 0;
$sla_sorted_by = 0;
$id_agents = '';
@@ -315,6 +316,7 @@ switch ($action) {
$sunday = $item['sunday'];
$time_from = $item['time_from'];
$time_to = $item['time_to'];
+ $compare_work_time = $item['compare_work_time'];
$show_graph = $item['show_graph'];
$priority_mode = isset($style['priority_mode']) ? $style['priority_mode'] : REPORT_PRIORITY_MODE_OK;
// 'top_n' filed will be reused for SLA sort option.
@@ -622,6 +624,7 @@ switch ($action) {
$sunday = $item['sunday'];
$time_from = $item['time_from'];
$time_to = $item['time_to'];
+ $compare_work_time = $item['compare_work_time'];
$total_time = $item['total_time'];
$time_failed = $item['time_failed'];
$time_in_ok_status = $item['time_in_ok_status'];
@@ -1213,6 +1216,22 @@ $class = 'databox filters';
?>
+
+
+
+ |
+
+
+ |
+
@@ -4830,9 +4849,9 @@ function chooseType() {
$("#row_failover_mode").hide();
$("#row_failover_type").hide();
$("#row_working_time").hide();
+ $("#row_working_time_compare").hide();
$("#row_only_display_wrong").hide();
$("#row_combo_module").hide();
- $("#row_only_display_wrong").hide();
$("#row_group_by_agent").hide();
$("#general_list").hide();
$("#row_order_uptodown").hide();
@@ -4988,6 +5007,7 @@ function chooseType() {
$("#row_period").show();
$("#sla_list").show();
$("#row_working_time").show();
+ $("#row_working_time_compare").show();
$("#row_only_display_wrong").show();
$("#row_show_graph").show();
$("#row_sort").show();
@@ -5000,6 +5020,7 @@ function chooseType() {
$("#row_period").show();
$("#sla_list").show();
$("#row_working_time").show();
+ $("#row_working_time_compare").show();
$("#row_historical_db_check").hide();
$("#row_priority_mode").show();
$("#row_failover_mode").show();
@@ -5278,6 +5299,7 @@ function chooseType() {
$("#row_show_address_agent").show();
$("#row_show_resume").show();
$("#row_working_time").show();
+ $("#row_working_time_compare").show();
$('#row_hide_notinit_agents').show();
$('#row_select_fields').show();
if($("#checkbox-checkbox_show_resume").is(":checked")){
diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php
index fae9e6aa18..b88cc5d64e 100755
--- a/pandora_console/godmode/reporting/reporting_builder.php
+++ b/pandora_console/godmode/reporting/reporting_builder.php
@@ -1382,7 +1382,10 @@ switch ($action) {
$values['description'] = get_parameter('description');
$values['type'] = get_parameter('type', null);
$values['recursion'] = get_parameter('recursion', null);
- $values['show_extended_events'] = get_parameter('include_extended_events', null);
+ $values['show_extended_events'] = get_parameter(
+ 'include_extended_events',
+ null
+ );
$label = get_parameter('label', '');
@@ -1710,6 +1713,10 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
+ $values['compare_work_time'] = get_parameter(
+ 'compare_work_time',
+ 0
+ );
$values['total_time'] = get_parameter('total_time', 0);
$values['time_failed'] = get_parameter(
'time_failed',
@@ -2339,7 +2346,6 @@ switch ($action) {
'checkbox_only_display_wrong',
0
);
-
$values['monday'] = get_parameter('monday', 0);
$values['tuesday'] = get_parameter('tuesday', 0);
$values['wednesday'] = get_parameter('wednesday', 0);
@@ -2347,6 +2353,10 @@ switch ($action) {
$values['friday'] = get_parameter('friday', 0);
$values['saturday'] = get_parameter('saturday', 0);
$values['sunday'] = get_parameter('sunday', 0);
+ $values['compare_work_time'] = get_parameter(
+ 'compare_work_time',
+ 0
+ );
$values['total_time'] = get_parameter('total_time', 0);
$values['time_failed'] = get_parameter(
'time_failed',
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index 33729dc5b0..a27be4f530 100755
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -863,6 +863,17 @@ function reporting_make_reporting_data(
}
+/**
+ * Report SLA.
+ *
+ * @param array $report Data report.
+ * @param array $content Content for report.
+ * @param null|string $type Type report.
+ * @param null|integer $force_width_chart Size.
+ * @param null|integer $force_height_chart Size.
+ *
+ * @return array Return array for draw report SLA.
+ */
function reporting_SLA(
$report,
$content,
@@ -926,7 +937,7 @@ function reporting_SLA(
include_once $config['homedir'].'/include/functions_planned_downtimes.php';
$metaconsole_on = is_metaconsole();
- // checking if needed to show graph or table.
+ // Checking if needed to show graph or table.
if ($content['show_graph'] == 0 || $content['show_graph'] == 1) {
$show_table = 1;
} else {
@@ -947,6 +958,18 @@ function reporting_SLA(
$sla_showed = [];
$sla_showed_values = [];
+ if ((bool) $content['compare_work_time'] === true) {
+ $slas_compare = [];
+ foreach ($slas as $sla) {
+ $sla['compare'] = 1;
+ $slas_compare[] = $sla;
+ $sla['compare'] = 0;
+ $slas_compare[] = $sla;
+ }
+
+ $slas = $slas_compare;
+ }
+
foreach ($slas as $sla) {
$server_name = $sla['server_name'];
// Metaconsole connection.
@@ -1000,26 +1023,51 @@ function reporting_SLA(
// Call functions sla.
$sla_array = [];
- $sla_array = reporting_advanced_sla(
- $sla['id_agent_module'],
- ($report['datetime'] - $content['period']),
- $report['datetime'],
- $sla['sla_min'],
- $sla['sla_max'],
- $inverse_interval,
- [
- '1' => $content['sunday'],
- '2' => $content['monday'],
- '3' => $content['tuesday'],
- '4' => $content['wednesday'],
- '5' => $content['thursday'],
- '6' => $content['friday'],
- '7' => $content['saturday'],
- ],
- $content['time_from'],
- $content['time_to'],
- $slice
- );
+ if (isset($sla['compare']) === false
+ || empty($sla['compare']) === true
+ ) {
+ $sla_array = reporting_advanced_sla(
+ $sla['id_agent_module'],
+ ($report['datetime'] - $content['period']),
+ $report['datetime'],
+ $sla['sla_min'],
+ $sla['sla_max'],
+ $inverse_interval,
+ [
+ '1' => $content['sunday'],
+ '2' => $content['monday'],
+ '3' => $content['tuesday'],
+ '4' => $content['wednesday'],
+ '5' => $content['thursday'],
+ '6' => $content['friday'],
+ '7' => $content['saturday'],
+ ],
+ $content['time_from'],
+ $content['time_to'],
+ $slice
+ );
+ } else {
+ $sla_array = reporting_advanced_sla(
+ $sla['id_agent_module'],
+ ($report['datetime'] - $content['period']),
+ $report['datetime'],
+ $sla['sla_min'],
+ $sla['sla_max'],
+ $inverse_interval,
+ [
+ '1' => 1,
+ '2' => 1,
+ '3' => 1,
+ '4' => 1,
+ '5' => 1,
+ '6' => 1,
+ '7' => 1,
+ ],
+ '00:00:00',
+ '00:00:00',
+ $slice
+ );
+ }
if ($metaconsole_on) {
// Restore db connection.
@@ -1093,6 +1141,14 @@ function reporting_SLA(
$data['sla_limit'] = $sla['sla_limit'];
$data['dinamic_text'] = $dinamic_text;
+ if (isset($sla['compare']) === false
+ || empty($sla['compare']) === true
+ ) {
+ $data['compare'] = false;
+ } else {
+ $data['compare'] = true;
+ }
+
if (isset($sla_array[0])) {
$data['time_total'] = 0;
$data['time_ok'] = 0;
@@ -1246,6 +1302,15 @@ function reporting_SLA(
$sla['id_agent_module']
)
);
+
+ if (isset($sla['compare']) === false
+ || empty($sla['compare']) === true
+ ) {
+ $dataslice['compare'] = false;
+ } else {
+ $dataslice['compare'] = true;
+ }
+
$dataslice['sla_value'] = $data['sla_value'];
$dataslice['order'] = $data['sla_value'];
@@ -1259,7 +1324,7 @@ function reporting_SLA(
$content['time_from'],
$content['time_to'],
100,
- 70,
+ ((bool) $dataslice['compare'] === true) ? 50 : 80,
$urlImage,
$ttl,
$array_result,
@@ -6372,9 +6437,14 @@ function reporting_advanced_sla(
/**
- * reporting_availability
+ * Report Availability.
*
- * Generates a structure the report.
+ * @param array $report Data report.
+ * @param array $content Content for report.
+ * @param null|string $date Date.
+ * @param null|integer $time Time.
+ *
+ * @return array Return array for draw report Availability.
*/
function reporting_availability($report, $content, $date=false, $time=false)
{
@@ -6417,7 +6487,12 @@ function reporting_availability($report, $content, $date=false, $time=false)
$count = 0;
if ($content['failover_mode']) {
- $availability_graph_data = reporting_availability_graph($report, $content, false, true);
+ $availability_graph_data = reporting_availability_graph(
+ $report,
+ $content,
+ false,
+ true
+ );
$data = $availability_graph_data['data'];
foreach ($data as $key => $item_data) {
@@ -6428,7 +6503,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
$data[$key]['availability_item'] = $item_data['module'];
$text = $item_data['agent'].' ('.$item_data['module'].')';
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
- if (is_null($min)) {
+ if (isset($min) === false) {
$min = $percent_ok;
$min_text = $text;
} else {
@@ -6438,7 +6513,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
}
- if (is_null($max)) {
+ if (isset($max) === false) {
$max = $percent_ok;
$max_text = $text;
} else {
@@ -6461,9 +6536,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
$sql = sprintf(
- '
- SELECT id_agent_module, id_agent_module_failover,
- server_name, operation
+ 'SELECT id_agent_module,
+ id_agent_module_failover,
+ server_name,
+ operation
FROM treport_content_item
WHERE id_report_content = %d',
$content['id_rc']
@@ -6481,8 +6557,16 @@ function reporting_availability($report, $content, $date=false, $time=false)
$aux_id_agents = $agents;
$i = 0;
foreach ($items as $item) {
- $utimestamp = db_get_value('utimestamp', 'tagente_datos', 'id_agente_modulo', $item['id_agent_module'], true);
- if (($utimestamp === false) || (intval($utimestamp) > intval($datetime_to))) {
+ $utimestamp = db_get_value(
+ 'utimestamp',
+ 'tagente_datos',
+ 'id_agente_modulo',
+ $item['id_agent_module'],
+ true
+ );
+ if (($utimestamp === false)
+ || (intval($utimestamp) > intval($datetime_to))
+ ) {
unset($items[$i]);
}
@@ -6490,14 +6574,29 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
}
- if (!empty($items)) {
+ if (empty($items) === false
+ && (bool) $content['compare_work_time'] === true
+ ) {
+ $items_compare = [];
foreach ($items as $item) {
- // aaMetaconsole connection
+ $item['compare'] = 1;
+ $items_compare[] = $item;
+ $item['compare'] = 0;
+ $items_compare[] = $item;
+ }
+
+ $items = $items_compare;
+ }
+
+ if (empty($items) === false) {
+ foreach ($items as $item) {
+ // Metaconsole connection.
$server_name = $item['server_name'];
- if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
+ if (($config['metaconsole'] == 1)
+ && $server_name != '' && is_metaconsole()
+ ) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
- // ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@@ -6505,8 +6604,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
if (modules_is_disable_agent($item['id_agent_module'])
|| modules_is_not_init($item['id_agent_module'])
) {
- // Restore dbconnection
- if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
+ // Restore dbconnection.
+ if (($config['metaconsole'] == 1)
+ && $server_name != '' && is_metaconsole()
+ ) {
metaconsole_restore_db();
}
@@ -6517,62 +6618,83 @@ function reporting_availability($report, $content, $date=false, $time=false)
$text = '';
- $row['data'] = reporting_advanced_sla(
- $item['id_agent_module'],
- ($report['datetime'] - $content['period']),
- $report['datetime'],
- null,
- // min_value -> dynamic
- null,
- // max_value -> dynamic
- null,
- // inverse_interval -> dynamic
- [
- '1' => $content['sunday'],
- '2' => $content['monday'],
- '3' => $content['tuesday'],
- '4' => $content['wednesday'],
- '5' => $content['thursday'],
- '6' => $content['friday'],
- '7' => $content['saturday'],
- ],
- $content['time_from'],
- $content['time_to']
- );
+ if (isset($item['compare']) === true
+ && empty($item['compare']) === true
+ ) {
+ // Intervals is dinamic.
+ $row['data'] = reporting_advanced_sla(
+ $item['id_agent_module'],
+ ($report['datetime'] - $content['period']),
+ $report['datetime'],
+ null,
+ null,
+ null,
+ [
+ '1' => $content['sunday'],
+ '2' => $content['monday'],
+ '3' => $content['tuesday'],
+ '4' => $content['wednesday'],
+ '5' => $content['thursday'],
+ '6' => $content['friday'],
+ '7' => $content['saturday'],
+ ],
+ $content['time_from'],
+ $content['time_to']
+ );
+ } else {
+ // Intervals is dinamic.
+ $row['data'] = reporting_advanced_sla(
+ $item['id_agent_module'],
+ ($report['datetime'] - $content['period']),
+ $report['datetime']
+ );
+ }
// HACK it is saved in show_graph field.
- // Show interfaces instead the modules
+ // Show interfaces instead the modules.
if ($content['show_graph']) {
- $text = $row['data']['availability_item'] = agents_get_address(
+ $row['data']['availability_item'] = agents_get_address(
modules_get_agentmodule_agent($item['id_agent_module'])
);
if (empty($text)) {
- $text = $row['data']['availability_item'] = __('No Address');
+ $row['data']['availability_item'] = __('No Address');
}
} else {
- $text = $row['data']['availability_item'] = modules_get_agentmodule_name(
+ $row['data']['availability_item'] = modules_get_agentmodule_name(
$item['id_agent_module']
);
}
+ $text = $row['data']['availability_item'];
+
$row['data']['agent'] = modules_get_agentmodule_agent_alias(
$item['id_agent_module']
);
+ if (isset($item['compare']) === true
+ && empty($item['compare']) === true
+ ) {
+ $row['data']['compare'] = false;
+ } else {
+ $row['data']['compare'] = true;
+ }
+
$text = $row['data']['agent'].' ('.$text.')';
- // Restore dbconnection
- if (($config['metaconsole'] == 1) && $server_name != '' && is_metaconsole()) {
+ // Restore dbconnection.
+ if (($config['metaconsole'] == 1)
+ && $server_name != '' && is_metaconsole()
+ ) {
metaconsole_restore_db();
}
- // find order
+ // Find order.
$row['data']['order'] = $row['data']['SLA'];
$percent_ok = $row['data']['SLA'];
$avg = ((($avg * $count) + $percent_ok) / ($count + 1));
- if (is_null($min)) {
+ if (isset($min) === false) {
$min = $percent_ok;
$min_text = $text;
} else {
@@ -6582,7 +6704,7 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
}
- if (is_null($max)) {
+ if (isset($max) === false) {
$max = $percent_ok;
$max_text = $text;
} else {
@@ -6650,6 +6772,10 @@ function reporting_availability($report, $content, $date=false, $time=false)
$data = $temp;
break;
+
+ default:
+ // Not possible.
+ break;
}
}
}
@@ -6680,17 +6806,22 @@ function reporting_availability($report, $content, $date=false, $time=false)
}
- /**
- * Reporting_availability_graph.
- *
- * @param array $report Info report.
- * @param array $content Content data.
- * @param boolean $pdf Output type PDF.
- *
- * @return array Generates a structure the report.
- */
-function reporting_availability_graph($report, $content, $pdf=false, $failover=false)
-{
+/**
+ * Reporting_availability_graph.
+ *
+ * @param array $report Info report.
+ * @param array $content Content data.
+ * @param null|boolean $pdf Output type PDF.
+ * @param null|boolean $failover Failover mode.
+ *
+ * @return array Generates a structure the report.
+ */
+function reporting_availability_graph(
+ $report,
+ $content,
+ $pdf=false,
+ $failover=false
+) {
global $config;
$return = [];
$return['type'] = 'availability_graph';
@@ -6756,6 +6887,20 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
$priority_mode = $content['style']['priority_mode'];
+ if (empty($slas) === false && empty($content['failover_mode']) === true
+ && (bool) $content['compare_work_time'] === true
+ ) {
+ $sla_compare = [];
+ foreach ($slas as $sla) {
+ $sla['compare'] = 1;
+ $sla_compare[] = $sla;
+ $sla['compare'] = 0;
+ $sla_compare[] = $sla;
+ }
+
+ $slas = $sla_compare;
+ }
+
foreach ($slas as $sla) {
$server_name = $sla['server_name'];
@@ -6799,15 +6944,27 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
$slice = ($content['period'] / $module_interval);
$data_combined = [];
- foreach ($sla_failover as $k_sla => $v_sla) {
- $sla_array = data_db_uncompress_module(
- $v_sla,
- $content,
- $report['datetime'],
- $slice
- );
+ if ((bool) $content['compare_work_time'] === true) {
+ $sla_compare = [];
+ foreach ($sla_failover as $k_sla => $sla) {
+ $sla['compare'] = 1;
+ $sla_compare[$k_sla.'_compare'] = $sla;
+ $sla['compare'] = 0;
+ $sla_compare[$k_sla] = $sla;
+ }
+ $sla_failover = $sla_compare;
+ }
+
+ foreach ($sla_failover as $k_sla => $v_sla) {
if ($content['failover_type'] == REPORT_FAILOVER_TYPE_NORMAL) {
+ $sla_array = data_compare_24x7(
+ $v_sla,
+ $content,
+ $report['datetime'],
+ $slice
+ );
+
$return = prepare_data_for_paint(
$v_sla,
$sla_array,
@@ -6819,53 +6976,37 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
);
}
- $data_combined[] = $sla_array;
+ if (isset($v_sla['compare']) === true
+ && empty($v_sla['compare']) === false
+ ) {
+ $data_combined_compare[] = $sla_array;
+ } else {
+ $data_combined[] = $sla_array;
+ }
+ }
+
+ if (isset($data_combined_compare) === true
+ && is_array($data_combined_compare) === true
+ && count($data_combined_compare) > 0
+ ) {
+ $return = prepare_data_for_paint(
+ $sla,
+ data_combined_failover($data_combined_compare),
+ $content,
+ $report['datetime'],
+ $return,
+ 'result_compare',
+ $pdf
+ );
}
if (isset($data_combined) === true
&& is_array($data_combined) === true
&& count($data_combined) > 0
) {
- $count_failover = count($data_combined);
-
- $data_a = $data_combined[0];
- for ($i = 1; $count_failover > $i; $i++) {
- $data_a = array_map(
- function ($primary, $failover) {
- $return_map = [];
- if ($primary['date_from'] === $failover['date_from']
- && $primary['date_to'] === $failover['date_to']
- ) {
- if ($primary['time_ok'] < $failover['time_ok']) {
- $primary['time_total'] = $failover['time_total'];
- $primary['time_ok'] = $failover['time_ok'];
- $primary['time_error'] = $failover['time_error'];
- $primary['time_unknown'] = $failover['time_unknown'];
- $primary['time_not_init'] = $failover['time_not_init'];
- $primary['time_downtime'] = $failover['time_downtime'];
- $primary['time_out'] = $failover['time_out'];
- $primary['checks_total'] = $failover['checks_total'];
- $primary['checks_ok'] = $failover['checks_ok'];
- $primary['checks_error'] = $failover['checks_error'];
- $primary['checks_unknown'] = $failover['checks_unknown'];
- $primary['checks_not_init'] = $failover['checks_not_init'];
- $primary['SLA'] = $failover['SLA'];
- $primary['sla_fixed'] = $failover['sla_fixed'];
- }
-
- $return_map = $primary;
- }
-
- return $return_map;
- },
- $data_a,
- $data_combined[($i)]
- );
- }
-
$return = prepare_data_for_paint(
$sla,
- $data_a,
+ data_combined_failover($data_combined),
$content,
$report['datetime'],
$return,
@@ -6874,10 +7015,11 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
);
}
} else {
- $sla_array = data_db_uncompress_module(
+ $sla_array = data_compare_24x7(
$sla,
$content,
- $report['datetime']
+ $report['datetime'],
+ 0
);
$return = prepare_data_for_paint(
@@ -6991,6 +7133,97 @@ function reporting_availability_graph($report, $content, $pdf=false, $failover=f
}
+/**
+ * Combined data modules failover.
+ *
+ * @param array $data Data.
+ *
+ * @return array
+ */
+function data_combined_failover(array $data)
+{
+ $count_failover = count($data);
+
+ $result = $data[0];
+ for ($i = 1; $count_failover > $i; $i++) {
+ $result = array_map(
+ function ($primary, $failover) {
+ $return_map = [];
+ if ($primary['date_from'] === $failover['date_from']
+ && $primary['date_to'] === $failover['date_to']
+ ) {
+ if ($primary['time_ok'] < $failover['time_ok']) {
+ $primary['time_total'] = $failover['time_total'];
+ $primary['time_ok'] = $failover['time_ok'];
+ $primary['time_error'] = $failover['time_error'];
+ $primary['time_unknown'] = $failover['time_unknown'];
+ $primary['time_not_init'] = $failover['time_not_init'];
+ $primary['time_downtime'] = $failover['time_downtime'];
+ $primary['time_out'] = $failover['time_out'];
+ $primary['checks_total'] = $failover['checks_total'];
+ $primary['checks_ok'] = $failover['checks_ok'];
+ $primary['checks_error'] = $failover['checks_error'];
+ $primary['checks_unknown'] = $failover['checks_unknown'];
+ $primary['checks_not_init'] = $failover['checks_not_init'];
+ $primary['SLA'] = $failover['SLA'];
+ $primary['sla_fixed'] = $failover['sla_fixed'];
+ }
+
+ $return_map = $primary;
+ }
+
+ return $return_map;
+ },
+ $result,
+ $data[($i)]
+ );
+ }
+
+ return $result;
+}
+
+
+/**
+ * Prepare data compare option.
+ *
+ * @param array $value Value data.
+ * @param array $content Content report.
+ * @param string $datetime Time.
+ * @param integer|null $slice Number slices.
+ *
+ * @return array
+ */
+function data_compare_24x7(
+ array $value,
+ array $content,
+ string $datetime,
+ ?int $slice=0
+) {
+ if (isset($value['compare']) === true
+ && empty($value['compare']) === false
+ ) {
+ $content['sunday'] = 1;
+ $content['monday'] = 1;
+ $content['tuesday'] = 1;
+ $content['wednesday'] = 1;
+ $content['thursday'] = 1;
+ $content['friday'] = 1;
+ $content['saturday'] = 1;
+ $content['time_from'] = '00:00';
+ $content['time_to'] = '23:59';
+ }
+
+ $sla_array = data_db_uncompress_module(
+ $value,
+ $content,
+ $datetime,
+ $slice
+ );
+
+ return $sla_array;
+}
+
+
/**
* Return data db uncompress for module.
*
@@ -7220,6 +7453,15 @@ function prepare_data_for_paint(
$data['sla_value'] = $sla_array['SLA'];
}
+ $data['compare'] = 0;
+ if (isset($sla['compare']) === true) {
+ if ((bool) $sla['compare'] === true) {
+ $data['compare'] = 1;
+ } else {
+ $data['compare'] = 2;
+ }
+ }
+
// Checks whether or not it meets the SLA.
if ($data['sla_value'] >= $sla['sla_limit']) {
$data['sla_status'] = 1;
@@ -7281,8 +7523,16 @@ function prepare_data_for_paint(
$dataslice['sla_value'] = $data['sla_value'];
$height = 80;
- if ($failover !== '' && $failover !== 'result') {
+ if (($failover !== ''
+ && $failover !== 'result')
+ || (bool) $sla['compare'] === true
+ ) {
$height = 50;
+ if ($failover !== '' && (bool) $sla['compare'] === true
+ || $failover === 'result_compare'
+ ) {
+ $height = 40;
+ }
}
$dataslice['chart'] = graph_sla_slicebar(
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 29a5b878c7..533c8680ec 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -450,35 +450,35 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$interval_description = $config['interval_description'];
- if ($mini) {
+ if ($mini === true) {
$font_size = '1.5em';
} else {
$font_size = $config['font_size_item_report'].'em';
}
$metaconsole_on = is_metaconsole();
- if ($metaconsole_on) {
+ if ($metaconsole_on === true) {
$src = '../../';
} else {
$src = $config['homeurl'];
}
- if (!empty($item['failed'])) {
+ if (empty($item['failed']) === false) {
$table->colspan['sla']['cell'] = 3;
$table->data['sla']['cell'] = $item['failed'];
} else {
- if (!empty($item['planned_downtimes'])) {
+ if (empty($item['planned_downtimes']) === false) {
$downtimes_table = reporting_html_planned_downtimes_table(
$item['planned_downtimes']
);
- if (!empty($downtimes_table)) {
+ if (empty($downtimes_table) === false) {
$table->colspan['planned_downtime']['cell'] = 3;
$table->data['planned_downtime']['cell'] = $downtimes_table;
}
}
- if (isset($item['data'])) {
+ if (isset($item['data']) === true) {
$table1 = new stdClass();
$table1->width = '99%';
@@ -571,11 +571,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table3->headstyle[5] = 'text-align: right';
foreach ($item['data'] as $sla) {
- if (isset($sla)) {
+ if (isset($sla) === true) {
// First_table.
$row = [];
$row[] = $sla['agent'];
- $row[] = $sla['module'];
+ if ((bool) $sla['compare'] === false) {
+ $row[] = $sla['module'];
+ } else {
+ $row[] = $sla['module'].' ('.__('24 x 7').')';
+ }
if (is_numeric($sla['dinamic_text'])) {
$row[] = sla_truncate(
@@ -608,7 +612,14 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
// Second table for time globals.
$row2 = [];
- $row2[] = $sla['agent'].' -- ['.$sla['module'].']';
+ if ((bool) $sla['compare'] === false) {
+ $row2[] = $sla['agent'].' -- ['.$sla['module'].']';
+ } else {
+ $name_agent_module = $sla['agent'];
+ $name_agent_module .= ' -- ['.$sla['module'];
+ $name_agent_module .= ' ('.__('24 x 7').')]';
+ $row2[] = $name_agent_module;
+ }
if ($sla['time_total'] != 0) {
$row2[] = human_time_description_raw(
@@ -672,7 +683,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
// Third table for checks globals.
$row3 = [];
- $row3[] = $sla['agent'].' -- ['.$sla['module'].']';
+ if ((bool) $sla['compare'] === false) {
+ $row3[] = $sla['agent'].' -- ['.$sla['module'].']';
+ } else {
+ $name_agent_module = $sla['agent'];
+ $name_agent_module .= ' -- ['.$sla['module'];
+ $name_agent_module .= ' ('.__('24 x 7').')]';
+ $row3[] = $name_agent_module;
+ }
+
$row3[] = $sla['checks_total'];
$row3[] = ''.$sla['checks_error'].'';
$row3[] = ''.$sla['checks_ok'].'';
@@ -726,7 +745,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
}
} else {
$table->colspan['error']['cell'] = 3;
- $table->data['error']['cell'] = __('There are no Agent/Modules defined');
+ $table->data['error']['cell'] = __(
+ 'There are no Agent/Modules defined'
+ );
}
if (empty($item['charts']) === false) {
@@ -741,8 +762,15 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
$table1->data = [];
foreach ($item['charts'] as $chart) {
+ $name_agent_module = $chart['agent'];
+ $name_agent_module .= '
';
+ $name_agent_module .= $chart['module'];
+ if ((bool) $chart['compare'] === true) {
+ $name_agent_module .= ' ('.__('24 x 7').')';
+ }
+
$table1->data[] = [
- $chart['agent'].'
'.$chart['module'],
+ $name_agent_module,
$chart['chart'],
];
}
@@ -3216,13 +3244,13 @@ function reporting_html_availability($table, $item, $pdf=0)
$font_size = $config['font_size_item_report'].'em';
$interval_description = $config['interval_description'];
- if (!empty($item['data'])) {
+ if (empty($item['data']) === false) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = [];
$table1->head = [];
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table1->head[-1] = __('Failover');
}
@@ -3274,7 +3302,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->head[8] = __('% Ok');
$table1->headstyle = [];
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table1->headstyle[-1] = 'text-align: left';
}
@@ -3288,7 +3316,7 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->headstyle[7] = 'text-align: right';
$table1->headstyle[8] = 'text-align: right';
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table1->style[-1] = 'text-align: left';
}
@@ -3301,13 +3329,14 @@ function reporting_html_availability($table, $item, $pdf=0)
$table1->style[6] = 'text-align: center';
$table1->style[7] = 'text-align: right';
$table1->style[8] = 'text-align: right';
+ $table1->style[9] = 'text-align: right';
$table2 = new stdClass();
$table2->width = '99%';
$table2->data = [];
$table2->head = [];
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table2->head[-1] = __('Failover');
}
@@ -3345,44 +3374,73 @@ function reporting_html_availability($table, $item, $pdf=0)
}
$table2->headstyle = [];
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table2->headstyle[-1] = 'text-align: left';
}
$table2->headstyle[0] = 'text-align: left';
$table2->headstyle[1] = 'text-align: left';
- $table2->headstyle[2] = 'text-align: right';
+ $table2->headstyle[2] = 'text-align: left';
+ if (isset($item['data'][0]['failover']) === true) {
+ $table2->headstyle[2] = 'text-align: right';
+ }
+
$table2->headstyle[3] = 'text-align: right';
$table2->headstyle[4] = 'text-align: right';
$table2->headstyle[5] = 'text-align: right';
- if (isset($item['data'][0]['failover'])) {
+ if (isset($item['data'][0]['failover']) === true) {
$table2->style[-1] = 'text-align: left';
}
$table2->style[0] = 'text-align: left';
$table2->style[1] = 'text-align: left';
- $table2->style[2] = 'text-align: right';
+ $table2->style[2] = 'text-align: left';
$table2->style[3] = 'text-align: right';
$table2->style[4] = 'text-align: right';
$table2->style[5] = 'text-align: right';
+ $table2->style[6] = 'text-align: right';
foreach ($item['data'] as $row) {
$table_row = [];
- if (isset($row['failover'])) {
- if (strpos($row['failover'], 'failover') !== false) {
- $table_row[] = __('Failover');
- } else {
- $table_row[] = ucfirst($row['failover']);
+ if (isset($row['failover']) === true) {
+ switch ($row['failover']) {
+ case 'primary_compare':
+ $table_row[] = __('Primary').' (24x7)';
+ break;
+
+ case 'failover_compare':
+ $table_row[] = __('Failover').' (24x7)';
+ break;
+
+ case 'result_compare':
+ $table_row[] = __('Result').' (24x7)';
+ break;
+
+ default:
+ if (strpos($row['failover'], 'failover') !== false) {
+ $table_row[] = __('Failover');
+ } else {
+ $table_row[] = ucfirst($row['failover']);
+ }
+ break;
}
}
- if (isset($row['failover']) && $row['failover'] === 'result') {
+ if (isset($row['failover']) === true
+ && ($row['failover'] === 'result'
+ || $row['failover'] === 'result_compare')
+ ) {
$table_row[] = '--';
$table_row[] = '--';
} else {
$table_row[] = $row['agent'];
- $table_row[] = $row['availability_item'];
+ $item = $row['availability_item'];
+ if ((bool) $row['compare'] === true) {
+ $item .= ' ('.__('24 x 7').')';
+ }
+
+ $table_row[] = $item;
}
if ($row['time_total'] != 0 && $item['fields']['total_time']) {
@@ -3391,7 +3449,9 @@ function reporting_html_availability($table, $item, $pdf=0)
true,
$interval_description
);
- } else if ($row['time_total'] == 0 && $item['fields']['total_time']) {
+ } else if ($row['time_total'] == 0
+ && $item['fields']['total_time']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
@@ -3403,7 +3463,9 @@ function reporting_html_availability($table, $item, $pdf=0)
true,
$interval_description
);
- } else if ($row['time_error'] == 0 && $item['fields']['time_failed']) {
+ } else if ($row['time_error'] == 0
+ && $item['fields']['time_failed']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
@@ -3415,43 +3477,57 @@ function reporting_html_availability($table, $item, $pdf=0)
true,
$interval_description
);
- } else if ($row['time_ok'] == 0 && $item['fields']['time_in_ok_status']) {
+ } else if ($row['time_ok'] == 0
+ && $item['fields']['time_in_ok_status']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
};
- if ($row['time_unknown'] != 0 && $item['fields']['time_in_unknown_status']) {
+ if ($row['time_unknown'] != 0
+ && $item['fields']['time_in_unknown_status']
+ ) {
$table_row[] = human_time_description_raw(
$row['time_unknown'],
true,
$interval_description
);
- } else if ($row['time_unknown'] == 0 && $item['fields']['time_in_unknown_status']) {
+ } else if ($row['time_unknown'] == 0
+ && $item['fields']['time_in_unknown_status']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
};
- if ($row['time_not_init'] != 0 && $item['fields']['time_of_not_initialized_module']) {
+ if ($row['time_not_init'] != 0
+ && $item['fields']['time_of_not_initialized_module']
+ ) {
$table_row[] = human_time_description_raw(
$row['time_not_init'],
true,
$interval_description
);
- } else if ($row['time_not_init'] == 0 && $item['fields']['time_of_not_initialized_module']) {
+ } else if ($row['time_not_init'] == 0
+ && $item['fields']['time_of_not_initialized_module']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
};
- if ($row['time_downtime'] != 0 && $item['fields']['time_of_downtime']) {
+ if ($row['time_downtime'] != 0
+ && $item['fields']['time_of_downtime']
+ ) {
$table_row[] = human_time_description_raw(
$row['time_downtime'],
true,
$interval_description
);
- } else if ($row['time_downtime'] == 0 && $item['fields']['time_of_downtime']) {
+ } else if ($row['time_downtime'] == 0
+ && $item['fields']['time_of_downtime']
+ ) {
$table_row[] = '--';
} else {
$table_row[] = '';
@@ -3460,39 +3536,78 @@ function reporting_html_availability($table, $item, $pdf=0)
$table_row[] = ''.sla_truncate($row['SLA'], $config['graph_precision']).'%';
$table_row2 = [];
- if (isset($row['failover'])) {
- $table_row2[] = ucfirst($row['failover']);
+ if (isset($row['failover']) === true) {
+ switch ($row['failover']) {
+ case 'primary_compare':
+ $table_row2[] = __('Primary').' (24x7)';
+ break;
+
+ case 'failover_compare':
+ $table_row2[] = __('Failover').' (24x7)';
+ break;
+
+ case 'result_compare':
+ $table_row2[] = __('Result').' (24x7)';
+ break;
+
+ default:
+ if (strpos($row['failover'], 'failover') !== false) {
+ $table_row2[] = __('Failover');
+ } else {
+ $table_row2[] = ucfirst($row['failover']);
+ }
+ break;
+ }
+ }
+
+ if (isset($row['failover']) === true
+ && ($row['failover'] === 'result'
+ || $row['failover'] === 'result_compare')
+ ) {
+ $table_row2[] = '--';
+ $table_row2[] = '--';
+ } else {
+ $table_row2[] = $row['agent'];
+ $item = $row['availability_item'];
+ if ((bool) $row['compare'] === true) {
+ $item .= ' ('.__('24 x 7').')';
+ }
+
+ $table_row2[] = $item;
}
- $table_row2[] = $row['agent'];
- $table_row2[] = $row['availability_item'];
if ($item['fields']['total_checks']) {
$table_row2[] = $row['checks_total'];
} else {
$table_row2[] = '';
- };
+ }
+
if ($item['fields']['checks_failed']) {
$table_row2[] = $row['checks_error'];
} else {
$table_row2[] = '';
- };
+ }
+
if ($item['fields']['checks_in_ok_status']) {
$table_row2[] = $row['checks_ok'];
} else {
$table_row2[] = '';
- };
+ }
+
if ($item['fields']['unknown_checks']) {
$table_row2[] = $row['checks_unknown'];
} else {
$table_row2[] = '';
- };
+ }
$table1->data[] = $table_row;
$table2->data[] = $table_row2;
}
} else {
$table->colspan['error']['cell'] = 3;
- $table->data['error']['cell'] = __('There are no Agent/Modules defined');
+ $table->data['error']['cell'] = __(
+ 'There are no Agent/Modules defined'
+ );
}
if ($pdf === 0) {
@@ -3521,10 +3636,12 @@ function reporting_html_availability($table, $item, $pdf=0)
}
}
- if ($item['resume']['resume'] && !empty($item['data'])) {
+ if ($item['resume']['resume'] && empty($item['data']) === false) {
$table1->width = '99%';
$table1->data = [];
- if (empty($same_agent_in_resume) || (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) {
+ if (empty($same_agent_in_resume) === true
+ || (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)
+ ) {
$table1->head = [];
$table1->head['max_text'] = __('Agent max value');
$table1->head['max'] = __('Max Value');
@@ -3668,23 +3785,33 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
// Check failover availability report.
if (empty($item['data'][$k_chart]['failover']) === true) {
- $table1 = new stdClass();
- $table1->width = '100%';
- $table1->autosize = 1;
- $table1->styleTable = 'overflow: wrap; table-layout: fixed;';
- $table1->data = [];
- $table1->size = [];
- $table1->size[0] = '10%';
- $table1->size[1] = '80%';
- $table1->size[2] = '10%';
+ if ($item['data'][$k_chart]['compare'] === 0
+ || $item['data'][$k_chart]['compare'] === 1
+ ) {
+ $table1 = new stdClass();
+ $table1->width = '100%';
+ $table1->autosize = 1;
+ $table1->styleTable = 'overflow: wrap; table-layout: fixed;';
+ $table1->data = [];
+ $table1->size = [];
+ $table1->size[0] = '10%';
+ $table1->size[1] = '80%';
+ $table1->size[2] = '10%';
+ }
$table1->style[0] = 'overflow-wrap: break-word';
// Align percentage and checks resume.
$table1->align[2] = 'center';
- $table1->data[0][0] = $chart['agent'].'
'.$chart['module'];
- $table1->data[0][1] = $chart['chart'];
- $table1->data[0][2] = "".$sla_value.'
';
+ $table1->data[$k_chart][0] = $chart['agent'];
+ $table1->data[$k_chart][0] .= '
';
+ $table1->data[$k_chart][0] .= $chart['module'];
+ if ($item['data'][$k_chart]['compare'] === 1) {
+ $table1->data[$k_chart][0] .= ' (24 x 7)';
+ }
+
+ $table1->data[$k_chart][1] = $chart['chart'];
+ $table1->data[$k_chart][2] = "".$sla_value.'
';
// Pdf sizes to avoid excesive overflow.
if ($pdf !== 0) {
@@ -3693,15 +3820,20 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table1->size[2] = '15%';
}
- $table1->data[0][2] .= "".$checks_resume.'';
+ $table1->data[$k_chart][2] .= "".$checks_resume.'';
- $tables_chart .= html_print_table(
- $table1,
- true
- );
+ if ($item['data'][$k_chart]['compare'] !== 1) {
+ $tables_chart .= html_print_table(
+ $table1,
+ true
+ );
+ }
} else {
- if ($item['data'][$k_chart]['failover'] === 'primary'
- || $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE
+ if (($item['data'][$k_chart]['failover'] === 'primary'
+ || $item['data'][$k_chart]['failover'] === 'primary_compare'
+ || $item['failover_type'] == REPORT_FAILOVER_TYPE_SIMPLE)
+ && ($item['data'][$k_chart]['compare'] === 0
+ || $item['data'][$k_chart]['compare'] === 1)
) {
$table1 = new stdClass();
$table1->width = '99%';
@@ -3719,18 +3851,38 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$checks_resume_text .= '';
$sla_value_text = "".$sla_value.'';
switch ($item['data'][$k_chart]['failover']) {
+ case 'primary_compare':
+ $title = ''.__('Primary').' (24x7)';
+ $title .= '
'.$chart['agent'];
+ $title .= '
'.$chart['module'];
+ break;
+
case 'primary':
$title = ''.__('Primary').'';
$title .= '
'.$chart['agent'];
$title .= '
'.$chart['module'];
break;
+ case 'failover_compare':
+ $title = ''.__('Failover').' (24x7)';
+ $title .= '
'.$chart['agent'];
+ $title .= '
'.$chart['module'];
+ break;
+
case (preg_match('/failover.*/', $item['data'][$k_chart]['failover']) ? true : false):
$title = ''.__('Failover').'';
$title .= '
'.$chart['agent'];
$title .= '
'.$chart['module'];
break;
+ case 'result_compare':
+ $title = ''.__('Result').' (24x7)';
+ $sla_value_text = "".$sla_value.'';
+ $checks_resume_text = '';
+ $checks_resume_text .= $checks_resume;
+ $checks_resume_text .= '';
+ break;
+
case 'result':
default:
$title = ''.__('Result').'';
@@ -3746,7 +3898,9 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table1->data[$item['data'][$k_chart]['failover']][2] = $sla_value_text;
$table1->data[$item['data'][$k_chart]['failover']][3] = $checks_resume_text;
- if ($item['data'][$k_chart]['failover'] === 'result') {
+ if ($item['data'][$k_chart]['compare'] !== 1
+ && $item['data'][$k_chart]['failover'] === 'result'
+ ) {
$tables_chart .= html_print_table(
$table1,
true
diff --git a/pandora_console/include/functions_update_manager.php b/pandora_console/include/functions_update_manager.php
index 2ea5615088..af14d01a24 100755
--- a/pandora_console/include/functions_update_manager.php
+++ b/pandora_console/include/functions_update_manager.php
@@ -53,6 +53,7 @@ function update_manager_verify_registration()
return false;
}
+
/**
* Check if a trial license is in use.
*
@@ -63,7 +64,7 @@ function update_manager_verify_trial()
global $config;
if (isset($config['license_licensed_to'])
- && strstr($config['license_licensed_to'], 'info@pandorafms.com') !== FALSE
+ && strstr($config['license_licensed_to'], 'info@pandorafms.com') !== false
) {
return true;
}
@@ -71,6 +72,7 @@ function update_manager_verify_trial()
return false;
}
+
/**
* Parses responses from configuration wizard.
*
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 64c5eacf79..70cd7b1879 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -967,10 +967,10 @@ function install_step4()
$connection,
"CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'"
);
- $step5 |= mysqli_query(
- $connection,
- "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
- );
+ $step5 |= mysqli_query(
+ $connection,
+ "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host"
+ );
mysqli_query($connection, 'FLUSH PRIVILEGES');
check_generic($step5, "Established privileges for user pandora. A new random password has been generated: $random_passwordPlease write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
");
diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql
index 011e8e513f..7121fb134c 100644
--- a/pandora_console/pandoradb.sql
+++ b/pandora_console/pandoradb.sql
@@ -1533,6 +1533,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`uncompressed_module` TINYINT DEFAULT '0',
`landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
+ `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_rc`),
FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`)
ON UPDATE CASCADE ON DELETE CASCADE
@@ -3111,6 +3112,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`uncompressed_module` TINYINT DEFAULT '0',
`landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
+ `compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
PRIMARY KEY(`id_rc`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql
index 46c878b19f..36104e127a 100644
--- a/pandora_console/pandoradb_data.sql
+++ b/pandora_console/pandoradb_data.sql
@@ -109,10 +109,10 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', ''),
-('MR', 40),
+('MR', 41),
('identification_reminder', 1),
('identification_reminder_timestamp', 0),
-('current_package_enterprise', '748'),
+('current_package_enterprise', '749'),
('post_process_custom_values', '{"0.00000038580247":"Seconds to months","0.00000165343915":"Seconds to weeks","0.00001157407407":"Seconds to days","0.01666666666667":"Seconds to minutes","0.00000000093132":"Bytes to Gigabytes","0.00000095367432":"Bytes to Megabytes","0.0009765625":"Bytes to Kilobytes","0.00000001653439":"Timeticks to weeks","0.00000011574074":"Timeticks to days"}'),
('custom_docs_logo', 'default_docs.png'),
('custom_support_logo', 'default_support.png'),